]> andersk Git - moira.git/blob - util/imake.includes/Imake.rules
1f15b6d3259d360375903e4e4e3d9d2929727304
[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 do_subdirs_no_imakefile(subdirs)                                @@\
141         foreach_subdirs(all, subdirs)                                   @@\
142         foreach_subdirs(install, subdirs)                               @@\
143         foreach_subdirs(clean, subdirs)                                 @@\
144         foreach_subdirs(depend, subdirs)                                @@\
145         foreach_subdirs(src, subdirs)                                   @@\
146
147 #define do_subdirs(subdirs)                                             @@\
148         do_subdirs_no_imakefile(subdirs)                                @@\
149                                                                         @@\
150 Makefiles::                                                             @@\
151         @echo "### Making Makefiles in" `pwd`                           @@\
152         @for d in subdirs; \                                            @@\
153         do \                                                            @@\
154                 (cd $$d; echo "### Making Makefile in" `pwd`; \         @@\
155                         $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \            @@\
156                         NEWTOP=../$(BUILDTOP)           \               @@\
157                         BUILDTOP=../$(BUILDTOP)         \               @@\
158                         -f ../Makefile                  \               @@\
159                         Makefile; \                                     @@\
160                         $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \            @@\
161                         NEWTOP=../$(BUILDTOP)           \               @@\
162                         Makefiles; \                                    @@\
163                         echo "### Done with" `pwd`); \                  @@\
164         done
165
166
167 /* Compile Embeded SQL source */
168
169 #ifdef ORACLE
170 /* have to undef these to keep the ORADEFS line from being attacked by Imake */
171 #undef HESIOD
172 #undef ZEPHYR
173 #undef GDSS
174 #undef ATHENA
175 ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA
176 #define sqlrule()                                                       @@\
177 .SUFFIXES: .pc                                                          @@\
178 .pc.c:                                                                  @@\
179         /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS)
180 #define sqlfile(file)                                                   @@\
181 concat(file,.c): concat(file,.pc)                                       @@\
182 clean::                                                                 @@\
183         $(RM) concat(file,.c)
184 #endif
This page took 0.04256 seconds and 3 git commands to generate.