#
#  File        : Makefile
#                ( Makefile for GNU 'gmake' utility )
#
#  Description : Makefile for compiling CImg-based code on Unix.
#                This file is a part of the CImg Library project.
#                ( http://cimg.sourceforge.net )
#
#  Copyright   : David Tschumperle
#                ( http://tschumperle.users.greyc.fr/ )
#
#  License     : CeCILL v2.0
#                ( http://www.cecill.info/licences/Licence_CeCILL_V2-en.html )
#
#  This software is governed by the CeCILL  license under French law and
#  abiding by the rules of distribution of free software.  You can  use,
#  modify and/ or redistribute the software under the terms of the CeCILL
#  license as circulated by CEA, CNRS and INRIA at the following URL
#  "http://www.cecill.info".
#
#  As a counterpart to the access to the source code and  rights to copy,
#  modify and redistribute granted by the license, users are provided only
#  with a limited warranty  and the software's author,  the holder of the
#  economic rights,  and the successive licensors  have only  limited
#  liability.
#
#  In this respect, the user's attention is drawn to the risks associated
#  with loading,  using,  modifying and/or developing or reproducing the
#  software by the user in light of its specific status of free software,
#  that may mean  that it is complicated to manipulate,  and  that  also
#  therefore means  that it is reserved for developers  and  experienced
#  professionals having in-depth computer knowledge. Users are therefore
#  encouraged to load and test the software's suitability as regards their
#  requirements in conditions enabling the security of their systems and/or
#  data to be ensured and,  more generally, to use and operate it in the
#  same conditions as regards security.
#
#  The fact that you are presently reading this means that you have had
#  knowledge of the CeCILL license and that you accept its terms.
#

#-------------------------------------------------------
# Define the list of files to be compiled
# (name of the source files without the .cpp extension)
#-------------------------------------------------------

# Files which do not necessarily require external libraries to run.
CIMG_FILES = CImg_demo \
	     captcha \
             curve_editor2d \
	     dtmri_view3d \
	     edge_explorer2d \
	     fade_images \
	     gaussian_fit1d \
             generate_loop_macros \
	     hough_transform2d \
	     image_registration2d \
	     image2ascii \
	     image_surface3d \
	     jawbreaker \
	     mcf_levelsets2d \
	     mcf_levelsets3d \
	     odykill \
	     pde_heatflow2d \
	     pde_TschumperleDeriche2d \
	     plotter1d \
	     radon_transform2d \
	     scene3d \
	     spherical_function3d \
	     tetris \
	     tron \
	     tutorial \
	     wavelet_atrous \
	     use_draw_gradient \
	     use_nlmeans \
	     use_skeleton \
	     use_RGBclass \

# Files which requires external libraries to run.
CIMG_EXTRA_FILES = use_jpeg_buffer \
                   gmic_gimp \
                   gmic

#---------------------------------
# Set correct variables and paths
#---------------------------------
CIMG_VERSION = 1.5.2
#X11PATH      = /usr/X11R6
CC           = $(CXX)
EXEPFX       =
CCVER       = $(CC)
ifeq ($(CC),g++)
CCVER        = `$(CC) -v 2>&1 | tail -n 1`
endif
ifeq ($(CC),clang++)
CCVER        = `$(CC) -v 2>&1 | head -n 1`
endif
ifeq ($(CC),icc)
CCVER        = "icc \( `$(CC) -v 2>&1`\)"
CFLAGS       = -I..
LDFLAGS      =
else
CFLAGS       = -I.. -Wall -W
LDFLAGS      = -lm
endif

#--------------------------------------------------
# Set compilation flags allowing to customize CImg
#--------------------------------------------------

# Flags to enable strict code standards
ifeq ($(CC),icc)
CIMG_ANSI_CFLAGS = -ansi
else
CIMG_ANSI_CFLAGS = -ansi -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing
endif

# Flags to enable code debugging.
CIMG_DEBUG_CFLAGS = -Dcimg_verbosity=3 -Dcimg_strict_warnings -g

# Flags to enable color output messages.
# (requires a VT100 compatible terminal)
CIMG_VT100_CFLAGS = -Dcimg_use_vt100

