Makefile 11.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
22

23 24
include ../config.inc

25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

############################
# HELPER MACROS
############################

full-version	= $(shell cat $(1))
minor-version	= $(shell echo $(call full-version,$(1)) | cut -f1-2 -d.)
ifneq ($(LINK_STRICT_VERSION),0)
link-version	= $(call full-version,$(1))
else
link-version	= $(call minor-version,$(1))
endif

lib-base        = liblima$(1).so
lib-full        = $(call lib-base,$(1)).$(call full-version,$(2))
lib-minor       = $(call lib-base,$(1)).$(call minor-version,$(2))
lib-link	= $(call lib-base,$(1)).$(call link-version,$(2))
lib-flags	= -fPIC -Wl,-soname,$(call lib-link,$(1),$(2))

# 1=name, 2=ver-file 3=flags 4=deps, 5=target, 6=objs
compile-lib	= \
	$(CXX) -shared -o $(5) $(3) $(call lib-flags,$(1),$(2)) $(6) $(4)

create-links	= \
	rm -f $(call lib-minor,$(1),$(2)) && \
	rm -f $(call lib-base,$(1),$(2)) && \
	ln -s $(call lib-full,$(1),$(2))  $(call lib-minor,$(1),$(2)) && \
	ln -s $(call lib-minor,$(1),$(2)) $(call lib-base,$(1),$(2))


55 56 57 58
############################
# LIMA - CORE
############################

ahoms's avatar
ahoms committed
59 60
CORE_LDFLAGS	:= -L../third-party/Processlib/build
CORE_LDLIBS	:= -lprocesslib
61

seb's avatar
seb committed
62 63 64 65 66
ifneq ($(COMPILE_CBF_SAVING),0)
CORE_LDFLAGS += -L../third-party/CBFLib/lib
CORE_LDLIBS += -lcbf
endif

67
ifneq ($(COMPILE_FITS_SAVING),0)
68
CORE_LDFLAGS += -L../third-party/cfitsio/lib -L../third-party/CCfits/.libs
69 70 71
CORE_LDLIBS += -lCCfits -lcfitsio
endif

72 73 74 75
ifneq ($(COMPILE_EDFGZ_SAVING),0)
CORE_LDLIBS += -lz
endif

76 77
ifneq ($(COMPILE_CORE),0)

78
core-name	:= core
ahoms's avatar
ahoms committed
79 80
core-objs	:= ../common/src/Common.o \
		   ../hardware/src/Hw.o \
ahoms's avatar
ahoms committed
81
		   ../control/src/Ct.o
82
core-ver	:= ../common/VERSION
ahoms's avatar
ahoms committed
83 84
core-flags	:= $(CORE_LDFLAGS)
core-deps	:= $(CORE_LDLIBS)
85

86 87 88 89
$(call lib-full,$(core-name),$(core-ver)): $(core-objs)
	$(call compile-lib,$(core-name),$(core-ver),\
			   $(core-flags),$(core-deps),$@,$+)
	$(call create-links,$(core-name),$(core-ver))
ahoms's avatar
ahoms committed
90

91
build_targets	:= $(call lib-full,$(core-name),$(core-ver))
92 93 94

endif

ahoms's avatar
ahoms committed
95 96
LDFLAGS		:= $(CORE_LDFLAGS) -L.
LDLIBS		:= $(CORE_LDLIBS) -llimacore
97 98 99 100 101 102 103 104


############################
# LIMA - SIMULATOR
############################

ifneq ($(COMPILE_SIMULATOR),0)

105
simu-name	:= simulator
ahoms's avatar
ahoms committed
106
simu-objs	:= ../camera/simulator/src/Simu.o
107
simu-ver	:= ../camera/simulator/VERSION
ahoms's avatar
ahoms committed
108 109 110
simu-flags	:= $(LDFLAGS)
simu-deps	:= $(LDLIBS)

111 112 113 114
$(call lib-full,$(simu-name),$(simu-ver)): $(simu-objs)
	$(call compile-lib,$(simu-name),$(simu-ver),\
			   $(simu-flags),$(simu-deps),$@,$+)
	$(call create-links,$(simu-name),$(simu-ver))
ahoms's avatar
ahoms committed
115

116
build_targets	+= $(call lib-full,$(simu-name),$(simu-ver))
117 118

endif
ahoms's avatar
ahoms committed
119

120 121 122 123 124

############################
# LIMA - ESPIA
############################

125 126 127

ifneq ($(COMPILE_ESPIA),0)

128
include ../camera/common/espia/include/espia.inc
ahoms's avatar
ahoms committed
129 130
ESPIA_LDFLAGS	:= $(LDFLAGS) -L$(ESPIA_DRV_LIB)
ESPIA_LDLIBS	:= $(LDLIBS) -lespia
131

