X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/719b9402a049d5c9c63b370c3eb1cdc53e163a6d..99826b0efd53ab95c9416fbb0b3d08abfbb12724:/util/imake.includes/Imake.rules diff --git a/util/imake.includes/Imake.rules b/util/imake.includes/Imake.rules index 75b1f915..3bff17ff 100644 --- a/util/imake.includes/Imake.rules +++ b/util/imake.includes/Imake.rules @@ -1,17 +1,17 @@ /**/# $Source$ -/**/# $Author$ -/**/# $Header$ /**/# #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 @@ -20,6 +20,29 @@ * Rule for building objects in libraries. */ +#if defined(mips) || defined(_AIX) || defined(SOLARIS) +/* + * The MIPS, AIX & SOLARIS loaders don't have the -X flag or its functionality. + * Solaris to make it worse does not have -x + */ +#if !defined(SOLARIS) +#define library_obj_rule() @@\ +.c.o: @@\ + $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\ + $(MV) $*.o profiled/$*.o @@\ + $(CC) -c $(CFLAGS) $*.c @@\ + -$(LD) -x -r -o a.out $*.o @@\ + $(MV) a.out $*.o +#else +#define library_obj_rule() @@\ +.c.o: @@\ + $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\ + $(MV) $*.o profiled/$*.o @@\ + $(CC) -c $(CFLAGS) $*.c @@\ + -$(LD) -r -o a.out $*.o @@\ + $(MV) a.out $*.o +#endif +#else /* ! mips && ! _AIX */ #define library_obj_rule() @@\ .c.o: @@\ $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\ @@ -27,7 +50,7 @@ $(CC) -c $(CFLAGS) $*.c @@\ -$(LD) -x -r -o a.out $*.o @@\ $(MV) a.out $*.o - +#endif /* mips */ /* * cc -R breaks profiling with -p on 4.3BSD on the VAX * (and probably elsewhere), so we don't do it for the profiled version. @@ -50,23 +73,38 @@ ofile: sfile @@\ -$(LD) -x -r -o $*.o a.out @@\ $(RM) a.out x.c +#ifdef USELINT +#define install_library_lint(libname) @@\ +all:: concat3(llib-l,libname,.ln) @@\ + @@\ +install:: @@\ + $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\ + +#else +#define install_library_lint(libname) +#endif + + #define install_library_target(libname,objs,srcs,lintlibs) @@\ @@\ all:: concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\ -all:: concat3(llib-l,libname,.ln) @@\ @@\ concat3(lib,libname,.a): objs @@\ + $(RM) $@.bak @@\ + -$(MV) $@ $@.bak @@\ $(ARCHIVE) $@ objs @@\ $(RANLIB) $@ @@\ @@\ concat3(lib,libname,_p.a): objs @@\ + $(RM) $@.bak @@\ + -$(MV) $@ $@.bak @@\ cd profiled; $(ARCHIVE) ../$@ objs @@\ $(RANLIB) $@ @@\ @@\ lint:: concat3(llib-l,libname,.ln) @@\ @@\ concat3(llib-l,libname,.ln): srcs @@\ - $(LINT) concat(-C,libname) $(LINTFLAGS) srcs lintlibs @@\ + $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\ @@\ clean:: @@\ $(RM) concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\ @@ -75,24 +113,32 @@ clean:: @@\ $(RM) profiled/?*.o @@\ @@\ install:: @@\ - $(INSTALLRAW) -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\ + $(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) @@\ - $(INSTALLRAW) -m 644 concat3(lib,libname,_p.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\ + $(INSTALLRAW) -c -m 644 concat3(lib,libname,_p.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\ $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\ $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\ - $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\ + @@\ +install_library_lint(libname) @@\ #else /* !PROFILED_LIBS */ /* * Rule for building objects in libraries. */ +#ifdef DEBUG_LIBS +/* When debugging, leave symbols alone (don't do LD) */ +#define library_obj_rule() @@\ +.c.o: @@\ + $(CC) -c $(CFLAGS) $*.c +#else #define library_obj_rule() @@\ .c.o: @@\ $(CC) -c $(CFLAGS) $*.c @@\ -$(LD) -x -r -o a.out $*.o @@\ $(MV) a.out $*.o +#endif #define library_ro_object(cfile) @@\ concat(cfile,.o): concat(cfile,.c) @@\ @@ -106,19 +152,31 @@ ofile: sfile @@\ -$(LD) -x -r -o $*.o a.out @@\ $(RM) a.out x.c +#ifdef USELINT +#define install_library_lint(libname) @@\ +all:: concat3(llib-l,libname,.ln) @@\ + @@\ +install:: @@\ + $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\ + +#else +#define install_library_lint(libname) +#endif + #define install_library_target(libname,objs,srcs,lintlibs) @@\ @@\ all:: concat3(lib,libname,.a) @@\ -all:: concat3(llib-l,libname,.ln) @@\ @@\ concat3(lib,libname,.a): objs @@\ + $(RM) $@.bak @@\ + -$(MV) $@ $@.bak @@\ $(ARCHIVE) $@ objs @@\ $(RANLIB) $@ @@\ @@\ lint:: concat3(llib-l,libname,.ln) @@\ @@\ concat3(llib-l,libname,.ln): srcs @@\ - $(LINT) concat(-C,libname) $(LINTFLAGS) srcs lintlibs @@\ + $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\ @@\ clean:: @@\ $(RM) concat3(lib,libname,.a) @@\ @@ -126,10 +184,12 @@ clean:: @@\ $(RM) objs @@\ @@\ install:: @@\ - $(INSTALLRAW) -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\ + $(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) @@\ - $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBBDIR)/,llib-l,libname,.ln) @@\ + @@\ +install_library_lint(libname) @@\ + #endif /* PROFILED_LIBS */ @@ -140,7 +200,7 @@ install:: @@\ all:: pgm @@\ @@\ pgm: objs localdeps @@\ - $(CC) $(CFLAGS) -o $@ objs localdeps syslibs @@\ + $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\ @@\ clean:: @@\ $(RM) pgm objs @@\ @@ -152,7 +212,7 @@ clean:: @@\ #define generate(file,pgm,libs) @@\ @@\ pgm: concat(pgm,.c) libs @@\ - $(HCC) $(HCFLAGS) -o $@ $@.c libs @@\ + $(HCC) $(HCFLAGS) -o $@ $@.c libs $(OSLIBS) @@\ @@\ file: pgm @@\ ./pgm file @@\ @@ -170,12 +230,12 @@ depend:: file * Rule for building test programs (something which is not installed) */ -#define test(pgm,locallibs,syslibs) @@\ +#define test_program(pgm,locallibs,syslibs) @@\ @@\ all:: pgm @@\ @@\ pgm: concat(pgm,.c) locallibs @@\ - $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs @@\ + $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs $(OSLIBS) @@\ @@\ clean:: @@\ $(RM) pgm concat(pgm,.o) @@\ @@ -184,25 +244,11 @@ clean:: @@\ * Rule for compileing files with "et" */ -#ifdef PROFILED_LIBS -#define comp_et_prof(tbl) @@\ -concat(tbl,.h) concat(tbl,.o): concat(tbl,.et) @@\ - $(COMPILE_ET) concat(tbl,.et) -n @@\ - $(CC) -c PROF_FLAG concat(tbl,.et.c) @@\ - $(MV) concat(tbl,.et.o) concat3(profiled/,tbl,.o) @@\ - $(COMPILE_ET) concat(tbl,.et) @@\ -clean:: @@\ - $(RM) concat(src,.o) concat(src,.h) @@\ -depend:: concat(src,.h) -#else /* !PROFILED_LIBS */ -#define comp_et_prof(tbl) comp_et(tbl) -#endif /* PROFILED_LIBS */ - #define comp_et(tbl) @@\ -concat(tbl,.h) concat(tbl,.o): concat(tbl,.et) @@\ +concat(tbl,.h) concat(tbl,.c): concat(tbl,.et) @@\ $(COMPILE_ET) concat(tbl,.et) @@\ clean:: @@\ - $(RM) concat(src,.o) concat(src,.h) + $(RM) concat(tbl,.c) concat(tbl,.h) #define comp_et_depend(src) @@\ comp_et(src) @@\ @@ -275,7 +321,7 @@ clean:: @@\ all:: pgm @@\ @@\ pgm: localdeps objs @@\ - $(CC) $(CFLAGS) -o $@ objs syslibs @@\ + $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\ @@\ install:: @@\ $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm @@\ @@ -283,22 +329,6 @@ install:: @@\ clean:: @@\ $(RM) pgm objs @@\ -/* - * Rule for building a program which is to be installed setuid root: - */ - -#define suidprogram(pgm,objs,localdeps,syslibs,installdir) @@\ -all:: pgm @@\ - @@\ -pgm: objs localdeps @@\ - $(CC) $(CFLAGS) -o $@ objs syslibs @@\ - @@\ -install:: @@\ - $(INSTALLSUID) pgm ${DESTDIR}installdir/pgm @@\ - @@\ -clean:: @@\ - $(RM) pgm objs @@\ - /* * Rule for building a specially installed program */ @@ -307,7 +337,7 @@ clean:: @@\ all:: pgm @@\ @@\ pgm: objs localdeps @@\ - $(CC) $(CFLAGS) -o $@ objs syslibs @@\ + $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\ @@\ install:: @@\ $(INSTALLRAW) instopts pgm ${DESTDIR}installdir/pgm @@\ @@ -332,7 +362,7 @@ install:: page @@\ #define depend_target() @@\ depend:: $(SRCS) @@\ @echo "### Now computing dependencies" @@\ - @$(DEPEND) -s "# DO NOT DELETE" $(CFLAGS) $(SRCS) @@\ + @$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) @@\ #define clean_target() @@\ clean:: @@\ @@ -396,4 +426,53 @@ Makefiles:: @@\ done +/* Compile Embeded SQL source */ +#ifdef INGRES +#define sqlrule() @@\ +.SUFFIXES: .sc .dc @@\ +.dc.sc: @@\ + $(AWK) -f $(SRCTOP)/util/imake.includes/ingres.awk < $< > $*.sc @@\ + @@\ +.sc.c: @@\ + /usr/ingres/bin/esqlc -p $* +#define sqlfile(file) @@\ +concat(file,.sc): concat(file,.dc) @@\ +concat(file,.c): concat(file,.sc) @@\ +clean:: @@\ + $(RM) concat(file,.sc) concat(file,.c) +#endif +#ifdef INFORMIX +#define sqlrule() @@\ +.SUFFIXES: .ec .dc @@\ +.dc.ec: @@\ + $(AWK) -f $(SRCTOP)/util/imake.includes/informix.awk < $< > $*.ec @@\ + @@\ +.ec.c: @@\ + /usr/informix/bin/esql -e $*.ec +#define sqlfile(file) @@\ +concat(file,.ec): concat(file,.dc) @@\ +concat(file,.c): concat(file,.ec) @@\ +clean:: @@\ + $(RM) concat(file,.ec) concat(file,.c) +#endif +#ifdef ORACLE +/* have to undef these to keep the ORADEFS line from being attacked */ +#undef HESIOD +#undef ZEPHYR +#undef GDSS +#undef ATHENA +ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA +#define sqlrule() @@\ +.SUFFIXES: .pc .dc @@\ +.dc.pc: @@\ + $(AWK) -f $(SRCTOP)/util/imake.includes/oracle.awk < $< > $*.pc @@\ + @@\ +.pc.c: @@\ + /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS) +#define sqlfile(file) @@\ +concat(file,.pc): concat(file,.dc) @@\ +concat(file,.c): concat(file,.pc) @@\ +clean:: @@\ + $(RM) concat(file,.pc) concat(file,.c) +#endif