# Flags to enable code optimization by the compiler.
ifeq ($(CC),icc)
CIMG_OPT_CFLAGS = -O3 -ipo -no-prec-div
else
CIMG_OPT_CFLAGS = -fno-tree-pre
endif

# Flags to enable OpenMP support.
ifeq ($(CC),icc)
CIMG_OPENMP_CFLAGS = -Dcimg_use_openmp -openmp -i-static
else
CIMG_OPENMP_CFLAGS = -Dcimg_use_openmp -fopenmp
endif

# Flags to enable OpenCV support.
CIMG_OPENCV_CFLAGS = -Dcimg_use_opencv -I$(LOCALBASE)/include/opencv
CIMG_OPENCV_LDFLAGS = -lcv -lhighgui

# Flags used to disable display capablities of CImg
CIMG_NODISPLAY_CFLAGS = -Dcimg_display=0

# Flags to enable the use of the X11 library.
# (X11 is used by CImg to handle display windows)
# !!! For 64bits systems : replace -L$(X11PATH)/lib by -L$(X11PATH)/lib64 !!!
CIMG_X11_CFLAGS = -I$(X11PATH)/include
CIMG_X11_LDFLAGS = -L$(X11PATH)/lib -lX11 $(PTHREAD_LIBS)

# Flags to enable fast image display, using the XSHM library (when using X11).
# !!! Seems to randomly crash when used on MacOSX and 64bits systems, so use it only when necessary !!!
CIMG_XSHM_CFLAGS = # -Dcimg_use_xshm
CIMG_XSHM_LDFLAGS = # -lXext

# Flags to enable GDI32 display (Windows native).
CIMG_GDI32_CFLAGS = -mwindows
CIMG_GDI32_LDFLAGS = -lgdi32

# Flags to enable screen mode switching, using the XRandr library (when using X11).
# ( http://www.x.org/wiki/Projects/XRandR )
# !!! Not supported by the X11 server on MacOSX, so do not use it on MacOSX !!!
CIMG_XRANDR_CFLAGS = -Dcimg_use_xrandr
CIMG_XRANDR_LDFLAGS = -lXrandr

# Flags to enable native support for PNG image files, using the PNG library.
# ( http://www.libpng.org/ )
CIMG_PNG_CFLAGS = -Dcimg_use_png
CIMG_PNG_LDFLAGS = -lpng -lz

# Flags to enable native support for JPEG image files, using the JPEG library.
# ( http://www.ijg.org/ )
CIMG_JPEG_CFLAGS = -Dcimg_use_jpeg
CIMG_JPEG_LDFLAGS = -ljpeg

# Flags to enable native support for TIFF image files, using the TIFF library.
# ( http://www.libtiff.org/ )
CIMG_TIFF_CFLAGS = -Dcimg_use_tiff
CIMG_TIFF_LDFLAGS = -ltiff

# Flags to enable native support for MINC2 image files, using the MINC2 library.
# ( http://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_Users_Guide )
CIMG_MINC2_CFLAGS = -Dcimg_use_minc2 -I${HOME}/local/include
CIMG_MINC2_LDFLAGS = -lminc_io -lvolume_io2 -lminc2 -lnetcdf -lhdf5 -lz -L${HOME}/local/lib

# Flags to enable native support for EXR image files, using the OpenEXR library.
# ( http://www.openexr.com/ )
CIMG_EXR_CFLAGS = -Dcimg_use_openexr -I/$(LOCALBASE)/include/OpenEXR
CIMG_EXR_LDFLAGS = -lIlmImf -lHalf

# Flags to enable native support for various video files, using the FFMPEG library.
# ( http://www.ffmpeg.org/ )
CIMG_FFMPEG_CFLAGS = -Dcimg_use_ffmpeg -D__STDC_CONSTANT_MACROS -I/$(LOCALBASE)/include/libavcodec -I/$(LOCALBASE)/include/libavformat -I/$(LOCALBASE)/include/libswscale -I/$(LOCALBASE)/include/ffmpeg
CIMG_FFMPEG_LDFLAGS = -lavcodec -lavformat -lswscale

# Flags to enable native support for compressed .cimgz files, using the Zlib library.
# ( http://www.zlib.net/ )
CIMG_ZLIB_CFLAGS = -Dcimg_use_zlib
CIMG_ZLIB_LDFLAGS = -lz

