# Don't edit Makefile!  Use conf-* for configuration.
#
# Generated by spac see http://untroubled.org/spac/

SHELL=/bin/sh

DEFAULT: all

all: libraries programs installer instcheck instshow

clean: TARGETS
	rm -f `cat TARGETS`

clean-spac: clean AUTOFILES
	rm -f `cat AUTOFILES`

compile: conf-cc conf-bgincs
	( bgincs=`head -n 1 conf-bgincs`; \
	  echo '#!/bin/sh'; \
	  echo 'source=$$1; shift'; \
	  echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \
	  echo exec `head -n 1 conf-cc` -I. "-I'$${bgincs}'" '-o $${base}.o -c $$source $${1+"$$@"}'; \
	) >compile
	chmod 755 compile

conf_bin.c: conf-bin
	head -n 1 conf-bin | \
	  sed -e 's/"/\\"/g' \
	      -e 's/^/const char conf_bin[] = "/' \
	      -e 's/$$/";/' >conf_bin.c

conf_man.c: conf-man
	head -n 1 conf-man | \
	  sed -e 's/"/\\"/g' \
	      -e 's/^/const char conf_man[] = "/' \
	      -e 's/$$/";/' >conf_man.c

installer: load insthier.o
	./load insthier -lbg-installer
	mv insthier installer

instcheck: load insthier.o
	./load insthier -lbg-instcheck
	mv insthier instcheck

insthier.o: compile insthier.c conf_bin.c conf_man.c
	./compile insthier.c

instshow: load insthier.o
	./load insthier -lbg-instshow
	mv insthier instshow

libraries: 

load: conf-ld conf-bglibs
	( bglibs=`head -n 1 conf-bglibs`; \
	  echo '#!/bin/sh';\
	  echo 'main="$$1"; shift';\
	  echo exec `head -n 1 conf-ld` -L. "-L'$${bglibs}'" '-o "$$main" "$$main.o" $${1+"$$@"}' -lbg-sysdeps; \
	) >load
	chmod 755 load

programs: qmail-qfilter

qmail-qfilter: load qmail-qfilter.o
	./load qmail-qfilter   

qmail-qfilter.o: compile qmail-qfilter.c
	./compile qmail-qfilter.c

