1
2# This holds the common definitions for Argyll that all the
3# subdirectory jam's will include (even if run in the sub directory)
4
5Echo "Argyll Jamrules has been read" ;
6
7# Default install base directory is same directory as Jamtop,
8# but can be overriden in the command line.
9DESTDIR ?= [ NormPaths  . ] ;
10
11# Default prefix is empty, but can be overriden in the command line.
12PREFIX ?= "" ;
13
14# Default ref file sub-directory is "ref", but can be overriden in the command line.
15REFSUBDIR ?= "ref" ;
16
17Echo "DESTDIR = '$(DESTDIR)', PREFIX = '$(PREFIX)', REFSUBDIR = '$(REFSUBDIR)'" ;
18
19# Keep this DESTDIR anchored to Jamtop. PREFIX is used literally
20ANCHORED_PATH_VARS = DESTDIR ;
21
22
23# Should we also allow CFLAGS, CXXFLAGS, CPPFLAGS & LDFLAGS env. variables
24# to have effect ?
25
26
27# Tell standalone libraries that they are part of Argyll:
28DEFINES += ARGYLLCMS ;
29
30# enable serial instruments & support
31USE_SERIAL = true ;
32
33# enable fast serial instruments & support
34USE_FAST_SERIAL = true ;		# (Implicit in USE_SERIAL too)
35
36# enable USB instruments & support
37USE_USB = true ;
38
39# enable dummy Demo Instrument (only if code is available)
40USE_DEMOINST = true ;
41
42# Use ArgyllCMS version of libusb (deprecated - don't use)
43USE_LIBUSB = false ;
44
45if $(USE_LIBUSB) = true {
46
47	# Use libusb1 rather than libusb0 & libusb0-win32 (deprecated)
48	USE_LIBUSB1 = true ;
49
50	# Make the USB V1 library static
51	LIBUSB_IS_DLL = false ;
52
53	# Always use DLL for MSWin, because driver install expects it (.inf)
54	if $(NT) {
55		LIBUSB_IS_DLL = true ;
56	}
57
58	# Set the libubs1 library name.
59	LIBUSB1NAME = libusb-1.0A ;
60}
61
62# For testing CCast
63#DEFINES += CCTEST_PATTERN ;
64
65# Information for compiling and linking GUI programs
66
67if $(UNIX) {
68	if $(OS) = MACOSX {
69		LINKFLAGS += -framework IOKit ;
70		LINKFLAGS += -framework CoreFoundation ;
71		LINKFLAGS += -framework AudioToolbox ;
72		LINKFLAGS += -framework AppKit ;
73
74	} else {
75		if [ GLOB /usr/X11R6/include/X11 : X.h ] {
76			LibWinH = /usr/X11R6/include ;
77		} else if [ GLOB /usr/include/X11 : X.h ] {
78			LibWinH = /usr/include ;
79		} else if [ GLOB $(LOCALBASE)/include/X11 : X.h ] {
80			LibWinH = $(LOCALBASE)/include ;
81		} else {
82			EXIT Unable to locate the X11 include files ;
83		}
84
85		if $(HOST64) {
86			if [ GLOB /usr/X11R6/lib : libX11.so libX11.a ] {
87				LibWinD = /usr/X11R6/lib ;
88			} else if [ GLOB /usr/lib/x86_64-linux-gnu : libX11.so libX11.a ] {
89				LibWinD = /usr/lib/x86_64-linux-gnu ;
90			} else if [ GLOB /usr/lib64 : libX11.so libX11.a ] {
91				LibWinD = /usr/lib64 ;
92			} else if [ GLOB /usr/lib : libX11.so libX11.a ] {
93				LibWinD = /usr/lib ;
94			} else if [ GLOB $(LOCALBASE)/lib : libX11.so libX11.a ] {
95				LibWinD = $(LOCALBASE)/lib ;
96			} else {
97				ECHO Unable to locate the 64 bit X11 library files ;
98			}
99		} else {
100			if [ GLOB /usr/X11R6/lib : libX11.so libX11.a ] {
101				LibWinD = /usr/X11R6/lib ;
102			} else if [ GLOB /usr/lib/i386-linux-gnu : libX11.so libX11.a ] {
103				LibWinD = /usr/lib/i386-linux-gnu ;
104			} else if [ GLOB /usr/lib : libX11.so libX11.a ] {
105				LibWinD = /usr/lib ;
106			} else if [ GLOB $(LOCALBASE)/lib : libX11.so libX11.a ] {
107				LibWinD = $(LOCALBASE)/lib ;
108			} else {
109				ECHO Unable to locate the 32 bit X11 library files ;
110			}
111		}
112		if $(OS) = FREEBSD {
113			LINKFLAGS += -L$(LibWinD) -g -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss  -lusb ;
114		} else if $(OS) = OPENBSD {
115			LINKFLAGS += -L$(LibWinD) -g -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss -L/usr/local/lib ;
116		} else {
117			LINKFLAGS += -L$(LibWinD) -ldl -lrt -lX11 -lXext -lXxf86vm -lXinerama -lXrandr -lXau -lXdmcp -lXss ;
118		}
119		# HDRS += $(LibWinH) ;
120	}
121}
122
123# Standard system library support:
124
125# Check rule. $(<) is library name, $(>) is optional alternate library name
126# $(3) is optional #include sub-directory, i.e. "/openssl"
127rule CheckForLibrary {
128	UCASE = $(<:U) ;
129	lcase = $(<:L) ;
130	libname = $(lcase) ;
131	subd = "" ;
132
133	if $(>) {
134		libname = $(>) ;
135	}
136
137	if $(3) {
138		subd = $(3) ;
139	}
140
141	if ! $(BUILTIN_$(UCASE)) && $(UNIX) {
142		if  [ GLOB /usr/include$(subd) : $(lcase).h $(lcase)lib.h ]
143	     || [ GLOB $(LOCALBASE)/include$(subd) : $(lcase).h $(lcase)lib.h ]
144		 || [ GLOB /usr/include/x86_64-linux-gnu$(subd) : $(lcase).h $(lcase)lib.h ]
145	     || [ GLOB /usr/include/i386-linux-gnu$(subd) : $(lcase).h $(lcase)lib.h ] {
146			if  [ GLOB /usr/lib : lib$(lcase).so ] || [ GLOB /usr/lib : lib$(lcase).a ]
147			 || [ GLOB $(LOCALBASE)/lib : lib$(lcase).so ] || [ GLOB /usr/local/lib : lib$(lcase).a ]
148			 || [ GLOB /usr/lib64 : lib$(lcase).so ] || [ GLOB /usr/lib64 : lib$(lcase).a ]
149			 || [ GLOB /usr/lib/x86_64-linux-gnu : lib$(lcase).so ]
150			 || [ GLOB /usr/lib/x86_64-linux-gnu : lib$(lcase).a ]
151	         || [ GLOB /usr/lib/i386-linux-gnu : lib$(lcase).so ]
152	         || [ GLOB /usr/lib/i386-linux-gnu : lib$(lcase).a ] {
153				echo "Using system $(UCASE) library" ;
154				$(UCASE)LIB = ;
155				$(UCASE)INC = ;
156				LINKFLAGS += $(LINKFLAG)$(lcase) ;
157				HAVE_$(UCASE) = true ;
158			}
159		}
160	}
161
162	# If nothing else, use Argyll supplied $(UCASE) library
163	if ! $(HAVE_$(UCASE)) || $(BUILTIN_$(UCASE)) {
164		echo "Using Argyll $(UCASE) library" ;
165		$(UCASE)LIB = ../$(libname)/lib$(lcase).lib ;
166		$(UCASE)INC = ../$(libname) ;
167	}
168}
169
170# See if we have a system TIFF, JPEG, PNG or ZLIB library.
171# Note this generates: $(TIFFLIB) $(TIFFINC) $(JPEGLIB) $(JPEGINC) $(PNGLIB)
172# $(PNGINC) $(ZLIBLIB) $(ZINC)
173# !!!!! Add to makepackagebin.sh -sBUILTIN_XXX=true !!!!!
174CheckForLibrary "TIFF" ;
175CheckForLibrary "JPEG" ;
176CheckForLibrary "PNG" ;
177CheckForLibrary "Z" : "zlib" ;
178
179CheckForLibrary "SSL" : : "/openssl" ;
180# if OpenSSL not found:
181if $(SSLLIB) {
182	SSLINC = ../ccast/axTLS ;
183	SSLLIB = ../ccast/axTLS/libaxtls ;
184}
185
186# testing
187#DSTDIR = var ;
188#SRCDIR = .. ;
189