# Flags to enable native support of most classical image file formats, using the Magick++ library.
# ( http://www.imagemagick.org/Magick++/ )
CIMG_MAGICK_CFLAGS = -Dcimg_use_magick `GraphicsMagick++-config --cppflags` `GraphicsMagick++-config --cxxflags`
CIMG_MAGICK_LDFLAGS = `GraphicsMagick++-config --ldflags` `GraphicsMagick++-config --libs`

# Flags to enable faster Discrete Fourier Transform computation, using the FFTW3 library
# ( http://www.fftw.org/ )
CIMG_FFTW3_CFLAGS = -Dcimg_use_fftw3
ifeq ($(MSYSTEM),MINGW32)
CIMG_FFTW3_LDFLAGS = -lfftw3-3
else
CIMG_FFTW3_LDFLAGS = -lfftw3
endif

# Flags to enable the use of LAPACK routines for matrix computation
# ( http://www.netlib.org/lapack/ )
CIMG_LAPACK_CFLAGS = -Dcimg_use_lapack
CIMG_LAPACK_LDFLAGS = -L/usr/local/lib -llapack -lblas

# Flags to enable the use of the Board library
# ( http://libboard.sourceforge.net/ )
CIMG_BOARD_CFLAGS = -Dcimg_use_board -I$(LOCALBASE)/include/board
CIMG_BOARD_LDFLAGS = -lboard

# Flags to compile on FreeBSD
CIMG_FREEBSD_LDFLAGS = -ansi -ffast-math  -I$(X11PATH)/include $(EXTRA_FLAGS) -lX11 -L$(X11PATH)/lib

# Flags to compile on Sun Solaris
CIMG_SOLARIS_LDFLAGS = -R$(X11PATH)/lib -lrt -lnsl -lsocket

# Flags to compile GIMP plug-ins.
ifeq ($(MSYSTEM),MINGW32)
CIMG_GIMP_CFLAGS = -mwindows
endif

#-------------------------
# Define Makefile entries
#-------------------------
.cpp:
	@echo
	@echo "** Compiling '$* ($(CIMG_VERSION))' with '$(CCVER)'"
	@echo
	$(CC) -o $(EXEPFX)$* $< $(CFLAGS) $(LDFLAGS) $(CONF_CFLAGS) $(CONF_LDFLAGS)
ifeq ($(STRIP_EXE),true)
ifeq ($(MSYSTEM),MINGW32)
	strip $(EXEPFX)$*.exe
else
	strip $(EXEPFX)$*
endif
endif
menu:
	@echo
	@echo "CImg Library $(CIMG_VERSION) : Examples"
	@echo "-----------------------------"
	@echo "  > linux    : Linux/BSD target, X11 display, optimizations disabled."
	@echo "  > dlinux   : Linux/BSD target, X11 display, debug mode."
	@echo "  > olinux   : Linux/BSD target, X11 display, optimizations enabled."
	@echo "  > mlinux   : Linus/BSD target, no display, minimal features, optimizations enabled."
	@echo "  > Mlinux   : Linux/BSD target, X11 display, maximal features, optimizations enabled."
	@echo
	@echo "  > dFreeBSD   : FreeBSD, X11 display, debug mode."
	@echo "  > oFreeBSD   : FreeBSD target, X11 display, maximal features for packages."
	@echo
	@echo "  > solaris  : Sun Solaris target, X11 display, optimizations disabled."
	@echo "  > dsolaris : Sun Solaris target, X11 display, debug mode."
	@echo "  > osolaris : Sun Solaris target, X11 display, optimizations enabled."
	@echo "  > msolaris : Sun Solaris target, no display, minimal features, optimizations enabled."
	@echo "  > Msolaris : Sun Solaris target, X11 display, maximal features, optimizations enabled."
	@echo
	@echo "  > macosx   : MacOSX target, X11 display, optimizations disabled."
	@echo "  > dmacosx  : MacOSX target, X11 display, debug mode."
	@echo "  > omacosx  : MacOSX target, X11 display, optimizations enabled."
	@echo "  > mmacosx  : MacOSX target, no display, minimal features, optimizations enabled."
	@echo "  > Mmacosx  : MacOSX target, X11 display, maximal features, optimizations enabled."
	@echo
	@echo "  > windows  : Windows target, GDI32 display, optimizations disabled."
	@echo "  > dwindows : Windows target, GDI32 display, debug mode."
	@echo "  > owindows : Windows target, GDI32 display, optimizations enabled."
	@echo "  > mwindows : Windows target, no display, minimal features, optimizations enabled."
	@echo "  > Mwindows : Windows target, GDI32 display, maximal features, optimizations enabled."
	@echo
	@echo "  > clean    : Clean generated files."
	@echo
	@echo "Choose your option :"
	@read CHOICE; echo; $(MAKE) $$CHOICE; echo; echo "> Next time, you can bypass the menu by typing directly 'gmake $$CHOICE'"; echo;