132
espia-name	:= espia
ahoms's avatar
ahoms committed
133
espia-objs	:= ../camera/common/espia/src/Espia.o
134
espia-ver	:= ../camera/common/espia/VERSION
ahoms's avatar
ahoms committed
135 136 137
espia-flags	:= $(ESPIA_LDFLAGS)
espia-deps	:= $(ESPIA_LDLIBS)

138 139 140 141
$(call lib-full,$(espia-name),$(espia-ver)): $(espia-objs)
	$(call compile-lib,$(espia-name),$(espia-ver),\
			   $(espia-flags),$(espia-deps),$@,$+)
	$(call create-links,$(espia-name),$(espia-ver))
ahoms's avatar
ahoms committed
142

143
build_targets	+= $(call lib-full,$(espia-name),$(espia-ver))
144

145 146
endif

147 148 149 150 151

############################
# LIMA - FRELON
############################

152
ifneq ($(COMPILE_FRELON),0)
153

ahoms's avatar
ahoms committed
154 155 156
FRELON_LDFLAGS	:= $(ESPIA_LDFLAGS) -L.
FRELON_LDLIBS	:= $(ESPIA_LDLIBS) -llimaespia

157
frelon-name	:= frelon
ahoms's avatar
ahoms committed
158
frelon-objs	:= ../camera/frelon/src/Frelon.o
159
frelon-ver	:= ../camera/frelon/VERSION
ahoms's avatar
ahoms committed
160 161 162
frelon-flags	:= $(FRELON_LDFLAGS)
frelon-deps	:= $(FRELON_LDLIBS)

163 164 165 166
$(call lib-full,$(frelon-name),$(frelon-ver)): $(frelon-objs)
	$(call compile-lib,$(frelon-name),$(frelon-ver),\
			   $(frelon-flags),$(frelon-deps),$@,$+)
	$(call create-links,$(frelon-name),$(frelon-ver))
167

168
build_targets	+= $(call lib-full,$(frelon-name),$(frelon-ver))
169

170 171
endif

172 173 174 175 176

############################
# LIMA - MAXIPIX
############################

177
ifneq ($(COMPILE_MAXIPIX),0)
178

ahoms's avatar
ahoms committed
179 180 181
MAXIPIX_LDFLAGS	:= $(ESPIA_LDFLAGS) -L.
MAXIPIX_LDLIBS	:= $(ESPIA_LDLIBS) -llimaespia

182
maxipix-name	:= maxipix
ahoms's avatar
ahoms committed
183
maxipix-objs	:= ../camera/maxipix/src/Maxipix.o
184
maxipix-ver	:= ../camera/maxipix/VERSION
ahoms's avatar
ahoms committed
185 186 187
maxipix-flags	:= $(MAXIPIX_LDFLAGS)
maxipix-deps	:= $(MAXIPIX_LDLIBS)

188 189 190 191
$(call lib-full,$(maxipix-name),$(maxipix-ver)): $(maxipix-objs)
	$(call compile-lib,$(maxipix-name),$(maxipix-ver),\
			   $(maxipix-flags),$(maxipix-deps),$@,$+)
	$(call create-links,$(maxipix-name),$(maxipix-ver))
192

193
build_targets	+= $(call lib-full,$(maxipix-name),$(maxipix-ver))
194 195 196

endif

197 198 199 200 201 202
############################
# LIMA - BASLER
############################

ifneq ($(COMPILE_BASLER),0)

203 204
BASLER_LDFLAGS	:= $(LDFLAGS) -L. -L/opt/pylon/lib -L/opt/pylon/lib64
BASLER_LDLIBS	:= $(LDLIBS) -lpylongigesupp
205

206
basler-name	:= basler
207
basler-objs	:= ../camera/basler/src/Basler.o
208
basler-ver	:= ../camera/basler/VERSION
209 210 211
basler-flags	:= $(BASLER_LDFLAGS)
basler-deps	:= $(BASLER_LDLIBS)

212 213 214 215 216 217 218
$(call lib-full,$(basler-name),$(basler-ver)): $(basler-objs)
	$(call compile-lib,$(basler-name),$(basler-ver),\
			   $(basler-flags),$(basler-deps),$@,$+)
	$(call create-links,$(basler-name),$(basler-ver))

build_targets	+= $(call lib-full,$(basler-name),$(basler-ver))

Florent Langlois's avatar
Florent Langlois committed
219 220
endif

Sebastien Petitdemange's avatar
Sebastien Petitdemange committed
221 222 223 224 225 226
############################
# LIMA - UEYE
############################

ifneq ($(COMPILE_UEYE),0)

227 228
UEYE_LDFLAGS	:= $(LDFLAGS)
UEYE_LDLIBS	:= $(LDLIBS) -lueye_api
Sebastien Petitdemange's avatar
Sebastien Petitdemange committed
229

