#
#		compilation de la fonderie, du crapulator
#		et de tout le crap...
#

COPT = -g -fpic -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses
LIBS = ../libfloatimg.a -ltiff -lpnglite -lm -lz -lcfitsio

OBJS = fifo.o sfx.o crapulator.o glitches.o metriques.o	\
	filterstack.o single.o

DEPS = 	../floatimg.h						\
	../libfloatimg.a					\
	fifo.h crapulator.h metriques.h glitches.h sfx.h	\
	filterstack.h crapdef.h crapstr.h single.h

all:	fonderie interpolator singlepass t

# ---------------------------------------------------------

t:	t.c Makefile ${OBJS}
	gcc ${COPT} $< ${OBJS} ${LIBS}   -o $@

# ---------------------------------------------------------
#
#	the three main programms
#

fonderie:	fonderie.c ${DEPS} ${OBJS} Makefile
	gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@

#	another way to brotch some pics...
interpolator:	interpolator.c ${DEPS} ${OBJS} Makefile
	gcc ${COPT} $< ${OBJS}  ${LIBS} -lz -o $@

singlepass:	singlepass.c ${DEPS} ${OBJS} Makefile
	gcc ${COPT} $< ${OBJS}  ${LIBS} -lz -o $@

# ---------------------------------------------------------
#
#	some files are magically generated, sorry.
#
crapdef.h:	crapulors.liste Makefile craplist2h.awk
	./craplist2h.awk   < $< | tee $@

crapstr.h:	crapulors.liste Makefile craplist2str.awk
	./craplist2str.awk < $< | tee $@

# ---------------------------------------------------------
#
#	a lot of silly functions
#
crapulator.o:	crapulator.c ${DEPS} Makefile
	gcc ${COPT} -c $<

fifo.o:	fifo.c fifo.h Makefile
	gcc ${COPT} -c $<

sfx.o:	sfx.c ${DEPS} Makefile
	gcc ${COPT} -c $<

single.o:	single.c ${DEPS} Makefile
	gcc ${COPT} -c $<

filterstack.o:	filterstack.c ${DEPS} Makefile
	gcc ${COPT} -c $<

metriques.o:	metriques.c metriques.h Makefile
	gcc ${COPT} -c $<

glitches.o:	glitches.c glitches.h Makefile
	gcc ${COPT} -c $<

# ---------------------------------------------------------