all: $(CIMG_FILES)

clean:
	rm -rf *.exe *.o *~ \#* $(CIMG_FILES) $(CIMG_EXTRA_FILES)
ifneq ($(EXEPFX),)
	rm -f $(EXEPFX)*
endif

# Specific targets for the 'gmic_gimp' plug-in for GIMP.
gmic_gimp.o: gmic.cpp gmic_def.h
	$(CC) -o gmic_gimp.o -c gmic.cpp -Dcimg_build -Dgmic_gimp -Dgmic_minimal $(CIMG_OPT_CFLAGS) $(CIMG_FFTW3_CFLAGS) $(CIMG_PNG_CFLAGS)

gmic_gimp: gmic_gimp.o gmic_gimp.cpp
	$(CC) -o $(EXEPFX)gmic_gimp gmic_gimp.cpp gmic_gimp.o -Dcimg_build `gimptool-2.0 --cflags` `gimptool-2.0 --libs` $(CIMG_OPT_FLAGS) $(CIMG_FFTW3_LDFLAGS) $(CIMG_PNG_LDFLAGS) $(CIMG_GIMP_CFLAGS) $(PTHREAD_LIBS)

# Specific targets for 'gmic'.
gmic_def: gmic_def.gmic
	cd ../../gmic/src && $(MAKE) def

gmic_bool.o: gmic.cpp
	@echo
	@echo "** Compiling 'gmic ($(CIMG_VERSION))' with '$(CCVER)'"
	@echo
	$(CC) -o gmic_bool.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_bool $(CFLAGS) $(CONF_CFLAGS)
gmic_uchar.o: gmic.cpp
	$(CC) -o gmic_uchar.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_uchar $(CFLAGS) $(CONF_CFLAGS)
gmic_char.o: gmic.cpp
	$(CC) -o gmic_char.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_char $(CFLAGS) $(CONF_CFLAGS)
gmic_ushort.o: gmic.cpp
	$(CC) -o gmic_ushort.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_ushort $(CFLAGS) $(CONF_CFLAGS)
gmic_short.o: gmic.cpp
	$(CC) -o gmic_short.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_short $(CFLAGS) $(CONF_CFLAGS)
gmic_uint.o: gmic.cpp
	$(CC) -o gmic_uint.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_uint $(CFLAGS) $(CONF_CFLAGS)
gmic_int.o: gmic.cpp
	$(CC) -o gmic_int.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_int $(CFLAGS) $(CONF_CFLAGS)
gmic_float.o: gmic.cpp
	$(CC) -o gmic_float.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_float $(CFLAGS) $(CONF_CFLAGS)
gmic_double.o: gmic.cpp
	$(CC) -o gmic_double.o -c gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_double $(CFLAGS) $(CONF_CFLAGS)

gmic: gmic_bool.o gmic_uchar.o gmic_char.o gmic_ushort.o gmic_short.o gmic_uint.o gmic_int.o gmic_float.o gmic_double.o gmic.cpp gmic_def.h
	$(CC) -o $(EXEPFX)gmic gmic.cpp -I. -Dcimg_build -Dgmic_separate_compilation -Dgmic_main \
		 gmic_bool.o gmic_uchar.o gmic_char.o gmic_ushort.o gmic_short.o \
		 gmic_uint.o gmic_int.o gmic_float.o gmic_double.o $(CFLAGS) $(LDFLAGS) $(CONF_CFLAGS) $(CONF_LDFLAGS)

