.PHONY: debug clean

# NOTE: the help files for C programs, although they are C code, do NOT have
# names in *.c, but rather in *.ci. This is because of Make's default rules:
# whenever a target depends on file f and there exists f.c, Make tries to
# compile f.c to make f. In our case we would have the (real) dependency
# f.help.c <- f.help, PLUS the (wrongly inferred) dependency f.help <- f.help.c,
# leading to a circular dependency graph.

C_HELPS  := $(addsuffix .ci, $(shell ls *.help | grep -v '\.pl'))
PL_HELPS := $(addsuffix .pl, $(wildcard *.pl.help))

all: $(C_HELPS) $(PL_HELPS)

%.help.ci: %.help
	./chipseq_help2c.pl < $< > $@

clean:
	$(RM) $(C_HELPS) $(PL_HELPS)

debug:
	@echo C help files: $(C_HELPS)
	@echo Perl help files: $(PL_HELPS)
