]> andersk Git - moira.git/blob - util/imake.includes/Imake.rules
Imake.rules:
[moira.git] / util / imake.includes / Imake.rules
1 /**/#   $Source$
2 /**/#
3
4 #ifdef __STDC__
5 #define concat(x,y) x##y
6 #define concat3(x,y,z) x##y##z
7 #define concat4(w,x,y,z) w##x##y##z
8 #define concat5(v,w,x,y,z) v##w##x##y##z
9 #define requote(x) #x
10 #else
11 #define concat(x,y)x/**/y
12 #define concat3(x,y,z)x/**/y/**/z
13 #define concat4(w,x,y,z)w/**/x/**/y/**/z
14 #define concat5(v,w,x,y,z)v/**/w/**/x/**/y/**/z
15 #define requote(x) "x"
16 #endif
17
18 /*
19  * Rule for building objects in libraries.
20  */
21
22 #define library_obj_rule()                                              @@\
23 .c.o:                                                                   @@\
24         $(CC) -c $(CFLAGS) $*.c
25
26 #define install_library_target(libname,objs,srcs)                       @@\
27                                                                         @@\
28 all:: concat3(lib,libname,.a)                                           @@\
29                                                                         @@\
30 concat3(lib,libname,.a): objs                                           @@\
31         $(RM) $@.bak                                                    @@\
32         -$(MV) $@ $@.bak                                                @@\
33         $(ARCHIVE) $@ objs                                              @@\
34         $(RANLIB) $@                                                    @@\
35                                                                         @@\
36 clean::                                                                 @@\
37         $(RM) concat3(lib,libname,.a)                                   @@\
38         $(RM) objs                                                      @@\
39                                                                         @@\
40 install::                                                               @@\
41         $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a)    @@\
42         $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a)       @@\
43         $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a)
44
45
46 /*
47  * Rule for building utilities (binaries which don't get installed)
48  */
49 #define genutil(pgm,objs,localdeps,syslibs)                             @@\
50 all:: pgm                                                               @@\
51                                                                         @@\
52 pgm: objs localdeps                                                     @@\
53         $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS)                    @@\
54                                                                         @@\
55 clean::                                                                 @@\
56         $(RM) pgm objs                                                  @@\
57
58 /*
59  * Rule for building test programs (something which is not installed)
60  */
61
62 #define test_program(pgm,locallibs,syslibs)                             @@\
63                                                                         @@\
64 all:: pgm                                                               @@\
65                                                                         @@\
66 pgm: concat(pgm,.c) locallibs                                           @@\
67         $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs $(OSLIBS)          @@\
68                                                                         @@\
69 clean::                                                                 @@\
70         $(RM) pgm concat(pgm,.o)                                        @@\
71
72 /* 
73  * Rule for compiling files with "et"
74  */
75
76 #define comp_et(tbl)                                                    @@\
77 concat(tbl,.h) concat(tbl,.c): concat(tbl,.et)                          @@\
78         $(COMPILE_ET) concat(tbl,.et)                                   @@\
79 clean::                                                                 @@\
80         $(RM) concat(tbl,.c) concat(tbl,.h)
81
82 #define comp_et_depend(src)                                             @@\
83         comp_et(src)                                                    @@\
84                                                                         @@\
85 depend:: concat(src,.h)
86
87 /*
88  * Rule for building a program which is to be installed:
89  */
90
91 #define program(pgm,objs,localdeps,syslibs,installdir)                  @@\
92 all:: pgm                                                               @@\
93                                                                         @@\
94 pgm: localdeps objs                                                     @@\
95         $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS)                    @@\
96                                                                         @@\
97 install::                                                               @@\
98         $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm                     @@\
99                                                                         @@\
100 clean::                                                                 @@\
101         $(RM) pgm objs                                                  @@\
102
103 /*
104  * Rule for installing man pages.  Section installing into should match
105  * suffix, or the man page won't show up when using man(1).
106  */
107
108 #define manpage(section,page)                                           @@\
109 all::                                                                   @@\
110 install:: page                                                          @@\
111         $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\
112
113 /*
114  * Rule for building makefile dependencies.
115  */
116
117 #define depend_target()                                                 @@\
118 depend:: $(SRCS)                                                        @@\
119         @echo "### Now computing dependencies"                          @@\
120         @$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)         @@\
121
122 #define clean_target()                                                  @@\
123 clean::                                                                 @@\
124         $(RM) *~ \#* *.bak $(TAGSFILE)                          
125
126 #define makefile_target()                                               @@\
127 Makefile::                                                              @@\
128         -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak                @@\
129         $(IMAKE) -DNEW_TOP=$(NEWTOP) -s Makefile                        @@\
130
131 #define foreach_subdirs(name,subdirs)                                   @@\
132 name::                                                                  @@\
133         @for d in subdirs; \                                            @@\
134         do \                                                            @@\
135                 (cd $$d; echo "### Making" name "in" `pwd`;     \       @@\
136                         $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \   @@\
137                         echo "### Done with" `pwd`);            \       @@\
138         done
139
140 #define src_target()                                                    @@\
141 src:: ${CODE}                                                           @@\
142                                                                         @@\
143 ${CODE}:                                                                @@\
144         $(RM) $@                                                        @@\
145         -$(LN) ${SRCDIR}/$@ $@
146
147 #define do_subdirs_no_imakefile(subdirs)                                @@\
148         foreach_subdirs(all, subdirs)                                   @@\
149         foreach_subdirs(install, subdirs)                               @@\
150         foreach_subdirs(clean, subdirs)                                 @@\
151         foreach_subdirs(depend, subdirs)                                @@\
152         foreach_subdirs(src, subdirs)                                   @@\
153
154 #define do_subdirs(subdirs)                                             @@\
155         do_subdirs_no_imakefile(subdirs)                                @@\
156                                                                         @@\
157 Makefiles::                                                             @@\
158         @echo "### Making Makefiles in" `pwd`                           @@\
159         @for d in subdirs; \                                            @@\
160         do \                                                            @@\
161                 (cd $$d; echo "### Making Makefile in" `pwd`; \         @@\
162                         $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \            @@\
163                         NEWTOP=../$(BUILDTOP)           \               @@\
164                         BUILDTOP=../$(BUILDTOP)         \               @@\
165                         -f ../Makefile                  \               @@\
166                         Makefile; \                                     @@\
167                         $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \            @@\
168                         NEWTOP=../$(BUILDTOP)           \               @@\
169                         Makefiles; \                                    @@\
170                         echo "### Done with" `pwd`); \                  @@\
171         done
172
173
174 /* Compile Embeded SQL source */
175
176 #ifdef ORACLE
177 /* have to undef these to keep the ORADEFS line from being attacked by Imake */
178 #undef HESIOD
179 #undef ZEPHYR
180 #undef GDSS
181 #undef ATHENA
182 ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA
183 #define sqlrule()                                                       @@\
184 .SUFFIXES: .pc                                                          @@\
185 .pc.c:                                                                  @@\
186         /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS)
187 #define sqlfile(file)                                                   @@\
188 concat(file,.c): concat(file,.pc)                                       @@\
189 clean::                                                                 @@\
190         $(RM) concat(file,.c)
191 #endif
This page took 4.642871 seconds and 5 git commands to generate.