SHELL	= /bin/sh
SRCS	= postconf.c
OBJS	= postconf.o
HDRS	= 
TESTSRC	= 
WARN	= -W -Wformat -Wimplicit -Wmissing-prototypes \
	-Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
	-Wunused
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
PROG	= postconf
SAMPLES	= ../../conf/main.cf.default
INC_DIR	= ../../include
LIBS	= ../../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) ' >$@

Makefile: Makefile.in
	(set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@

test:	$(TESTPROG)

tests:	test

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

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

$(MAKES): $(INC_DIR)/mail_params.h ../global/mail_params.c
	$(AWK) -f extract.awk ../*/*.c

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)
	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 | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \
	    -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' -e 'p' -e '}'; \
	done) | 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: postconf.c
postconf.o: ../../include/sys_defs.h
postconf.o: ../../include/msg.h
postconf.o: ../../include/vstream.h
postconf.o: ../../include/vbuf.h
postconf.o: ../../include/msg_vstream.h
postconf.o: ../../include/get_hostname.h
postconf.o: ../../include/stringops.h
postconf.o: ../../include/vstring.h
postconf.o: ../../include/htable.h
postconf.o: ../../include/dict.h
postconf.o: ../../include/argv.h
postconf.o: ../../include/safe.h
postconf.o: ../../include/mymalloc.h
postconf.o: ../../include/split_at.h
postconf.o: ../../include/vstring_vstream.h
postconf.o: ../../include/myflock.h
postconf.o: ../../include/mynetworks.h
postconf.o: ../../include/mail_conf.h
postconf.o: ../../include/mail_dict.h
postconf.o: ../../include/mail_proto.h
postconf.o: ../../include/iostuff.h
postconf.o: ../../include/attr.h
postconf.o: ../../include/mail_version.h
postconf.o: ../../include/mail_params.h
postconf.o: ../../include/mail_addr.h
postconf.o: ../../include/mbox_conf.h
postconf.o: time_vars.h
postconf.o: bool_vars.h
postconf.o: int_vars.h
postconf.o: str_vars.h
postconf.o: raw_vars.h
postconf.o: smtp_vars.h
postconf.o: install_vars.h
postconf.o: time_table.h
postconf.o: bool_table.h
postconf.o: int_table.h
postconf.o: str_table.h
postconf.o: smtp_table.h
postconf.o: install_table.h
postconf.o: raw_table.h
