#!/bin/make -f # @(#)src/Makefile 1.22 9/20/92 17:13:22 # Makefile for the smail program # # Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll # Copyright (C) 1992 Ronald S. Karr # # See the file COPYING, distributed with smail, for restriction # and warranty information. SHELL=/bin/sh MAKE=make GET=sccs get AR=ar LINT=lint CLEAN=sccs clean MK=${MAKE} -${MAKEFLAGS} SHELL=${SHELL} SRC_PREFIX= MKDEPEND=${ROOT}/conf/lib/mkdepend.sh MKVERSION=${ROOT}/conf/lib/mkversion.sh MKDEFS=${ROOT}/conf/lib/mkdefs.sh MKDIRS=${ROOT}/conf/lib/mkdirs.sh CHECKDEFS=${ROOT}/conf/lib/checkdefs.sh INST=${ROOT}/conf/lib/inst.sh INSTM=${ROOT}/conf/lib/instm.sh XEXEC=${SHELL} ${ROOT}/conf/lib/xexec.sh DEFS_SH=defs.sh DEFS_H=defs.h DEFS_SED=defs.sed VERSION_SH=version.sh VERSION_H=version.h VERSION_SED=version.sed ROOT=.. INCLUDES=$$DBM_INCLUDES $$INCLUDES CSRC=addr.c alloc.c ascii.c bindlib.c config.c copyright.c default.c direct.c \ expand.c field.c hash.c header.c log.c lookup.c main.c modes.c notify.c \ parse.c pathto.c pwcache.c qualify.c queue.c resolve.c retry.c route.c \ smailconf.c smtprecv.c spool.c string.c sysdep.c transport.c verify.c \ version.c LASTSRC=silly.c HSRC=addr.h alloc.h bindlib.h bindsmtpth.h child.h config.h debug.h direct.h \ dys.h error.h exitcodes.h extern.h field.h hash.h jump.h lookup.h log.h \ main.h parse.h route.h smail.h smailconf.h spool.h transport.h MISCSRC=Makefile mkdriv.awk COPYING SHSRC=mkdrivtab.sh bump_cnt.sh SRC=${CSRC} ${HSRC} ${SHSRC} ${MISCSRC} ${LASTSRC} FIRSTOBJ=copyright.o OBJ=addr.o alloc.o ascii.o bindlib.o config.o default.o direct.o drivertab.o \ expand.o field.o hash.o header.o log.o lookup.o main.o modes.o notify.o \ parse.o pathto.o pwcache.o qualify.o queue.o resolve.o retry.o route.o \ smailconf.o smtprecv.o spool.o string.o sysdep.o transport.o verify.o \ version.o LASTOBJ=silly.o STANDOBJ=stand_hash.o stand_silly.o STAND=testfield stand_field.c stand_field.o \ testaddr stand_addr.c stand_addr.o DRIVLIBS=directors/ddrivlib.a routers/rdrivlib.a transports/tdrivlib.a DIRECTORS_HSRC=aliasfile.h fwdfile.h include.h smartuser.h user.h DIRECTORS_CSRC=aliasfile.c fwdfile.c include.c smartuser.c user.c DIRECTORS_SRC=${DIRECTORS_HSRC} ${DIRECTORS_CSRC} ROUTERS_HSRC=bind.h rtlib.h gethost.h pathalias.h smarthost.h uuname.h \ queryprog.h reroute.h ROUTERS_CSRC=bind.c rtlib.c gethost.c pathalias.c smarthost.c uuname.c \ queryprog.c reroute.c ROUTERS_SRC=${ROUTERS_HSRC} ${ROUTERS_CSRC} TRANSPORTS_HSRC=appendfile.h pipe.h tcpsmtp.h smtplib.h TRANSPORTS_CSRC=appendfile.c pipe.c tcpsmtp.c smtplib.c TRANSPORTS_SRC=${TRANSPORTS_HSRC} ${TRANSPORTS_CSRC} COMPAT_LIB_DIR=${ROOT}/compat COMPAT_LIB=${COMPAT_LIB_DIR}/compat.a # Smail will be copied to BIN_DIR with links for all of these names BIN_NAMES=smail mailq pathto uupath runq rsmtp smtpd .c.o: @. ./${DEFS_SH}; ${XEXEC} $$CC $$CFLAGS ${INCLUDES} -c $*.c all: ddrivlib rdrivlib tdrivlib smail smail: ${DEFS_SH} ${FIRSTOBJ} ${OBJ} ${DRIVLIBS} ${LASTOBJ} \ ${COMPAT_LIB} bump_cnt.sh @. ./${DEFS_SH}; ${XEXEC} ${SHELL} bump_cnt.sh @. ./${DEFS_SH}; ${XEXEC} $$CC $$CFLAGS ${INCLUDES} -c ldinfo.c @. ./${DEFS_SH}; ${XEXEC} $$CC $$CFLAGS $$LDFLAGS -o smail \ ${FIRSTOBJ} ${OBJ} ${DRIVLIBS} ${LASTOBJ} \ ${COMPAT_LIB} $$DBM_LIB $$LIBS ldinfo.o ${FIRSTOBJ} ${OBJ} ${LASTOBJ}: ${DEFS_SH} ${COMPAT_LIB}: cd ${COMPAT_LIB_DIR}; ${MK} lint: drivertab.c ${CSRC} ${DEFS_SH} @. ./${DEFS_SH}; \ files="drivertab.c ${CSRC}"; \ echo "Get C files under ${SRC_PREFIX}directors ..."; \ for i in `(cd directors; ${MK} csrc)`; do \ files="$$files directors/$$i"; \ done; \ echo "Get C files under ${SRC_PREFIX}routers ..."; \ for i in `(cd routers; ${MK} csrc)`; do \ files="$$files routers/$$i"; \ done; \ echo "Get C files under ${SRC_PREFIX}transports ..."; \ for i in `(cd transports; ${MK} csrc)`; do \ files="$$files transports/$$i"; \ done; \ ${XEXEC} ${LINT} ${LINTFLAGS} $$files ${SRC}: ${GET} $@ sources: ${SRC} @echo "Get sources under ${SRC_PREFIX}directors ..." -@cd directors; for i in ${DIRECTORS_SRC}; do \ if [ ! -f $$i ]; then \ ${XEXEC} ${GET} $$i; ${GET} $$i; \ fi; \ done @echo "Get sources under ${SRC_PREFIX}routers ..." -@cd routers; for i in ${ROUTERS_SRC}; do \ if [ ! -f $$i ]; then \ ${XEXEC} ${GET} $$i; ${GET} $$i; \ fi; \ done @echo "Get sources under ${SRC_PREFIX}transports ..." -@cd transports; for i in ${TRANSPORTS_SRC}; do \ if [ ! -f $$i ]; then \ ${XEXEC} ${GET} $$i; ${GET} $$i; \ fi; \ done ${DEFS_H} ${DEFS_SH} ${DEFS_SED}: ROOT=${ROOT} ${SHELL} ${MKDEFS} ${VERSION_H} ${VERSION_SH} ${VERSION_SED}: ROOT=${ROOT} ${SHELL} ${MKVERSION} names: @for i in ${SRC}; do echo ${SRC_PREFIX}$$i; done @for i in ${DIRECTORS_SRC}; do echo ${SRC_PREFIX}directors/$$i; done @for i in ${ROUTERS_SRC}; do echo ${SRC_PREFIX}routers/$$i; done @for i in ${TRANSPORTS_SRC}; do echo ${SRC_PREFIX}transports/$$i; done ddrivlib: ${HSRC} ${DEFS_H} directors/ddrivlib.a ddrivlib: directors/Makefile @echo "Build targets under ${SRC_PREFIX}directors ..." @cd directors; ${MK} rdrivlib: ${HSRC} ${DEFS_H} routers/rdrivlib.a rdrivlib: routers/Makefile @echo "Build targets under ${SRC_PREFIX}routers ..." @cd routers; ${MK} tdrivlib: ${HSRC} ${DEFS_H} transports/tdrivlib.a tdrivlib: transports/Makefile @echo "Build targets under ${SRC_PREFIX}transports ..." @cd transports; ${MK} drivertab.c directors/Makefile transports/Makefile routers/Makefile: \ mkdrivtab.sh mkdriv.awk ${DEFS_SH} @. ./${DEFS_SH}; \ ${XEXEC} ${SHELL} mkdrivtab.sh $$DRIVER_CONFIGURATION @for i in directors routers transports; do \ echo "Building dependencies under ${SRC_PREFIX}$$i ..."; \ (cd $$i; ${MK} SRC_PREFIX=${SRC_PREFIX}$$i/ depend); \ done iobpeek.h: ${DEFS_SH} @rm -f iobpeek.h . ./${DEFS_SH}; ${XEXEC} sh -x geniobpeek.sh $$CC "$$CFLAGS" depend: ${SRC} check_defs subdir_depend local_depend subdir_depend: remove_driver_makefiles \ directors/Makefile routers/Makefile transports/Makefile local_depend: ${VERSION_H} @. ./${DEFS_SH}; ${XEXEC} ${SHELL} ${MKDEPEND} $$CPPFLAGS ${INCLUDES} \ Makefile ${CSRC} . ./${DEFS_SH}; echo "$$DEFS_DEPEND" >> Makefile; \ echo "drivertab.c: $$DRIVER_CONFIGURATION" >> Makefile; \ echo "directors/Makefile: $$DRIVER_CONFIGURATION" >> Makefile; \ echo "routers/Makefile: $$DRIVER_CONFIGURATION" >> Makefile; \ echo "transports/Makefile: $$DRIVER_CONFIGURATION" >> Makefile; \ check_defs: SHELL=${SHELL} ROOT=${ROOT} ${SHELL} ${CHECKDEFS} remove_driver_makefiles: rm -f directors/Makefile routers/Makefile transports/Makefile clean: rm -f ${DEFS_SH} ${DEFS_H} ${DEFS_SED} rm -f ${VERSION_SH} ${VERSION_H} ${VERSION_SED} rm -f ${FIRSTOBJ} ${OBJ} ${LASTOBJ} ${STANDOBJ} core ldinfo.o -@for i in directors routers transports; do \ if [ -f $$i/Makefile ]; then \ echo "Clean under ${SRC_PREFIX}$$i ..."; \ (cd $$i; ${MK} SRC_PREFIX=${SRC_PREFIX}$$i/ clean); \ else \ echo "Ignoring ${SRC_PREFIX}$$i -- no Makefile"; \ fi; \ done clobber: rm -f ${DEFS_SH} ${DEFS_H} ${DEFS_SED} rm -f ${VERSION_SH} ${VERSION_H} ${VERSION_SED} rm -f ${FIRSTOBJ} ${OBJ} ${LASTOBJ} ${STANDOBJ} core ldinfo.o rm -f smail ${STAND} rm -f drivertab.c rm -f .${DEFS_SH} .${DEFS_H} .${DEFS_SED} .Makefile .drivertab.c -@for i in directors routers transports; do \ if [ -f $$i/Makefile ]; then \ echo "Clobber under ${SRC_PREFIX}$$i ..."; \ (cd $$i; ${MK} SRC_PREFIX=${SRC_PREFIX}$$i/ clobber); \ else \ echo "Ignoring ${SRC_PREFIX}$$i -- no Makefile"; \ fi; \ done nuke: rm -f ${DEFS_SH} ${DEFS_H} ${DEFS_SED} rm -f ${VERSION_SH} ${VERSION_H} ${VERSION_SED} rm -f ${FIRSTOBJ} ${OBJ} ${LASTOBJ} core ldinfo.o rm -f smail ${STAND} rm -f drivertab.c rm -f .${DEFS_SH} .${DEFS_H} .${DEFS_SED} .Makefile -${CLEAN} -${GET} Makefile -@for i in directors routers transports; do \ if [ -f $$i/Makefile ]; then \ echo "Nuke under ${SRC_PREFIX}$$i ..."; \ (cd $$i; ${MK} SRC_PREFIX=${SRC_PREFIX}$$i/ nuke); \ else \ echo "No Makefile -- nuke ${SRC_PREFIX}$$i from above ..."; \ (cd $$i; ${CLEAN}); \ fi; \ done install: ${DEFS_SH} all install-dirs install-bins install-libs install-bins: @. ./${DEFS_SH} ;\ case "$$DONT_INSTALL" in \ ?*) echo Testing ... install-bins ignored; exit 0;; \ esac; \ l_flag=; \ case "$$USE_SYMLINKS" in \ ?*) l_flag=-l;; \ esac; \ s_flag=; \ case "$$STRIP" in \ ?*) s_flag=-s;; \ esac; \ ${XEXEC} ${SHELL} ${INST} $$s_flag $$l_flag -u root -g operator \ -m 6755 -d $$SMAIL_BIN_DIR \ smail ${BIN_NAMES} $$NEWALIASES \ $$OTHER_SMAIL_NAMES install-libs: @. ./${DEFS_SH}; \ case "$$DONT_INSTALL" in \ ?*) echo Testing ... install-libs ignored; exit 0;; \ esac; \ ${XEXEC} ${SHELL} ${INSTM} -r $$LIB_DIR COPYING install-dirs: @. ./${DEFS_SH}; \ case "$$DONT_INSTALL" in \ ?*) echo Testing ... install-dirs ignored; exit 0;; \ esac; \ ${XEXEC} ${SHELL} ${MKDIRS} $$LIB_DIR $$LIB_DIR/methods \ $$SMAIL_BIN_DIR # build standalone versions to test various subsystems # # NOTE: these are not checked on a regular basis and are thus not # guarranteed to be compilable. Some of these rules also leave # object files which are not suitable for loading into the final # smail binary and thus must be removed. # # stand_silly.o is loaded as the last module to overcome some # gdb problems on one of our testing machines TESTFIELD_OBJ=stand_field.o string.o alloc.o qualify.o addr.o \ ascii.o smailconf.o config.o parse.o version.o testfield: $(TESTFIELD_OBJ) @. ./${DEFS_SH}; ${XEXEC} $$CC $$CFLAGS $$LDFLAGS ${INCLUDES} \ -DSTANDALONE -o testfield $(TESTFIELD_OBJ) stand_field.o: field.c field.h defs.h cp field.c stand_field.c @. ./${DEFS_SH}; ${XEXEC} $$CC $$CFLAGS ${INCLUDES} -DSTANDALONE \ -c stand_field.c TESTADDR_OBJ=stand_addr.o string.o alloc.o ascii.o config.o testaddr: $(TESTADDR_OBJ) @. ./${DEFS_SH}; ${XEXEC} $$CC $$LDFLAGS $$CFLAGS ${INCLUDES} \ -DSTANDALONE -o testaddr $(TESTADDR_OBJ) stand_addr.o: addr.c addr.h defs.h cp addr.c stand_addr.c @. ./${DEFS_SH}; ${XEXEC} $$CC $$CFLAGS ${INCLUDES} -DSTANDALONE \ -c stand_addr.c # special dependencies: version.o: version.h smtprecv.o: iobpeek.h # DO NOT REMOVE THIS LINE, OR "make depend" WILL NOT WORK # Miscellaneous dependencies addr.o: ../conf/lib/arch.h addr.c addr.h defs.h dys.h exitcodes.h smail.h alloc.o: ../conf/lib/arch.h alloc.c alloc.h defs.h exitcodes.h log.h smail.h ascii.o: ../conf/lib/arch.h ascii.c defs.h bindlib.o: ../conf/lib/arch.h addr.h bindlib.c bindlib.h bindsmtpth.h defs.h bindlib.o: dys.h lookup.h route.h smail.h transport.h config.o: ../conf/lib/arch.h config.c config.h defs.h smail.h copyright.o: copyright.c default.o: ../conf/lib/arch.h config.h default.c defs.h direct.h default.o: directors/aliasfile.h directors/fwdfile.h directors/include.h default.o: directors/smartuser.h directors/user.h route.h routers/gethost.h default.o: routers/pathalias.h routers/reroute.h routers/smarthost.h default.o: routers/uuname.h smail.h transport.h transports/../bindlib.h default.o: transports/appendfile.h transports/pipe.h transports/smtplib.h default.o: transports/tcpsmtp.h direct.o: ../conf/lib/arch.h addr.h defs.h direct.c direct.h dys.h exitcodes.h direct.o: log.h main.h smail.h smailconf.h transport.h expand.o: ../conf/lib/arch.h addr.h alloc.h defs.h direct.h dys.h exitcodes.h expand.o: expand.c log.h lookup.h route.h smail.h transport.h field.o: ../conf/lib/arch.h addr.h defs.h dys.h exitcodes.h field.c field.h field.o: log.h smail.h hash.o: ../conf/lib/arch.h alloc.h defs.h exitcodes.h hash.c hash.h smail.h header.o: ../conf/lib/arch.h addr.h defs.h dys.h exitcodes.h field.h header.c header.o: log.h main.h smail.h spool.h transport.h log.o: ../conf/lib/arch.h addr.h defs.h dys.h exitcodes.h log.c log.h main.h log.o: smail.h spool.h lookup.o: ../conf/lib/arch.h defs.h dys.h exitcodes.h lookup.c lookup.h lookup.o: smail.h main.o: ../conf/lib/arch.h addr.h alloc.h child.h config.h defs.h dys.h main.o: exitcodes.h hash.h log.h main.c main.h smail.h smailconf.h transport.h modes.o: ../conf/lib/arch.h addr.h alloc.h child.h defs.h dys.h exitcodes.h modes.o: hash.h log.h main.h modes.c smail.h transport.h notify.o: ../conf/lib/arch.h addr.h child.h defs.h direct.h dys.h exitcodes.h notify.o: hash.h log.h main.h notify.c route.h smail.h transport.h parse.o: ../conf/lib/arch.h defs.h dys.h exitcodes.h parse.c parse.h smail.h pathto.o: ../conf/lib/arch.h addr.h defs.h exitcodes.h main.h pathto.c smail.h pathto.o: transport.h pwcache.o: ../conf/lib/arch.h alloc.h defs.h hash.h pwcache.c smail.h qualify.o: ../conf/lib/arch.h defs.h dys.h parse.h qualify.c smail.h queue.o: ../conf/lib/arch.h addr.h defs.h dys.h exitcodes.h field.h log.h queue.o: main.h queue.c smail.h spool.h resolve.o: ../conf/lib/arch.h addr.h defs.h exitcodes.h hash.h log.h resolve.c resolve.o: route.h smail.h transport.h retry.o: ../conf/lib/arch.h addr.h defs.h dys.h jump.h log.h lookup.h parse.h retry.o: retry.c smail.h transport.h route.o: ../conf/lib/arch.h addr.h bindsmtpth.h defs.h dys.h exitcodes.h log.h route.o: parse.h route.c route.h smail.h smailconf.h transport.h smailconf.o: ../conf/lib/arch.h defs.h dys.h exitcodes.h main.h parse.h smailconf.o: smail.h smailconf.c smailconf.h smtprecv.o: ../conf/lib/arch.h addr.h defs.h dys.h hash.h iobpeek.h log.h smtprecv.o: main.h smail.h smtprecv.c spool.o: ../conf/lib/arch.h defs.h dys.h exitcodes.h log.h smail.h spool.c spool.o: spool.h transport.h string.o: ../conf/lib/arch.h defs.h dys.h smail.h string.c sysdep.o: ../conf/lib/arch.h child.h defs.h dys.h exitcodes.h log.h smail.h sysdep.o: sysdep.c transport.o: ../conf/lib/arch.h addr.h defs.h dys.h exitcodes.h log.h parse.h transport.o: smail.h smailconf.h spool.h transport.c transport.h verify.o: ../conf/lib/arch.h addr.h defs.h direct.h dys.h route.h smail.h verify.o: verify.c version.o: ../conf/lib/arch.h defs.h version.c version.h defs.sh defs.h defs.sed: ${ROOT}/conf/EDITME defs.sh defs.h defs.sed: ${ROOT}/conf/lib/arch.h defs.sh defs.h defs.sed: ${ROOT}/conf/lib/mkdefs.sh defs.sh defs.h defs.sed: ${ROOT}/conf/os/minixVM defs.sh defs.h defs.sed: ${ROOT}/conf/arch/32bit version.sh version.h version.sed: ${ROOT}/conf/lib/mkversion.sh version.sh version.h version.sed: ${ROOT}/level version.sh version.h version.sed: ${ROOT}/patchnum drivertab.c: ../conf/driver/arpa-network directors/Makefile: ../conf/driver/arpa-network routers/Makefile: ../conf/driver/arpa-network transports/Makefile: ../conf/driver/arpa-network