##############################################
#
CC=gcc
CFLAGS=-Wall -O2
LDFLAGS=-lm -lz 
#LIB= -L../zlib-1.1.3
LIB= -Lzlib-1.1.3
#INCLUDE= -I../zlib-1.1.3
INCLUDE= -Izlib-1.1.3

##############################################
#
CSRC= cementinit.c cementi.c plm2pnm.c pnmutils.c
HDR= cement.h pnmutils.h

##############################################
#
all: cementinit cementi cemento plm2pnm

pnmutils.o: pnmutils.c
	$(CC) $(CFLAGS) $(INCLUDE) -c pnmutils.c

cementinit: Makefile cementinit.c pnmutils.o
	$(CC) $(CFLAGS) $(INCLUDE) $(LIB) pnmutils.o $@.c -o $@ $(LDFLAGS)

cementi: Makefile cementi.c pnmutils.o
	$(CC) $(CFLAGS) $(INCLUDE) $(LIB) pnmutils.o $@.c -o $@ $(LDFLAGS)

cemento: Makefile cementi.c
	$(CC) $(CFLAGS) $(INCLUDE) $(LIB) -DCEMENT_REMOVE pnmutils.o cementi.c -o $@ $(LDFLAGS)

plm2pnm: Makefile plm2pnm.c
	$(CC) $(CFLAGS) $(INCLUDE) $(LIB) pnmutils.o $@.c -o $@ $(LDFLAGS)


##############################################
#
run: cementinit cementi cemento
	./trowel.pl

#	./cementinit sv035.jpg.ppm.gz 1.0 1.0 1.0 -o total.plm.gz
#	./cementi total.plm.gz sv097.jpg.ppm.gz 0 1 0
#	./plm2pnm total.plm.gz -o total.ppm.gz
#	./cementinit 1.ppm 1.0 1.0 1.0 -o total.plm ;\
#	./cementi total.plm 1.ppm 1.0 1.0 1.0 ;\
#	./cementi total.plm 1.ppm 1.0 1.0 1.0 ;\

#	./cementi total.plm v003.ppm 1.0 1.0 1.0 ;\  # cement it in
#	./cemento total.plm v003.ppm 1.0 1.0 1.0 ;\  # take it out

clean:
	rm -f *.o core
	rm -f cementinit cementi cemento plm2pnm
	rm -f total.ppm total.plm

clobber: clean
	rm -f *~

depend:
	makedepend $(INCLUDE) $(CSRC) $(HDR)

tar: $(CSRC) Makefile $(HDR) trowel.pl
	tar -cvf cement.tar $(CSRC) $(HDR) Makefile trowel.pl cement.txt sv*gz


##############################################
#
# DO NOT DELETE BELOW THIS LINE

