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
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"
20 * Rule for building objects in libraries.
23 #if defined(mips) || defined(_AIX) || defined(SOLARIS)
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
29 #define library_obj_rule() @@\
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 @@\
37 #define library_obj_rule() @@\
39 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
40 $(MV) $*.o profiled/$*.o @@\
41 $(CC) -c $(CFLAGS) $*.c @@\
42 -$(LD) -r -o a.out $*.o @@\
45 #else /* ! mips && ! _AIX */
46 #define library_obj_rule() @@\
48 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
49 -$(LD) -X -r -o profiled/$*.o $*.o @@\
50 $(CC) -c $(CFLAGS) $*.c @@\
51 -$(LD) -x -r -o a.out $*.o @@\
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.
59 #define library_ro_object(cfile) @@\
60 concat(cfile,.o): concat(cfile,.c) @@\
61 $(CC) PROF_FLAG -c $(CFLAGS) concat(cfile,.c) @@\
62 -$(LD) -X -r -o profiled/$*.o $*.o @@\
63 $(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
64 -$(LD) -x -r -o a.out $*.o @@\
67 #define library_asm_object(ofile,sfile) @@\
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 @@\
77 #define install_library_lint(libname) @@\
78 all:: concat3(llib-l,libname,.ln) @@\
81 $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
84 #define install_library_lint(libname)
88 #define install_library_target(libname,objs,srcs,lintlibs) @@\
90 all:: concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\
92 concat3(lib,libname,.a): objs @@\
95 $(ARCHIVE) $@ objs @@\
98 concat3(lib,libname,_p.a): objs @@\
101 cd profiled; $(ARCHIVE) ../$@ objs @@\
104 lint:: concat3(llib-l,libname,.ln) @@\
106 concat3(llib-l,libname,.ln): srcs @@\
107 $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\
110 $(RM) concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\
111 $(RM) concat3(llib-l,libname,.ln) @@\
113 $(RM) profiled/?*.o @@\
116 $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
117 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
118 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
119 $(INSTALLRAW) -c -m 644 concat3(lib,libname,_p.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
120 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
121 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
123 install_library_lint(libname) @@\
125 #else /* !PROFILED_LIBS */
127 * Rule for building objects in libraries.
131 /* When debugging, leave symbols alone (don't do LD) */
132 #define library_obj_rule() @@\
134 $(CC) -c $(CFLAGS) $*.c
136 #define library_obj_rule() @@\
138 $(CC) -c $(CFLAGS) $*.c @@\
139 -$(LD) -x -r -o a.out $*.o @@\
143 #define library_ro_object(cfile) @@\
144 concat(cfile,.o): concat(cfile,.c) @@\
145 $(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
146 -$(LD) -x -r -o a.out $*.o @@\
149 #define library_asm_object(ofile,sfile) @@\
151 $(CPP) x.c | $(AS) - @@\
152 -$(LD) -x -r -o $*.o a.out @@\
156 #define install_library_lint(libname) @@\
157 all:: concat3(llib-l,libname,.ln) @@\
160 $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
163 #define install_library_lint(libname)
166 #define install_library_target(libname,objs,srcs,lintlibs) @@\
168 all:: concat3(lib,libname,.a) @@\
170 concat3(lib,libname,.a): objs @@\
173 $(ARCHIVE) $@ objs @@\
176 lint:: concat3(llib-l,libname,.ln) @@\
178 concat3(llib-l,libname,.ln): srcs @@\
179 $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\
182 $(RM) concat3(lib,libname,.a) @@\
183 $(RM) concat3(llib-l,libname,.ln) @@\
187 $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
188 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
189 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
191 install_library_lint(libname) @@\
194 #endif /* PROFILED_LIBS */
197 * Rule for building utilities (binaries which don't get installed)
199 #define genutil(pgm,objs,localdeps,syslibs) @@\
202 pgm: objs localdeps @@\
203 $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\
209 * Rule for building "generator" programs.
212 #define generate(file,pgm,libs) @@\
214 pgm: concat(pgm,.c) libs @@\
215 $(HCC) $(HCFLAGS) -o $@ $@.c libs $(OSLIBS) @@\
221 $(RM) file pgm concat(pgm,.o)
223 #define generate_depend(file,pgm,libs) @@\
224 generate(file,pgm,libs) @@\
230 * Rule for building test programs (something which is not installed)
233 #define test_program(pgm,locallibs,syslibs) @@\
237 pgm: concat(pgm,.c) locallibs @@\
238 $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs $(OSLIBS) @@\
241 $(RM) pgm concat(pgm,.o) @@\
244 * Rule for compileing files with "et"
247 #define comp_et(tbl) @@\
248 concat(tbl,.h) concat(tbl,.c): concat(tbl,.et) @@\
249 $(COMPILE_ET) concat(tbl,.et) @@\
251 $(RM) concat(tbl,.c) concat(tbl,.h)
253 #define comp_et_depend(src) @@\
256 depend:: concat(src,.h)
259 * Rule for building some random object module
262 #define host_simple_object(obj,src) @@\
264 $(HCC) $(HCFLAGS) -c src @@\
269 #define ro_object(obj,src) @@\
271 $(CCRO) $(CFLAGS) -c src @@\
277 * Rule for building some random object module with compile flags and
278 * other dependendcies
281 #define host_flag_object(obj,src,flags,localdeps) @@\
282 obj: src localdeps @@\
283 $(HCC) $(HCFLAGS) flags -c src @@\
288 #define ro_flag_object(obj,src,flags,localdeps) @@\
289 obj: src localdeps @@\
290 $(CCRO) $(CFLAGS) flags -c src @@\
296 * Rule for building some random object module with compile flags, an
297 * intermediate output, and some other dependencies
300 #define host_cplx_object(obj,interim,src,flags,localdeps) @@\
301 obj: interim src localdeps @@\
302 $(HCC) $(HCFLAGS) flags -c src @@\
303 $(MV) interim obj @@\
308 #define ro_cplx_object(obj,interim,src,flags,localdeps) @@\
309 obj: src localdeps interim @@\
310 $(CCRO) $(CFLAGS) flags -c src @@\
311 $(MV) interim obj @@\
317 * Rule for building a program which is to be installed:
320 #define program(pgm,objs,localdeps,syslibs,installdir) @@\
323 pgm: localdeps objs @@\
324 $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\
327 $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm @@\
333 * Rule for building a specially installed program
336 #define program_spinst(pgm,objs,localdeps,syslibs,installdir,instopts) @@\
339 pgm: objs localdeps @@\
340 $(CC) $(CFLAGS) -o $@ objs syslibs $(OSLIBS) @@\
343 $(INSTALLRAW) instopts pgm ${DESTDIR}installdir/pgm @@\
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).
353 #define manpage(section,page) @@\
356 $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\
359 * Rule for building makefile dependencies.
362 #define depend_target() @@\
364 @echo "### Now computing dependencies" @@\
365 @$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) @@\
367 #define clean_target() @@\
369 $(RM) *~ \#* *.bak $(TAGSFILE)
371 #define tags_target() @@\
375 #define makefile_target() @@\
377 -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak @@\
378 $(IMAKE) -DNEW_TOP=$(NEWTOP) -s Makefile @@\
380 #define foreach_subdirs(name,subdirs) @@\
382 @for d in subdirs; \ @@\
384 (cd $$d; echo "### Making" name "in" `pwd`; \ @@\
385 $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \ @@\
386 echo "### Done with" `pwd`); \ @@\
389 #define print_target() @@\
393 #define src_target() @@\
398 -$(LN) ${SRCDIR}/$@ $@
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) @@\
409 #define do_subdirs(subdirs) @@\
410 do_subdirs_no_imakefile(subdirs) @@\
413 @echo "### Making Makefiles in" `pwd` @@\
414 @for d in subdirs; \ @@\
416 (cd $$d; echo "### Making Makefile in" `pwd`; \ @@\
417 $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\
418 NEWTOP=../$(BUILDTOP) \ @@\
419 BUILDTOP=../$(BUILDTOP) \ @@\
422 $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\
423 NEWTOP=../$(BUILDTOP) \ @@\
425 echo "### Done with" `pwd`); \ @@\
429 /* Compile Embeded SQL source */
432 #define sqlrule() @@\
433 .SUFFIXES: .sc .dc @@\
435 $(AWK) -f $(SRCTOP)/util/imake.includes/ingres.awk < $< > $*.sc @@\
438 /usr/ingres/bin/esqlc -p $*
439 #define sqlfile(file) @@\
440 concat(file,.sc): concat(file,.dc) @@\
441 concat(file,.c): concat(file,.sc) @@\
443 $(RM) concat(file,.sc) concat(file,.c)
446 #define sqlrule() @@\
447 .SUFFIXES: .ec .dc @@\
449 $(AWK) -f $(SRCTOP)/util/imake.includes/informix.awk < $< > $*.ec @@\
452 /usr/informix/bin/esql -e $*.ec
453 #define sqlfile(file) @@\
454 concat(file,.ec): concat(file,.dc) @@\
455 concat(file,.c): concat(file,.ec) @@\
457 $(RM) concat(file,.ec) concat(file,.c)
460 /* have to undef these to keep the ORADEFS line from being attacked */
465 ORADEFS= DEFINE=HESIOD DEFINE=ZEPHYR DEFINE=GDSS DEFINE=ATHENA
466 #define sqlrule() @@\
467 .SUFFIXES: .pc .dc @@\
469 $(AWK) -f $(SRCTOP)/util/imake.includes/oracle.awk < $< > $*.pc @@\
472 /usr/oracle/bin/proc INAME=$*.pc INCLUDE=$(BUILDTOP)/include INCLUDE=$(BUILDTOP)/lib INCLUDE=$(INCLDIR) $(ORADEFS)
473 #define sqlfile(file) @@\
474 concat(file,.pc): concat(file,.dc) @@\
475 concat(file,.c): concat(file,.pc) @@\
477 $(RM) concat(file,.pc) concat(file,.c)