gmic_minimal:
	$(CC) -o $(EXEPFX)gmic gmic.cpp -I.. -Dcimg_build -Dgmic_minimal -Dgmic_main -Dcimg_use_fftw3 -Dcimg_use_png -Dcimg_display=1 -I$(LOCALBASE)/X11R6/include -g -W -Wall -ansi -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -L$(LOCALBASE)/X11R6/lib -lX11 -lfftw3 -lpng -lz $(PTHREAD_LIBS)

ifeq ($(STRIP_EXE),true)
	strip $(EXEPFX)gmic
endif

# Linux/BSD/Mac OSX targets, with X11 display.
linux:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS)" \
all

dlinux:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_DEBUG_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS)" \
all

olinux:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS)" \
"STRIP_EXE=true" \
all

mlinux:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_NODISPLAY_CFLAGS) \
$(CIMG_OPT_CFLAGS)" \
"STRIP_EXE=true" \
all

Mlinux:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS) \
$(CIMG_XRANDR_CFLAGS) \
$(CIMG_TIFF_CFLAGS) \
$(CIMG_MINC2_CFLAGS) \
$(CIMG_EXR_CFLAGS) \
$(CIMG_PNG_CFLAGS) \
$(CIMG_JPEG_CFLAGS) \
$(CIMG_ZLIB_CFLAGS) \
$(CIMG_OPENCV_CFLAGS) \
$(CIMG_MAGICK_CFLAGS) \
$(CIMG_FFTW3_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS) \
$(CIMG_XRANDR_LDFLAGS) \
$(CIMG_TIFF_LDFLAGS) \
$(CIMG_MINC2_LDFLAGS) \
$(CIMG_EXR_LDFLAGS) \
$(CIMG_PNG_LDFLAGS) \
$(CIMG_JPEG_LDFLAGS) \
$(CIMG_ZLIB_LDFLAGS) \
$(CIMG_OPENCV_LDFLAGS) \
$(CIMG_MAGICK_LDFLAGS) \
$(CIMG_FFTW3_LDFLAGS)" \
"STRIP_EXE=true" \
all $(CIMG_EXTRA_FILES)

# FreeBSD targets
dFreeBSD:
	gmake \
"CONF_CFLAGS = \
$(CIMG_DEBUG_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS) \
$(CIMG_XRANDR_CFLAGS) \
$(CIMG_ZLIB_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_FREEBSD_LDFLAGS) \
$(CIMG_ZLIB_LDFLAGS) \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS) \
$(CIMG_XRANDR_LDFLAGS)" \
all

oFreeBSD:
	gmake \
"CONF_CFLAGS = \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS) \
$(CIMG_XRANDR_CFLAGS) \
$(CIMG_TIFF_CFLAGS) \
$(CIMG_PNG_CFLAGS) \
$(CIMG_JPEG_CFLAGS) \
$(CIMG_ZLIB_CFLAGS) \
$(CIMG_MAGICK_CFLAGS) \
$(CIMG_FFMPEG_CFLAGS) \
$(CIMG_LAPACK_CFLAGS) \
$(CIMG_FFTW3_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_FREEBSD_LDFLAGS) \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS) \
$(CIMG_XRANDR_LDFLAGS) \
$(CIMG_TIFF_LDFLAGS) \
$(CIMG_PNG_LDFLAGS) \
$(CIMG_JPEG_LDFLAGS) \
$(CIMG_ZLIB_LDFLAGS) \
$(CIMG_MAGICK_LDFLAGS) \
$(CIMG_FFMPEG_LDFLAGS) \
$(CIMG_LAPACK_LDFLAGS) \
$(CIMG_FFTW3_LDFLAGS)" \
"STRIP_EXE=true" \
all use_jpeg_buffer gmic

# Sun Solaris targets, with X11 display.
solaris:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_SOLARIS_LDFLAGS) \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS)" \
all

dsolaris:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_DEBUG_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_SOLARIS_LDFLAGS) \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS)" \
all

osolaris:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_SOLARIS_LDFLAGS) \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS)" \
"STRIP_EXE=true" \
all

msolaris:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_NODISPLAY_CFLAGS) \
$(CIMG_OPT_CFLAGS)" \
"STRIP_EXE=true" \
all

