]> andersk Git - moira.git/blame - util/imake.includes/Imake.rules
DBMS=ORACLE
[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
df897414 18#ifdef PROFILED_LIBS
b9be51ef 19/*
20 * Rule for building objects in libraries.
21 */
22
6eec65ae 23#if defined(mips) || defined(_AIX) || defined(SOLARIS)
bb64d499 24/*
6eec65ae 25 * The MIPS, AIX & SOLARIS loaders don't have the -X flag or its functionality.
26 * Solaris to make it worse does not have -x
bb64d499 27 */
6eec65ae 28#if !defined(SOLARIS)
bb64d499 29#define library_obj_rule() @@\
30.c.o: @@\
31 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
32 $(MV) $*.o profiled/$*.o @@\
33 $(CC) -c $(CFLAGS) $*.c @@\
34 -$(LD) -x -r -o a.out $*.o @@\
35 $(MV) a.out $*.o
6eec65ae 36#else
37#define library_obj_rule() @@\
38.c.o: @@\
39 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
40 $(MV) $*.o profiled/$*.o @@\
41 $(CC) -c $(CFLAGS) $*.c @@\
93b07a3e 42 -$(LD) -r -o a.out $*.o @@\
6eec65ae 43 $(MV) a.out $*.o
44#endif
bdcaf132 45#else /* ! mips && ! _AIX */
b9be51ef 46#define library_obj_rule() @@\
47.c.o: @@\
df897414 48 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
b9be51ef 49 -$(LD) -X -r -o profiled/$*.o $*.o @@\
50 $(CC) -c $(CFLAGS) $*.c @@\
51 -$(LD) -x -r -o a.out $*.o @@\
52 $(MV) a.out $*.o
bb64d499 53#endif /* mips */
b9be51ef 54/*
55 * cc -R breaks profiling with -p on 4.3BSD on the VAX
56 * (and probably elsewhere), so we don't do it for the profiled version.
57 */
58
59#define library_ro_object(cfile) @@\
60concat(cfile,.o): concat(cfile,.c) @@\
df897414 61 $(CC) PROF_FLAG -c $(CFLAGS) concat(cfile,.c) @@\
b9be51ef 62 -$(LD) -X -r -o profiled/$*.o $*.o @@\
63 $(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
64 -$(LD) -x -r -o a.out $*.o @@\
65 $(MV) a.out $*.o
66
67#define library_asm_object(ofile,sfile) @@\
68ofile: sfile @@\
69 $(CP) sfile x.c @@\
70 $(CPP) -DPROF x.c | $(AS) - @@\
71 -$(LD) -X -r -o profiled/$*.o a.out @@\
72 $(CPP) x.c | $(AS) - @@\
73 -$(LD) -x -r -o $*.o a.out @@\
74 $(RM) a.out x.c
75
6eec65ae 76#ifdef USELINT
77#define install_library_lint(libname) @@\
78all:: concat3(llib-l,libname,.ln) @@\
79 @@\
80install:: @@\
81 $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
82
83#else
84#define install_library_lint(libname)
85#endif
86
87
b9be51ef 88#define install_library_target(libname,objs,srcs,lintlibs) @@\
89 @@\
90all:: concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\
b9be51ef 91 @@\
92concat3(lib,libname,.a): objs @@\
d1e9e56b 93 $(RM) $@.bak @@\
94 -$(MV) $@ $@.bak @@\
b9be51ef 95 $(ARCHIVE) $@ objs @@\
96 $(RANLIB) $@ @@\
97 @@\
98concat3(lib,libname,_p.a): objs @@\
d1e9e56b 99 $(RM) $@.bak @@\
100 -$(MV) $@ $@.bak @@\
b9be51ef 101 cd profiled; $(ARCHIVE) ../$@ objs @@\
102 $(RANLIB) $@ @@\
103 @@\
2e387221 104lint:: concat3(llib-l,libname,.ln) @@\
b9be51ef 105 @@\
106concat3(llib-l,libname,.ln): srcs @@\
322efbe6 107 $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\
b9be51ef 108 @@\
109clean:: @@\
110 $(RM) concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\
111 $(RM) concat3(llib-l,libname,.ln) @@\
112 $(RM) objs @@\
df897414 113 $(RM) profiled/?*.o @@\
b9be51ef 114 @@\
115install:: @@\
f111b4b2 116 $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
f9d599c8 117 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
93fe6c95 118 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
f111b4b2 119 $(INSTALLRAW) -c -m 644 concat3(lib,libname,_p.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
f9d599c8 120 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
93fe6c95 121 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
6eec65ae 122 @@\
123install_library_lint(libname) @@\
b9be51ef 124
df897414 125#else /* !PROFILED_LIBS */
126/*
127 * Rule for building objects in libraries.
128 */
129
d56d6311 130#ifdef DEBUG_LIBS
131/* When debugging, leave symbols alone (don't do LD) */
132#define library_obj_rule() @@\
133.c.o: @@\
134 $(CC) -c $(CFLAGS) $*.c
135#else
df897414 136#define library_obj_rule() @@\
137.c.o: @@\
138 $(CC) -c $(CFLAGS) $*.c @@\
139 -$(LD) -x -r -o a.out $*.o @@\
140 $(MV) a.out $*.o
d56d6311 141#endif
df897414 142
143#define library_ro_object(cfile) @@\
144concat(cfile,.o): concat(cfile,.c) @@\
145 $(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
146 -$(LD) -x -r -o a.out $*.o @@\
147 $(MV) a.out $*.o
148
149#define library_asm_object(ofile,sfile) @@\
150ofile: sfile @@\
151 $(CPP) x.c | $(AS) - @@\
152 -$(LD) -x -r -o $*.o a.out @@\
153 $(RM) a.out x.c
154
6eec65ae 155#ifdef USELINT
156#define install_library_lint(libname) @@\
157all:: concat3(llib-l,libname,.ln) @@\
158 @@\
159install:: @@\
160 $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
161
162#else
163#define install_library_lint(libname)
164#endif
165
df897414 166#define install_library_target(libname,objs,srcs,lintlibs) @@\
167 @@\
168all:: concat3(lib,libname,.a) @@\
df897414 169 @@\
170concat3(lib,libname,.a): objs @@\
d1e9e56b 171 $(RM) $@.bak @@\
172 -$(MV) $@ $@.bak @@\
df897414 173 $(ARCHIVE) $@ objs @@\
174 $(RANLIB) $@ @@\
175 @@\
176lint:: concat3(llib-l,libname,.ln) @@\
177 @@\
178concat3(llib-l,libname,.ln): srcs @@\
322efbe6 179 $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\
df897414 180 @@\
181clean:: @@\
182 $(RM) concat3(lib,libname,.a) @@\
183 $(RM) concat3(llib-l,libname,.ln) @@\
184 $(RM) objs @@\
185 @@\
186install:: @@\
f111b4b2 187 $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
df897414 188 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
93fe6c95 189 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
6eec65ae 190 @@\
191install_library_lint(libname) @@\
192
df897414 193
194#endif /* PROFILED_LIBS */
195
b9be51ef 196/*
197 * Rule for building utilities (binaries which don't get installed)
198 */
b9be51ef 199#define genutil(pgm,objs,localdeps,syslibs) @@\
200all:: pgm @@\
201 @@\
202pgm: objs localdeps @@\
6eec65ae 203 $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\
b9be51ef 204 @@\
205clean:: @@\
206 $(RM) pgm objs @@\
207
208/*
209 * Rule for building "generator" programs.
210 */
211
212#define generate(file,pgm,libs) @@\
213 @@\
214pgm: concat(pgm,.c) libs @@\
6eec65ae 215 $(HCC) $(HCFLAGS) -o $@ $@.c libs $(OSLIBS) @@\
b9be51ef 216 @@\
217file: pgm @@\
7caabe5f 218 ./pgm file @@\
b9be51ef 219 @@\
220clean:: @@\
221 $(RM) file pgm concat(pgm,.o)
222
223#define generate_depend(file,pgm,libs) @@\
224 generate(file,pgm,libs) @@\
225 @@\
226depend:: file
227
228
229/*
230 * Rule for building test programs (something which is not installed)
231 */
232
6eec65ae 233#define test_program(pgm,locallibs,syslibs) @@\
b9be51ef 234 @@\
235all:: pgm @@\
236 @@\
237pgm: concat(pgm,.c) locallibs @@\
6eec65ae 238 $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs $(OSLIBS) @@\
b9be51ef 239 @@\
240clean:: @@\
241 $(RM) pgm concat(pgm,.o) @@\
242
7caabe5f 243/*
244 * Rule for compileing files with "et"
245 */
246
df897414 247#define comp_et(tbl) @@\
bdcaf132 248concat(tbl,.h) concat(tbl,.c): concat(tbl,.et) @@\
df897414 249 $(COMPILE_ET) concat(tbl,.et) @@\
250clean:: @@\
bdcaf132 251 $(RM) concat(tbl,.c) concat(tbl,.h)
7caabe5f 252
253#define comp_et_depend(src) @@\
bdcaf132 254 comp_et(src) @@\
7caabe5f 255 @@\
df897414 256depend:: concat(src,.h)
7caabe5f 257
b9be51ef 258/*
259 * Rule for building some random object module
260 */
261
262#define host_simple_object(obj,src) @@\
263obj: src @@\
264 $(HCC) $(HCFLAGS) -c src @@\
265 @@\
266clean:: @@\
267 $(RM) obj @@\
268
269#define ro_object(obj,src) @@\
270obj: src @@\
271 $(CCRO) $(CFLAGS) -c src @@\
272 @@\
273clean:: @@\
274 $(RM) obj @@\
275
2e387221 276/*
277 * Rule for building some random object module with compile flags and
278 * other dependendcies
279 */
280
281#define host_flag_object(obj,src,flags,localdeps) @@\
282obj: src localdeps @@\
283 $(HCC) $(HCFLAGS) flags -c src @@\
284 @@\
285clean:: @@\
286 $(RM) obj @@\
287
288#define ro_flag_object(obj,src,flags,localdeps) @@\
289obj: src localdeps @@\
290 $(CCRO) $(CFLAGS) flags -c src @@\
291 @@\
292clean:: @@\
293 $(RM) obj @@\
294
295/*
296 * Rule for building some random object module with compile flags, an
297 * intermediate output, and some other dependencies
298 */
299
300#define host_cplx_object(obj,interim,src,flags,localdeps) @@\
7caabe5f 301obj: interim src localdeps @@\
2e387221 302 $(HCC) $(HCFLAGS) flags -c src @@\
303 $(MV) interim obj @@\
304 @@\
305clean:: @@\
306 $(RM) obj @@\
307
308#define ro_cplx_object(obj,interim,src,flags,localdeps) @@\
7caabe5f 309obj: src localdeps interim @@\
2e387221 310 $(CCRO) $(CFLAGS) flags -c src @@\
311 $(MV) interim obj @@\
312 @@\
313clean:: @@\
314 $(RM) obj @@\
315
b9be51ef 316/*
317 * Rule for building a program which is to be installed:
318 */
319
320#define program(pgm,objs,localdeps,syslibs,installdir) @@\
321all:: pgm @@\
322 @@\
7caabe5f 323pgm: localdeps objs @@\
6eec65ae 324 $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\
b9be51ef 325 @@\
326install:: @@\
2e387221 327 $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm @@\
328 @@\
329clean:: @@\
330 $(RM) pgm objs @@\
331
b9be51ef 332/*
333 * Rule for building a specially installed program
334 */
335
336#define program_spinst(pgm,objs,localdeps,syslibs,installdir,instopts) @@\
337all:: pgm @@\
338 @@\
339pgm: objs localdeps @@\
6eec65ae 340 $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\
b9be51ef 341 @@\
342install:: @@\
2e387221 343 $(INSTALLRAW) instopts pgm ${DESTDIR}installdir/pgm @@\
b9be51ef 344 @@\
345clean:: @@\
346 $(RM) pgm objs @@\
347
348/*
2e387221 349 * Rule for installing man pages. Section installing into should match
350 * suffix, or the man page won't show up when using man(1).
b9be51ef 351 */
352
353#define manpage(section,page) @@\
354all:: @@\
355install:: page @@\
28580807 356 $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\
b9be51ef 357
358/*
2e387221 359 * Rule for building makefile dependencies.
b9be51ef 360 */
361
362#define depend_target() @@\
363depend:: $(SRCS) @@\
2e387221 364 @echo "### Now computing dependencies" @@\
322efbe6 365 @$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) @@\
b9be51ef 366
367#define clean_target() @@\
368clean:: @@\
369 $(RM) *~ \#* *.bak $(TAGSFILE)
370
371#define tags_target() @@\
372tags:: @@\
373 $(TAGGER) *.c *.h
374
375#define makefile_target() @@\
376Makefile:: @@\
377 -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak @@\
378 $(IMAKE) -DNEW_TOP=$(NEWTOP) -s Makefile @@\
379
380#define foreach_subdirs(name,subdirs) @@\
381name:: @@\
382 @for d in subdirs; \ @@\
383 do \ @@\
384 (cd $$d; echo "### Making" name "in" `pwd`; \ @@\
7caabe5f 385 $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \ @@\
b9be51ef 386 echo "### Done with" `pwd`); \ @@\
387 done
388
389#define print_target() @@\
390print:: ${CODE} @@\
391 ${LPR} ${CODE}
392
393#define src_target() @@\
394src:: ${CODE} @@\
395 @@\
396${CODE}: @@\
719b9402 397 $(RM) $@ @@\
b9be51ef 398 -$(LN) ${SRCDIR}/$@ $@
399
400#define do_subdirs_no_imakefile(subdirs) @@\
401 foreach_subdirs(all, subdirs) @@\
402 foreach_subdirs(install, subdirs) @@\
403 foreach_subdirs(clean, subdirs) @@\
404 foreach_subdirs(depend, subdirs) @@\
405 foreach_subdirs(tags, subdirs) @@\
406 foreach_subdirs(print, subdirs) @@\
407 foreach_subdirs(src, subdirs) @@\
408
409#define do_subdirs(subdirs) @@\
410 do_subdirs_no_imakefile(subdirs) @@\
411 @@\
412Makefiles:: @@\
413 @echo "### Making Makefiles in" `pwd` @@\
414 @for d in subdirs; \ @@\
415 do \ @@\
416 (cd $$d; echo "### Making Makefile in" `pwd`; \ @@\
417 $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\
418 NEWTOP=../$(BUILDTOP) \ @@\
419 BUILDTOP=../$(BUILDTOP) \ @@\
420 -f ../Makefile \ @@\
421 Makefile; \ @@\
422 $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\
423 NEWTOP=../$(BUILDTOP) \ @@\
424 Makefiles; \ @@\
425 echo "### Done with" `pwd`); \ @@\
426 done
427
428
bdcaf132 429/* Compile Embeded SQL source */
b9be51ef 430
bdcaf132 431#ifdef INGRES
432#define sqlrule() @@\
433.SUFFIXES: .sc .dc @@\
434.dc.sc: @@\
435 $(AWK) -f $(SRCTOP)/util/imake.includes/ingres.awk < $< > $*.sc @@\
436 @@\
437.sc.c: @@\
6eec65ae 438 /usr/ingres/bin/esqlc -p $*
bdcaf132 439#define sqlfile(file) @@\
440concat(file,.sc): concat(file,.dc) @@\
441concat(file,.c): concat(file,.sc) @@\
442clean:: @@\
443 $(RM) concat(file,.sc) concat(file,.c)
444#endif
445#ifdef INFORMIX
446#define sqlrule() @@\
447.SUFFIXES: .ec .dc @@\
448.dc.ec: @@\
449 $(AWK) -f $(SRCTOP)/util/imake.includes/informix.awk < $< > $*.ec @@\
450 @@\
451.ec.c: @@\
452 /usr/informix/bin/esql -e $*.ec
453#define sqlfile(file) @@\
454concat(file,.ec): concat(file,.dc) @@\
455concat(file,.c): concat(file,.ec) @@\
456clean:: @@\
457 $(RM) concat(file,.ec) concat(file,.c)
458#endif
459#ifdef ORACLE
99826b0e 460/* have to undef these to keep the ORADEFS line from being attacked */
461#undef HESIOD
462#undef ZEPHYR
463#undef GDSS
464#undef ATHENA
465ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA
bdcaf132 466#define sqlrule() @@\
467.SUFFIXES: .pc .dc @@\
468.dc.pc: @@\
469 $(AWK) -f $(SRCTOP)/util/imake.includes/oracle.awk < $< > $*.pc @@\
470 @@\
471.pc.c: @@\
99826b0e 472 /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS)
bdcaf132 473#define sqlfile(file) @@\
474concat(file,.pc): concat(file,.dc) @@\
475concat(file,.c): concat(file,.pc) @@\
476clean:: @@\
477 $(RM) concat(file,.pc) concat(file,.c)
478#endif
This page took 0.156891 seconds and 5 git commands to generate.