]> andersk Git - moira.git/blobdiff - util/imake.includes/Imake.rules
Added support for DEBUG_LIBS so that when this is defined
[moira.git] / util / imake.includes / Imake.rules
index e315196a31f838a918df493bb4d0192e03742e63..da30aa774b3a78a3f26afbdcfe85f3bc72362308 100644 (file)
@@ -7,11 +7,13 @@
 #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
 
@@ -56,17 +58,21 @@ 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,10 +81,12 @@ clean::                                                             @@\
        $(RM) profiled/?*.o                                             @@\
                                                                        @@\
 install::                                                              @@\
-       $(INSTALLFILE) 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)       @@\
-       $(INSTALLFILE) concat3(lib,libname,_p.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
+       $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.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) @@\
 
 #else /* !PROFILED_LIBS */
@@ -86,11 +94,18 @@ install::                                                           @@\
  * 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)                                     @@\
@@ -110,13 +125,15 @@ 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)                                   @@\
@@ -124,9 +141,10 @@ clean::                                                            @@\
        $(RM) objs                                                      @@\
                                                                        @@\
 install::                                                              @@\
-       $(INSTALLFILE) 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)       @@\
-       $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBBDIR)/,llib-l,libname,.ln)        @@\
+       $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a)       @@\
+       $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
 
 #endif /* PROFILED_LIBS */
 
@@ -137,7 +155,7 @@ install::                                                           @@\
 all:: pgm                                                              @@\
                                                                        @@\
 pgm: objs localdeps                                                    @@\
-       $(CC) $(CFLAGS) -o $@ objs localdeps syslibs                    @@\
+       $(CC) $(CFLAGS) -o $@ objs syslibs                              @@\
                                                                        @@\
 clean::                                                                @@\
        $(RM) pgm objs                                                  @@\
@@ -206,6 +224,12 @@ clean::                                                                    @@\
                                                                        @@\
 depend:: concat(src,.h)
 
+#define mk_cmds(tbl)                                                   @@\
+concat(tbl,.o): concat(tbl,.ct)                                                @@\
+       $(MAKE_COMMANDS) concat(tbl,.ct)                                @@\
+clean::                                                                        @@\
+       $(RM) concat(src,.o)
+
 /*
  * Rule for building some random object module
  */
@@ -312,6 +336,26 @@ install::                                                          @@\
 clean::                                                                @@\
        $(RM) pgm objs                                                  @@\
 
+/*
+ * Special rule for building and installing a Berkeley r-command
+ * We need to preserve the original copies upon installation.
+ */
+
+#define ucbprogram(pgm,objs,localdeps,syslibs,installdir)              @@\
+all:: pgm                                                              @@\
+                                                                       @@\
+pgm: objs localdeps                                                    @@\
+       $(CC) $(CFLAGS) -o $@ objs syslibs                              @@\
+                                                                       @@\
+install::                                                              @@\
+       -if [ ! -f concat5(${DESTDIR},installdir,/,pgm,.ucb) -a -f concat4(${DESTDIR},installdir,/,pgm) ]; then \ @@\
+               mv concat4(${DESTDIR},installdir,/,pgm) concat5(${DESTDIR},installdir,/,pgm,.ucb); fi; exit 0 @@\
+       $(INSTALLSUID) pgm concat4(${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).
@@ -320,7 +364,7 @@ clean::                                                             @@\
 #define manpage(section,page)                                          @@\
 all::                                                                  @@\
 install:: page                                                         @@\
-       $(INSTALLFILE) page concat3(${DESTDIR}${MANDIR}/man,section,/`basename page`) @@\
+       $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\
 
 /*
  * Rule for building makefile dependencies.
@@ -329,7 +373,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::                                                                        @@\
@@ -361,6 +405,7 @@ print:: ${CODE}                                                             @@\
 src:: ${CODE}                                                          @@\
                                                                        @@\
 ${CODE}:                                                               @@\
+       $(RM) $@                                                        @@\
        -$(LN) ${SRCDIR}/$@ $@
 
 #define do_subdirs_no_imakefile(subdirs)                               @@\
This page took 0.097421 seconds and 4 git commands to generate.