/**/# $Source$ /**/# #ifdef __STDC__ #define concat(x,y) x##y #define concat3(x,y,z) x##y##z #define concat4(w,x,y,z) w##x##y##z #define concat5(v,w,x,y,z) v##w##x##y##z #define requote(x) #x #else #define concat(x,y)x/**/y #define concat3(x,y,z)x/**/y/**/z #define concat4(w,x,y,z)w/**/x/**/y/**/z #define concat5(v,w,x,y,z)v/**/w/**/x/**/y/**/z #define requote(x) "x" #endif /* * Rule for building objects in libraries. */ #define library_obj_rule() @@\ .c.o: @@\ $(CC) -c $(CFLAGS) $*.c #define install_library_target(libname,objs,srcs) @@\ @@\ all:: concat3(lib,libname,.a) @@\ @@\ concat3(lib,libname,.a): objs @@\ $(RM) $@.bak @@\ -$(MV) $@ $@.bak @@\ $(ARCHIVE) $@ objs @@\ $(RANLIB) $@ @@\ @@\ clean:: @@\ $(RM) concat3(lib,libname,.a) @@\ $(RM) objs @@\ @@\ install:: @@\ $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\ $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\ $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) /* * Rule for building utilities (binaries which don't get installed) */ #define genutil(pgm,objs,localdeps,syslibs) @@\ all:: pgm @@\ @@\ pgm: objs localdeps @@\ $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\ @@\ clean:: @@\ $(RM) pgm objs @@\ /* * Rule for building test programs (something which is not installed) */ #define test_program(pgm,locallibs,syslibs) @@\ @@\ all:: pgm @@\ @@\ pgm: concat(pgm,.c) locallibs @@\ $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs $(OSLIBS) @@\ @@\ clean:: @@\ $(RM) pgm concat(pgm,.o) @@\ /* * Rule for compiling files with "et" */ #define comp_et(tbl) @@\ concat(tbl,.h) concat(tbl,.c): concat(tbl,.et) @@\ $(COMPILE_ET) concat(tbl,.et) @@\ clean:: @@\ $(RM) concat(tbl,.c) concat(tbl,.h) #define comp_et_depend(src) @@\ comp_et(src) @@\ @@\ depend:: concat(src,.h) /* * Rule for building a program which is to be installed: */ #define program(pgm,objs,localdeps,syslibs,installdir) @@\ all:: pgm @@\ @@\ pgm: localdeps objs @@\ $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\ @@\ install:: @@\ $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm @@\ @@\ clean:: @@\ $(RM) pgm objs @@\ /* * Rule for installing man pages. Section installing into should match * suffix, or the man page won't show up when using man(1). */ #define manpage(section,page) @@\ all:: @@\ install:: page @@\ $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\ /* * Rule for building makefile dependencies. */ #define depend_target() @@\ depend:: $(SRCS) @@\ @echo "### Now computing dependencies" @@\ @$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) @@\ #define clean_target() @@\ clean:: @@\ $(RM) *~ \#* *.bak $(TAGSFILE) #define makefile_target() @@\ Makefile:: @@\ -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak @@\ $(IMAKE) -DNEW_TOP=$(NEWTOP) -s Makefile @@\ #define foreach_subdirs(name,subdirs) @@\ name:: @@\ @for d in subdirs; \ @@\ do \ @@\ (cd $$d; echo "### Making" name "in" `pwd`; \ @@\ $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \ @@\ echo "### Done with" `pwd`); \ @@\ done #define do_subdirs_no_imakefile(subdirs) @@\ foreach_subdirs(all, subdirs) @@\ foreach_subdirs(install, subdirs) @@\ foreach_subdirs(clean, subdirs) @@\ foreach_subdirs(depend, subdirs) @@\ foreach_subdirs(src, subdirs) @@\ #define do_subdirs(subdirs) @@\ do_subdirs_no_imakefile(subdirs) @@\ @@\ Makefiles:: @@\ @echo "### Making Makefiles in" `pwd` @@\ @for d in subdirs; \ @@\ do \ @@\ (cd $$d; echo "### Making Makefile in" `pwd`; \ @@\ $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\ NEWTOP=../$(BUILDTOP) \ @@\ BUILDTOP=../$(BUILDTOP) \ @@\ -f ../Makefile \ @@\ Makefile; \ @@\ $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\ NEWTOP=../$(BUILDTOP) \ @@\ Makefiles; \ @@\ echo "### Done with" `pwd`); \ @@\ done /* Compile Embeded SQL source */ #ifdef ORACLE /* have to undef these to keep the ORADEFS line from being attacked by Imake */ #undef HESIOD #undef ZEPHYR #undef GDSS #undef ATHENA ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA #define sqlrule() @@\ .SUFFIXES: .pc @@\ .pc.c: @@\ /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS) $(ORAINCLUDES) #define sqlfile(file) @@\ concat(file,.c): concat(file,.pc) @@\ clean:: @@\ $(RM) concat(file,.c) #endif