]> andersk Git - moira.git/blobdiff - util/imake.includes/Imake.rules
add mk_cmds
[moira.git] / util / imake.includes / Imake.rules
index 7938eceb59f68c4dac01e89996724ec1b4da83b5..1a983041a978669b31421a038cd5fd61f8d1771b 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
 
@@ -140,7 +142,7 @@ install::                                                           @@\
 all:: pgm                                                              @@\
                                                                        @@\
 pgm: objs localdeps                                                    @@\
-       $(CC) $(CFLAGS) -o $@ objs localdeps syslibs                    @@\
+       $(CC) $(CFLAGS) -o $@ objs syslibs                              @@\
                                                                        @@\
 clean::                                                                @@\
        $(RM) pgm objs                                                  @@\
@@ -209,6 +211,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
  */
@@ -315,6 +323,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).
@@ -364,6 +392,7 @@ print:: ${CODE}                                                             @@\
 src:: ${CODE}                                                          @@\
                                                                        @@\
 ${CODE}:                                                               @@\
+       $(RM) $@                                                        @@\
        -$(LN) ${SRCDIR}/$@ $@
 
 #define do_subdirs_no_imakefile(subdirs)                               @@\
This page took 0.034508 seconds and 4 git commands to generate.