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