230
ueye-name	:= ueye
Sebastien Petitdemange's avatar
Sebastien Petitdemange committed
231
ueye-objs	:= ../camera/ueye/src/Ueye.o
232
ueye-ver	:= ../camera/ueye/VERSION
Sebastien Petitdemange's avatar
Sebastien Petitdemange committed
233 234 235
ueye-flags	:= $(UEYE_LDFLAGS)
ueye-deps	:= $(UEYE_LDLIBS)

236 237 238 239 240 241 242
$(call lib-full,$(ueye-name),$(ueye-ver)): $(ueye-objs)
	$(call compile-lib,$(ueye-name),$(ueye-ver),\
			   $(ueye-flags),$(ueye-deps),$@,$+)
	$(call create-links,$(ueye-name),$(ueye-ver))

build_targets	+= $(call lib-full,$(ueye-name),$(ueye-ver))

Sebastien Petitdemange's avatar
Sebastien Petitdemange committed
243 244
endif

Florent Langlois's avatar
Florent Langlois committed
245 246 247 248 249 250 251 252 253 254
############################
# LIMA - PROSILICA
############################

ifneq ($(COMPILE_PROSILICA),0)

PROCESSOR_TYPE := $(shell uname -i)
ifeq ($(PROCESSOR_TYPE),i386)
PROSILICA_LDFLAGS	:= -L. -L../camera/prosilica/sdk/bin/x86
else
255 256
PROSILICA_LDFLAGS	:= -L. -L../camera/prosilica/sdk/bin/x64 \
			   -L../camera/prosilica/sdk/bin/x86
Florent Langlois's avatar
Florent Langlois committed
257 258 259
endif
PROSILICA_LDLIBS	:= -lPvAPI

260
prosilica-name	:= prosilica
Florent Langlois's avatar
Florent Langlois committed
261
prosilica-objs	:= ../camera/prosilica/src/Prosilica.o
262
prosilica-ver	:= ../camera/prosilica/VERSION
263 264
prosilica-flags	:= $(LDFLAGS) $(PROSILICA_LDFLAGS)
prosilica-deps	:= $(LDLIBS) $(PROSILICA_LDLIBS)
265

266 267 268 269 270 271 272
$(call lib-full,$(prosilica-name),$(prosilica-ver)): $(prosilica-objs)
	$(call compile-lib,$(prosilica-name),$(prosilica-ver),\
			   $(prosilica-flags),$(prosilica-deps),$@,$+)
	$(call create-links,$(prosilica-name),$(prosilica-ver))

build_targets	+= $(call lib-full,$(prosilica-name),$(prosilica-ver))

273 274
endif

teresa's avatar
teresa committed
275 276 277 278 279 280 281

############################
# LIMA - ROPERSCIENTIFIC
############################

ifneq ($(COMPILE_ROPERSCIENTIFIC),0)

282
ROPERSCIENTIFIC_LDLIBS	:= $(LDLIBS) -lpvcam -lraw1394
teresa's avatar
teresa committed
283

284 285 286 287 288
ropersci-name	:= roperscientific
ropersci-objs	:= ../camera/roperscientific/src/RoperScientific.o
ropersci-ver	:= ../camera/roperscientific/VERSION
ropersci-flags	:= $(LDFLAGS)
ropersci-deps	:= $(ROPERSCIENTIFIC_LDLIBS)
teresa's avatar
teresa committed
289

290 291 292 293
$(call lib-full,$(ropersci-name),$(ropersci-ver)): $(ropersci-objs)
	$(call compile-lib,$(ropersci-name),$(ropersci-ver),\
			   $(ropersci-flags),$(ropersci-deps),$@,$+)
	$(call create-links,$(ropersci-name),$(ropersci-ver))
teresa's avatar
teresa committed
294

295
build_targets	+= $(call lib-full,$(ropersci-name),$(ropersci-ver))
teresa's avatar
teresa committed
296 297 298

endif

299

300 301 302 303 304 305
############################
# LIMA - ADSC
############################

ifneq ($(COMPILE_ADSC),0)

306 307
ADSC_LDFLAGS	:= $(LDFLAGS) -L. -L../camera/adsc/sdk/adsc_sources/lib/linux
ADSC_LDLIBS	:= $(LDLIBS) -lauxlib -ldetcon_th
308 309

adsc-name	:= adsc
310
adsc-objs	:= ../camera/adsc/src/Adsc.o
311
adsc-ver	:= ../camera/adsc/VERSION
312 313 314
adsc-flags	:= $(ADSC_LDFLAGS)
adsc-deps	:= $(ADSC_LDLIBS)

