]> andersk Git - moira.git/blobdiff - util/imake.includes/Imake.rules
NOENCRYPTION changes.
[moira.git] / util / imake.includes / Imake.rules
index 3f895f78d07b56e527470d05138a2ec4dfed16a4..e315196a31f838a918df493bb4d0192e03742e63 100644 (file)
@@ -1,22 +1,28 @@
+/**/#  $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 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 concat(x,y)x/**/y
+#define concat3(x,y,z)x/**/y/**/z
+#define concat4(w,x,y,z)w/**/x/**/y/**/z
 #define requote(x) "x"
 #endif
 
+#ifdef PROFILED_LIBS
 /*
  * Rule for building objects in libraries.
  */
 
 #define library_obj_rule()                                             @@\
 .c.o:                                                                  @@\
-       $(CC) -p -c $(CFLAGS) $*.c                                      @@\
+       $(CC) PROF_FLAG -c $(CFLAGS) $*.c                               @@\
        -$(LD) -X -r -o profiled/$*.o $*.o                              @@\
        $(CC) -c $(CFLAGS) $*.c                                         @@\
        -$(LD) -x -r -o a.out $*.o                                      @@\
@@ -29,7 +35,7 @@
 
 #define library_ro_object(cfile)                                       @@\
 concat(cfile,.o): concat(cfile,.c)                                     @@\
-       $(CC) -p -c $(CFLAGS) concat(cfile,.c)                          @@\
+       $(CC) PROF_FLAG -c $(CFLAGS) concat(cfile,.c)                   @@\
        -$(LD) -X -r -o profiled/$*.o $*.o                              @@\
        $(CCRO) -c $(CFLAGS) concat(cfile,.c)                           @@\
        -$(LD) -x -r -o a.out $*.o                                      @@\
@@ -57,28 +63,76 @@ concat3(lib,libname,_p.a): objs                                             @@\
        cd profiled; $(ARCHIVE) ../$@ objs                              @@\
        $(RANLIB) $@                                                    @@\
                                                                        @@\
-lint: concat3(llib-l,libname,.ln)                                      @@\
+lint:: concat3(llib-l,libname,.ln)                                     @@\
                                                                        @@\
 concat3(llib-l,libname,.ln): srcs                                      @@\
-       $(LINT) concat(-C,libname) $(CFLAGS) srcs lintlibs              @@\
+       $(LINT) concat(-C,libname) $(LINTFLAGS) srcs lintlibs           @@\
                                                                        @@\
 clean::                                                                @@\
        $(RM) concat3(lib,libname,.a) concat3(lib,libname,_p.a)         @@\
        $(RM) concat3(llib-l,libname,.ln)                               @@\
        $(RM) objs                                                      @@\
-       $(RM) profiled/*.o                                              @@\
+       $(RM) profiled/?*.o                                             @@\
                                                                        @@\
 install::                                                              @@\
-       $(INSTALLFILE) concat3(lib,libname,.a) $(DESTDIR)/$(LIBDIR)     @@\
-       $(RANLIB) concat4($(DESTDIR)/$(LIBDIR),lib,libname,.a)          @@\
-       $(INSTALLFILE) concat3(lib,libname,_p.a) $(DESTDIR)/$(LIBDIR)   @@\
-       $(RANLIB) concat4($(DESTDIR)/$(LIBDIR),lib,libname,_p.a)        @@\
-       $(INSTALLFILE) concat3(llib-l,libname,.ln) $(DESTDIR)/$(LIBDIR)/lint
+       $(INSTALLFILE) 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) @@\
+       $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a)     @@\
+       $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
 
+#else /* !PROFILED_LIBS */
 /*
- * Rule for building utilities (binaries which don't get installed)
+ * Rule for building objects in libraries.
  */
 
+#define library_obj_rule()                                             @@\
+.c.o:                                                                  @@\
+       $(CC) -c $(CFLAGS) $*.c                                         @@\
+       -$(LD) -x -r -o a.out $*.o                                      @@\
+       $(MV) a.out $*.o
+
+#define library_ro_object(cfile)                                       @@\
+concat(cfile,.o): concat(cfile,.c)                                     @@\
+       $(CCRO) -c $(CFLAGS) concat(cfile,.c)                           @@\
+       -$(LD) -x -r -o a.out $*.o                                      @@\
+       $(MV) a.out $*.o
+
+#define library_asm_object(ofile,sfile)                                        @@\
+ofile: sfile                                                           @@\
+       $(CPP) x.c | $(AS) -                                            @@\
+       -$(LD) -x -r -o $*.o a.out                                      @@\
+       $(RM) a.out x.c
+
+#define        install_library_target(libname,objs,srcs,lintlibs)              @@\
+                                                                       @@\
+all:: concat3(lib,libname,.a)                                          @@\
+all:: concat3(llib-l,libname,.ln)                                      @@\
+                                                                       @@\
+concat3(lib,libname,.a): objs                                          @@\
+       $(ARCHIVE) $@ objs                                              @@\
+       $(RANLIB) $@                                                    @@\
+                                                                       @@\
+lint:: concat3(llib-l,libname,.ln)                                     @@\
+                                                                       @@\
+concat3(llib-l,libname,.ln): srcs                                      @@\
+       $(LINT) concat(-C,libname) $(LINTFLAGS) srcs lintlibs           @@\
+                                                                       @@\
+clean::                                                                @@\
+       $(RM) concat3(lib,libname,.a)                                   @@\
+       $(RM) concat3(llib-l,libname,.ln)                               @@\
+       $(RM) objs                                                      @@\
+                                                                       @@\
+install::                                                              @@\
+       $(INSTALLFILE) 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)        @@\
+
+#endif /* PROFILED_LIBS */
+
+/*
+ * Rule for building utilities (binaries which don't get installed)
+ */
 #define genutil(pgm,objs,localdeps,syslibs)                            @@\
 all:: pgm                                                              @@\
                                                                        @@\
