

#PREF_CCFLAGS 	+= $(CCOPTFLAG) ;		# Turn optimisation on
PREF_CCFLAGS    += $(CCDEBUGFLAG) ;		# Debugging flags
PREF_LINKFLAGS	+= $(LINKDEBUGFLAG) ;

# Setup the right hardware access libraries
if $(NT) {
	IOFILE = ntio.c ;
	LIBUSB = ../libusbw ;
}
if $(UNIX) {
	IOFILE = unixio.c ;
	CONVFILE = pollem.c ;
	LIBUSB = ../libusb ;
}

#Products
Libraries = libinsttypes libinst libdisp libconv ;
Executables = dispwin synthcal dispread dispcal fakeread synthread
              chartread spotread spec2cie average spyd2en ;
Headers = inst.h ;
Samples = ColorChecker.ti2 ECI2002R.ti2 FograStrip.ti2 i1_RGB_Scan_1.4.ti2
          SOtele.sp strange.cal ;

#Install
InstallBin ../bin : $(Executables) ;
InstallFile ../ref : $(Samples) ;
#InstallFile ../h : $(Headers) ;
#InstallLib ../lib : $(Libraries) ;

if $(UNIX) && $(OS) != MACOSX {
	# Micro Unix CMM for handling monitor profile association
	CMMHDRS = ../ucmm ;
	CMMLIBS = ../ucmm/libucmm ../jcnf/libjcnf ../jcnf/yajl/libyajl ;
}

HDRS = ../h ../numlib ../icc ../cgats ../rspl ../xicc ../gamut ../spectro
       ../plot $(LIBUSB) $(CMMHDRS) ;

# Instrument access library library
Library libinst : inst.c insttypes.c dtp20.c dtp22.c dtp41.c dtp51.c dtp92.c i1disp.c i1pro.c i1pro_imp.c munki.c munki_imp.c ss.c ss_imp.c hcfr.c spyd2.c huey.c $(IOFILE) usbio.c hidio.c ;

# Display access library 
Library libdisp : dispsup.c dispwin.c : : : $(LibWinH) ;

# Instrument types utility functions library. Use this instead of libinst */
# (Note we're working around a bug in Jam caused by objects shared between libraries)
Object insttypes2 : insttypes.c ;
LibraryFromObjects libinsttypes : insttypes2 ;

# System utility functions (keyboard, msec_*, thread)
Library libconv : conv.c $(CONVFILE) : : : $(LibWinH) ;

# Support file
#Object alphix : ../target/alphix.c ;

LINKLIBS = libinst $(LIBUSB)/libusb
           ../xicc/libxcolorants ../xicc/libxicc
           ../gamut/libgamut
           ../rspl/librspl ../cgats/libcgats
           ../icc/libicc ../plot/libplot ../plot/libvrml ../numlib/libnum
           $(CMMLIBS) ;

# General target reader program
Main chartread : chartread.c ../target/alphix.c : : : ../target : : libdisp libconv ;

# Printed target spot reader utility
Main spotread : spotread.c : : : : : libdisp libconv ;

# Gretag Spectroscan/T filmstrip reader
#Main filmread : filmread.c : : : : : libdisp ;

# Create synthetic .cal
Main synthcal : synthcal.c ;

# Display calibration program
Main dispcal : dispcal.c : : : ../target : : libdisp libconv ;

# Display tester program
Main dispread : dispread.c : : : : : libdisp libconv ;

#display test window test/Lut loader utility
# [ Could avoid need for libisnt libusb etc.
#   by separating system dependent utils to a separate library .] 
MainVariant dispwin : dispwin.c : : STANDALONE_TEST : : : $(LibWin) libconv ;

LINKLIBS = libinsttypes ../xicc/libxicc ../gamut/libgamut ../rspl/librspl
           ../cgats/libcgats ../icc/libicc ../numlib/libnum ../plot/libplot
           ../plot/libvrml ;

# Fake device print/read utility using ICC profile
Main fakeread : fakeread.c ;

# Synthetic device print/read utility
Main synthread : synthread.c ;

# Add CIE values to a spectral reading file
Main spec2cie : spec2cie.c ;

# Average RGB or CMYK .ti3 files
Main average : average.c ;

# Utility to enable the Spyder 2 instrument */
Main spyd2en : spyd2en.c vinflate.c ;

# Generate strange.cal example/diagnostic
GenFileND strange.cal : synthcal -s 0.7,1.0,0.9 -p 1.7,0.8,0.7 [ NormPaths strange ] ;
NDepends exe : strange.cal ;	# Normally create it 

# Dumy ti3 file generator for testing
#Main dumyti3 : dumyti3.c ;

# Test utility for XYZ matrix spectral correction
#Main xyzfix : xyzfix.c ;

# fp conversion code test
#Main fp : fp.c ;

# test code
#Main t : t.c ;
#Main tt : tt.c ;

if $(OLD_GRETAG) && $(UNIX) && $(OS) != MACOSX {

	# test for parsing a VISE archive
	Main visetest : visetest.c vinflate.c ;

	# Compute deconvolution filter for i1pro
	#Main i1deconv : i1deconv.c ;

	# Compute stray light calibration for i1pro
	#Main i1stray : i1stray.c ;
}

