#--------------------------------------------------------------------------------------
#
#  Makefile  :               Makefile for compiling CImg examples on Unix
#
#  Copyright :               David Tschumperle (http://www.greyc.ensicaen.fr/~dtschump/)
#
# -----------------------------------------------------------------------------------

# Set correct variables and paths
CC      = g++
X11PATH = /usr/X11R6
CFLAGS  = -Wall -ansi -pedantic -ffast-math -I$(X11PATH)/include

# Compilation rules
.cpp:
	@echo
	@echo "** Compiling '$*' with '`$(CC) -v 2>&1 | grep version`'"
	@echo
	$(CC) -o $* $< $(CFLAGS) $(LDFLAGS)
linux:
	make "LDFLAGS=-lm -lpthread -lX11 -L$(X11PATH)/lib" all
solaris:
	make "LDFLAGS=-lm -lpthread -lX11 -lrt -lnsl -lsocket -R$(X11PATH)/lib" all

all: CImg_test \
     fade_images \
     greycstoration \
     hough_transform \
     image_registration \
     image2ascii \
     inrcast \
     mcf_levelsets \
     odykill \
     pslider \
     pde_heatflow2D \
     pde_TschumperleDeriche2D \
     render3d \
     tetris \
     tutorial \
     wavelet_atrous

clean:
	rm -f *.exe *~ \
        CImg_test \
        fade_images \
        greycstoration \
        hough_transform \
        image_registration \
        image2ascii \
        inrcast \
        mcf_levelsets \
        odykill \
        pslider \
        pde_heatflow2D \
        pde_TschumperleDeriche2D \
        render3d \
        tetris \
        tutorial \
        wavelet_atrous