@@ -98,7 +152,7 @@ pgm: concat(pgm,.c) libs                                             @@\
        $(HCC) $(HCFLAGS) -o $@ $@.c libs                               @@\
                                                                        @@\
 file: pgm                                                              @@\
-       ./pgm > file                                                    @@\
+       ./pgm file                                                      @@\
                                                                        @@\
 clean::                                                                        @@\
        $(RM) file pgm concat(pgm,.o)                                   
@@ -123,6 +177,35 @@ pgm: concat(pgm,.c) locallibs                                              @@\
 clean::                                                                        @@\
        $(RM) pgm concat(pgm,.o)                                        @@\
 
+/* 
+ * 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)                         @@\
+       $(COMPILE_ET) concat(tbl,.et)                                   @@\
+clean::                                                                        @@\
+       $(RM) concat(src,.o) concat(src,.h)
+
+#define comp_et_depend(src)                                            @@\
+       comp_et(src)                                                    @@\
+                                                                       @@\
+depend:: concat(src,.h)
+
 /*
  * Rule for building some random object module
  */
@@ -141,18 +224,74 @@ obj:      src                                                             @@\
 clean::                                                                        @@\
        $(RM) obj                                                       @@\
        
+/*
+ * Rule for building some random object module with compile flags and
+ * other dependendcies
+ */
+
+#define host_flag_object(obj,src,flags,localdeps)                      @@\
+obj:   src localdeps                                                   @@\
+       $(HCC) $(HCFLAGS) flags -c src                                  @@\
+                                                                       @@\
+clean::                                                                        @@\
+       $(RM) obj                                                       @@\
+
+#define ro_flag_object(obj,src,flags,localdeps)                                @@\
+obj:   src localdeps                                                   @@\
+       $(CCRO) $(CFLAGS) flags -c src                                  @@\
+                                                                       @@\
+clean::                                                                        @@\
+       $(RM) obj                                                       @@\
+       
+/*
+ * Rule for building some random object module with compile flags, an
+ * intermediate output, and some other dependencies
+ */
+
+#define host_cplx_object(obj,interim,src,flags,localdeps)              @@\
+obj:   interim src localdeps                                           @@\
+       $(HCC) $(HCFLAGS) flags -c src                                  @@\
+       $(MV) interim obj                                               @@\
+                                                                       @@\
+clean::                                                                        @@\
+       $(RM) obj                                                       @@\
+
+#define ro_cplx_object(obj,interim,src,flags,localdeps)                        @@\
+obj:   src localdeps interim                                           @@\
+       $(CCRO) $(CFLAGS) flags -c src                                  @@\
+       $(MV) interim obj                                               @@\
+                                                                       @@\
+clean::                                                                        @@\
+       $(RM) obj                                                       @@\
+       
 /*
  * 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                              @@\
+                                                                       @@\
+install::                                                              @@\
+       $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm                     @@\
+                                                                       @@\
+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 localdeps syslibs                    @@\
+       $(CC) $(CFLAGS) -o $@ objs syslibs                              @@\
                                                                        @@\
 install::                                                              @@\
-       $(INSTALLPROG) pgm ${DESTDIR}installdir                         @@\
+       $(INSTALLSUID) pgm ${DESTDIR}installdir/pgm                     @@\
                                                                        @@\
 clean::                                                                @@\
        $(RM) pgm objs                                                  @@\
@@ -165,16 +304,17 @@ clean::                                                           @@\
 all:: pgm                                                              @@\
                                                                        @@\
 pgm: objs localdeps                                                    @@\
-       $(CC) $(CFLAGS) -o $@ objs localdeps syslibs                    @@\
+       $(CC) $(CFLAGS) -o $@ objs syslibs                              @@\
                                                                        @@\
 install::                                                              @@\
-       $(INSTALLPROG) instopts pgm ${DESTDIR}installdir                @@\
+       $(INSTALLRAW) instopts pgm ${DESTDIR}installdir/pgm             @@\
                                                                        @@\
 clean::                                                                @@\
        $(RM) pgm objs                                                  @@\
 
 /*
- * Rule for installing man pages.
+ * 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)                                          @@\
@@ -183,12 +323,12 @@ install:: page                                                            @@\
        $(INSTALLFILE) page concat3(${DESTDIR}${MANDIR}/man,section,/`basename page`) @@\
 
 /*
- * Rule for building makefile dependancies.
+ * Rule for building makefile dependencies.
  */
 
 #define        depend_target()                                                 @@\
 depend:: $(SRCS)                                                       @@\
-       @echo "### Now computing dependancies"                          @@\
+       @echo "### Now computing dependencies"                          @@\
        @$(DEPEND) -s "# DO NOT DELETE" $(CFLAGS) $(SRCS)               @@\
 
 #define clean_target()                                                 @@\
@@ -209,7 +349,7 @@ name::                                                                      @@\
        @for d in subdirs; \                                            @@\
        do \                                                            @@\
                (cd $$d; echo "### Making" name "in" `pwd`;     \       @@\
-                       $(MAKE) $(MFLAGS) name ;        \               @@\
+                       $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \   @@\
                        echo "### Done with" `pwd`);            \       @@\
        done
 
This page took 0.048064 seconds and 4 git commands to generate.