315 316 317 318
$(call lib-full,$(adsc-name),$(adsc-ver)): $(adsc-objs)
	$(call compile-lib,$(adsc-name),$(adsc-ver),\
			   $(adsc-flags),$(adsc-deps),$@,$+)
	$(call create-links,$(adsc-name),$(adsc-ver))
319

320
build_targets	+= $(call lib-full,$(adsc-name),$(adsc-ver))
321 322 323 324

endif


teresa's avatar
teresa committed
325 326 327 328 329 330
############################
# LIMA - MYTHEN
############################

ifneq ($(COMPILE_MYTHEN),0)

331
MYTHEN_LDLIBS	:= $(LDLIBS) -lSlsDetector
332 333

mythen-name	:= mythen
teresa's avatar
teresa committed
334
mythen-objs	:= ../camera/mythen/src/Mythen.o
335
mythen-ver	:= ../camera/mythen/VERSION
teresa's avatar
teresa committed
336 337 338
mythen-flags	:= $(LDFLAGS)
mythen-deps	:= $(MYTHEN_LDLIBS)

339 340 341 342
$(call lib-full,$(mythen-name),$(mythen-ver)): $(mythen-objs)
	$(call compile-lib,$(mythen-name),$(mythen-ver),\
			   $(mythen-flags),$(mythen-deps),$@,$+)
	$(call create-links,$(mythen-name),$(mythen-ver))
343

344
build_targets	+= $(call lib-full,$(mythen-name),$(mythen-ver))
345

346
endif
teresa's avatar
teresa committed
347

348

349 350 351 352 353 354
############################
# LIMA - ANDOR
############################

ifneq ($(COMPILE_ANDOR),0)

355 356
ANDOR_LDFLAGS	:= $(LDFLAGS) -L. -L/usr/local/lib
ANDOR_LDLIBS	:= $(LDLIBS) -landor
357

358
andor-name	:= andor
359
andor-objs	:= ../camera/andor/src/Andor.o
360
andor-ver	:= ../camera/andor/VERSION
361 362 363
andor-flags	:= $(ANDOR_LDFLAGS)
andor-deps	:= $(ANDOR_LDLIBS)

364 365 366 367 368 369 370
$(call lib-full,$(andor-name),$(andor-ver)): $(andor-objs)
	$(call compile-lib,$(andor-name),$(andor-ver),\
			   $(andor-flags),$(andor-deps),$@,$+)
	$(call create-links,$(andor-name),$(andor-ver))

build_targets	+= $(call lib-full,$(andor-name),$(andor-ver))

371 372
endif

373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
############################
# LIMA - MARCCD
############################

ifneq ($(COMPILE_MARCCD),0)

MARCCD_LDFLAGS	:= $(LDFLAGS) -L. -L../third-party/yat/src/.libs
MARCCD_LDLIBS	:= $(LDLIBS) -lyat -lrt

marccd-name	:= marccd
marccd-objs	:= ../camera/marccd/src/Marccd.o
marccd-ver	:= ../camera/marccd/VERSION
marccd-flags	:= $(MARCCD_LDFLAGS)
marccd-deps	:= $(MARCCD_LDLIBS)

$(call lib-full,$(marccd-name),$(marccd-ver)): $(marccd-objs)
	$(call compile-lib,$(marccd-name),$(marccd-ver),\
			   $(marccd-flags),$(marccd-deps),$@,$+)
	$(call create-links,$(marccd-name),$(marccd-ver))

build_targets	+= $(call lib-full,$(marccd-name),$(marccd-ver))

endif
396

397 398 399 400 401 402
############################
# LIMA - XPAD
############################

ifneq ($(COMPILE_XPAD),0)

403
XPAD_LDLIBS	:= $(LDLIBS) -L/home/xpix_user/PCI_VALIDATED/trunk/sw/xpci_lib \
404 405 406
		   -lxpci_lib -L../third-party/yat/lib/i386/static -lyat

xpad-name	:= xpad
407
xpad-objs	:= ../camera/xpad/src/Xpad.o
408
xpad-ver	:= ../camera/xpad/VERSION
409 410 411
xpad-flags	:= $(LDFLAGS)
xpad-deps	:= $(XPAD_LDLIBS)

412 413 414 415
$(call lib-full,$(xpad-name),$(xpad-ver)): $(xpad-objs)
	$(call compile-lib,$(xpad-name),$(xpad-ver),\
			   $(xpad-flags),$(xpad-deps),$@,$+)
	$(call create-links,$(xpad-name),$(xpad-ver))
416

417
build_targets	+= $(call lib-full,$(xpad-name),$(xpad-ver))
418 419 420

endif

421
src:		$(build_targets)
422 423 424 425

test:
	@true

kirov's avatar
kirov committed
426
clean:
ahoms's avatar
ahoms committed
427
	rm -f *.o liblima*.so*