
# JAM style makefile for integer interpolation code, cctiff etc.

#PREF_CCFLAGS 	+= $(CCOPTFLAG) ;		# Turn optimisation on
PREF_CCFLAGS	    += $(CCDEBUGFLAG) ;		# Debugging flags
#PREF_CCFLAGS 	+= $(CCPROFFLAG) ;		# Profile flags
PREF_LINKFLAGS	+= $(LINKDEBUGFLAG) ;	# Link debugging flags
#PREF_LINKFLAGS	+= $(LINKPROFFLAG) ;    # Profile flags
#PREF_CCFLAGS	+= $(CCHEAPDEBUG) ;		# Heap Debugging flags

#Products
Libraries = libimdi ;
Executables = cctiff greytiff ;
Headers = imdi.h ;

#Install
InstallBin  $(DESTDIR)$(PREFIX)/bin : $(Executables) ;
#InstallFile $(DESTDIR)$(PREFIX)/h : $(Headers) ;
#InstallLib  $(DESTDIR)$(PREFIX)/lib : $(Libraries) ;

HDRS = ../h ;

# Hack! Make cross compile of MingW64 on 32 bit host work.
# (This doesn't work - 32 bit libraries are not provided :-()
#if $(NT) && $(MINGW64) {
#	ObjectCcFlags ctest imdi_make imdi_gen cgen : -m32 ;
#	MainLinkFlags ctest imdi_make : -m32 -L $(MINGW64_LIB32) ;
#}
if $(NT) && $(MINGW64) {
	IMDI_MAKE_OPT = -f ;	# Force 64 bits
}

# imdi low level cgen test code
Main ctest : ctest.c cgen.c ;

# make imdi code program
Main imdi_make : imdi_make.c imdi_gen.c cgen.c ;

HDRS = ../h ../numlib ;
LINKLIBS = ../numlib/libnum ;

# GenFile source.c : program args ;	make custom file
# Generate all the kernel files
GenFileND imdi_k.h : imdi_make $(IMDI_MAKE_OPT) -d [ NormPaths $(DOT) ] ;

# imdi library
Library libimdi : imdi.c imdi_tab.c ;

HDRS += ../icc ../rspl ../gamut ../cgats ../spectro ;
LINKLIBS = $(LINKLIBS) libimdi ../icc/libicc ../numlib/libnum ;

# imdi test code
Main itest : itest.c refi.c : : : ../rspl : : ../rspl/librspl ../plot/libplot
                                              ../plot/libvrml ../numlib/libui ;

# TIFF file color correction utlity
Main cctiff : cctiff.c : : : ../xicc $(TIFFINC) $(JPEGINC) : : ../xicc/libxicc ../rspl/librspl ../cgats/libcgats ../plot/libplot ../plot/libvrml ../numlib/libui $(TIFFLIB) $(JPEGLIB) ;

# Old TIFF file color correction utlity
#Main cctiffo : cctiffo.c : : : $(TIFFINC) : : $(TIFFLIB) ;

# TIFF file monochrome conversion utlity
#Main greytiff : greytiff.c ;
Main greytiff : greytiff.c : : : ../spectro ../xicc ../gamut ../rspl ../cgats $(TIFFINC)
              : : ../xicc/libxicc ../gamut/libgamut ../rspl/librspl ../cgats/libcgats
                  ../plot/libplot ../plot/libvrml ../numlib/libui $(TIFFLIB) $(JPEGLIB) ;

# ssort generation code
#Main ssort : ssort.c ;

#Main shsort : shsort.c ;

# code generated by shsort
#Main ttt : ttt.c ;

if $(BUILD_JUNK) {

	Main f2test : f2test.c : : : ../spectro ../xicc ../gamut ../rspl ../cgats $(TIFFINC)
              : : ../xicc/libxicc ../gamut/libgamut ../rspl/librspl ../cgats/libcgats
                  ../plot/libplot ../plot/libvrml $(TIFFLIB) $(JPEGLIB) ;


	CCFLAGS 	+= -msse3 ;

	Main tvec : tvec.c ;
	Main tvec2 : tvec2.c ;

	# test code
	Main tsort : tsort.c ;
}

