SHELL	= /bin/sh
SRCS	= postconf.c
OBJS	= postconf.o
HDRS	= 
TESTSRC	= 
DEFS	= -I. -I$(INC_DIR) -D$(SYSTYPE)
CFLAGS	= $(DEBUG) $(OPT) $(DEFS)
TESTPROG= 
MAKES	= bool_table.h bool_vars.h int_table.h int_vars.h str_table.h \
	str_vars.h time_table.h time_vars.h raw_table.h raw_vars.h \
	nint_table.h nint_vars.h nbool_table.h nbool_vars.h
AUTOS	= auto_table.h auto_vars.h
DUMMIES	= makes_dummy autos_dummy # for "make -j"
PROG	= postconf
SAMPLES	= ../../conf/main.cf.default
INC_DIR	= ../../include
LIBS	= ../../lib/libxsasl.a ../../lib/libglobal.a ../../lib/libutil.a

.c.o:;	$(CC) $(CFLAGS) -c $*.c

$(PROG): $(OBJS) $(LIBS)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)

../../conf/main.cf.default: $(PROG) Makefile
	rm -f $@
	(echo "# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE"; \
	 echo "# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX."; \
	 echo "#"; \
	 ./$(PROG) -d) |egrep -v '^(myhostname|mydomain|mynetworks) ' >$@

$(OBJS): ../../conf/makedefs.out

Makefile: Makefile.in
	cat ../../conf/makedefs.out $? >$@

test:	$(TESTPROG)

tests:

root_tests:

update: ../../bin/$(PROG) $(SAMPLES)

../../bin/$(PROG): $(PROG)
	cp $(PROG) ../../bin

$(MAKES): makes_dummy

makes_dummy: $(INC_DIR)/mail_params.h ../global/mail_params.c
	$(AWK) -f extract.awk ../*/*.c | $(SHELL)
	touch makes_dummy

$(AUTOS): autos_dummy

autos_dummy: auto.awk
	$(AWK) -f auto.awk
	touch autos_dummy

printfck: $(OBJS) $(PROG)
	rm -rf printfck
	mkdir printfck
	cp *.h printfck
	sed '1,/^# do not edit/!d' Makefile >printfck/Makefile
	set -e; for i in *.c; do printfck -f .printfck $$i >printfck/$$i; done
	cd printfck; make "INC_DIR=../../../include" `cd ..; ls *.o`

lint:
	lint $(DEFS) $(SRCS) $(LINTFIX)

clean:
	rm -f *.o *core $(PROG) $(TESTPROG) junk $(MAKES) $(AUTOS) $(DUMMIES)
	rm -rf printfck

tidy:	clean

depend: $(MAKES)
	(sed '1,/^# do not edit/!d' Makefile.in; \
	set -e; for i in [a-z][a-z0-9]*.c; do \
	    $(CC) -E $(DEFS) $(INCL) $$i | grep -v '[<>]' | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \
	    -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' \
	    -e 's/o: \.\//o: /' -e p -e '}' ; \
	done | sort -u) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile.in
	@$(EXPORT) make -f Makefile.in Makefile 1>&2

# do not edit below this line - it is generated by 'make depend'
postconf.o: ../../include/argv.h
postconf.o: ../../include/attr.h
postconf.o: ../../include/dict.h
postconf.o: ../../include/edit_file.h
postconf.o: ../../include/get_hostname.h
postconf.o: ../../include/htable.h
postconf.o: ../../include/inet_proto.h
postconf.o: ../../include/iostuff.h
postconf.o: ../../include/mail_addr.h
postconf.o: ../../include/mail_conf.h
postconf.o: ../../include/mail_dict.h
postconf.o: ../../include/mail_params.h
postconf.o: ../../include/mail_proto.h
postconf.o: ../../include/mail_run.h
postconf.o: ../../include/mail_version.h
postconf.o: ../../include/mbox_conf.h
postconf.o: ../../include/msg.h
postconf.o: ../../include/msg_vstream.h
postconf.o: ../../include/myflock.h
postconf.o: ../../include/mymalloc.h
postconf.o: ../../include/mynetworks.h
postconf.o: ../../include/safe.h
postconf.o: ../../include/split_at.h
postconf.o: ../../include/stringops.h
postconf.o: ../../include/sys_defs.h
postconf.o: ../../include/vbuf.h
postconf.o: ../../include/vstream.h
postconf.o: ../../include/vstring.h
postconf.o: ../../include/vstring_vstream.h
postconf.o: ../../include/xsasl.h
postconf.o: auto_table.h
postconf.o: auto_vars.h
postconf.o: bool_table.h
postconf.o: bool_vars.h
postconf.o: install_table.h
postconf.o: install_vars.h
postconf.o: int_table.h
postconf.o: int_vars.h
postconf.o: nbool_table.h
postconf.o: nbool_vars.h
postconf.o: nint_table.h
postconf.o: nint_vars.h
postconf.o: postconf.c
postconf.o: raw_table.h
postconf.o: raw_vars.h
postconf.o: str_table.h
postconf.o: str_vars.h
postconf.o: time_table.h
postconf.o: time_vars.h