Msolaris:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_XSHM_CFLAGS) \
$(CIMG_XRANDR_CFLAGS) \
$(CIMG_TIFF_CFLAGS) \
$(CIMG_MINC2_CFLAGS) \
$(CIMG_EXR_CFLAGS) \
$(CIMG_PNG_CFLAGS) \
$(CIMG_JPEG_CFLAGS) \
$(CIMG_ZLIB_CFLAGS) \
$(CIMG_OPENCV_CFLAGS) \
$(CIMG_MAGICK_CFLAGS) \
$(CIMG_FFTW3_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_SOLARIS_LDFLAGS) \
$(CIMG_X11_LDFLAGS) \
$(CIMG_XSHM_LDFLAGS) \
$(CIMG_XRANDR_LDFLAGS) \
$(CIMG_TIFF_LDFLAGS) \
$(CIMG_MINC2_LDFLAGS) \
$(CIMG_EXR_LDFLAGS) \
$(CIMG_PNG_LDFLAGS) \
$(CIMG_JPEG_LDFLAGS) \
$(CIMG_ZLIB_LDFLAGS) \
$(CIMG_OPENCV_LDFLAGS) \
$(CIMG_MAGICK_LDFLAGS) \
$(CIMG_FFTW3_LDFLAGS)" \
"STRIP_EXE=true" \
all $(CIMG_EXTRA_FILES)

# MacOsX targets, with X11 display.
macosx:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS)" \
all

dmacosx:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_DEBUG_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS)" \
all

omacosx:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS)" \
all

mmacosx:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_ANSI_CFLAGS) \
$(CIMG_NODISPLAY_CFLAGS) \
$(CIMG_OPT_CFLAGS)" \
all

Mmacosx:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_OPT_CFLAGS) \
$(CIMG_VT100_CFLAGS) \
$(CIMG_X11_CFLAGS) \
$(CIMG_TIFF_CFLAGS) \
$(CIMG_MINC2_CFLAGS) \
$(CIMG_EXR_CFLAGS) \
$(CIMG_PNG_CFLAGS) \
$(CIMG_JPEG_CFLAGS) \
$(CIMG_ZLIB_CFLAGS) \
$(CIMG_OPENCV_CFLAGS) \
$(CIMG_MAGICK_CFLAGS) \
$(CIMG_FFTW3_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_X11_LDFLAGS) \
$(CIMG_TIFF_LDFLAGS) \
$(CIMG_MINC2_LDFLAGS) \
$(CIMG_EXR_LDFLAGS) \
$(CIMG_PNG_LDFLAGS) \
$(CIMG_JPEG_LDFLAGS) \
$(CIMG_ZLIB_LDFLAGS) \
$(CIMG_OPENCV_LDFLAGS) \
$(CIMG_MAGICK_LDFLAGS) \
$(CIMG_FFTW3_LDFLAGS)" \
all $(CIMG_EXTRA_FILES)

# Windows targets, with GDI32 display.
windows:
	@$(MAKE) \
"CONF_CFLAGS = " \
"CONF_LDFLAGS = \
$(CIMG_GDI32_LDFLAGS)" \
all

dwindows:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_DEBUG_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_GDI32_LDFLAGS)" \
all

owindows:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_OPT_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_GDI32_LDFLAGS)" \
"STRIP_EXE=true" \
all

mwindows:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_NODISPLAY_CFLAGS) \
$(CIMG_OPT_CFLAGS)" \
"STRIP_EXE=true" \
all

Mwindows:
	@$(MAKE) \
"CONF_CFLAGS = \
$(CIMG_OPT_CFLAGS) \
$(CIMG_TIFF_CFLAGS) \
$(CIMG_PNG_CFLAGS) \
$(CIMG_JPEG_CFLAGS) \
$(CIMG_ZLIB_CFLAGS) \
$(CIMG_OPENCV_CFLAGS) \
$(CIMG_FFTW3_CFLAGS)" \
"CONF_LDFLAGS = \
$(CIMG_GDI32_LDFLAGS) \
$(CIMG_TIFF_LDFLAGS) \
$(CIMG_PNG_LDFLAGS) \
$(CIMG_JPEG_LDFLAGS) \
$(CIMG_ZLIB_LDFLAGS) \
$(CIMG_OPENCV_LDFLAGS) \
$(CIMG_FFTW3_LDFLAGS)" \
"STRIP_EXE=true" \
all $(CIMG_EXTRA_FILES)

#-----------------
# End of gmakefile
#-----------------
