#--------------------------------------------------------------------------------------
#
#  Makefile :             Makefile for compiling CImg examples on Unix
#
#  Author :               David Tschumperl
#
# -----------------------------------------------------------------------------------

# Set correct variables and paths
CC         = g++ -O4 -Wall -ansi -ffast-math
X11PATH    = /usr/X11R6
X11FLAGS   = -I$(X11PATH)/include -L$(X11PATH)/lib -lX11

# Compilation rules
.cpp:
	@echo -e "\n** Compiling '$*'\n"
	@$(CC) -o $* $< $(CFLAGS) $(X11FLAGS) $(LDFLAGS)
linux:
	make "LDFLAGS=-lm -lpthread -Wl,-rpath $(X11PATH)/lib" all
solaris:
	make "LDFLAGS=-lm -lpthread -R$(X11PATH)/lib -lrt -lnsl -lsocket" all
freebsd: linux

all: CImg_test \
     fade_images \
     inpainter \
     odykill \
     pslider \
     inrcast \
     image_registration \
     hough_transform \
     render3d \
     tutorial \
     tetris \
     pde_heatflow2D \
     pde_TschumperleDeriche2D

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