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)
25 * The MIPS & AIX loaders don't have the -X flag or its functionality.
27 #define library_obj_rule() @@\
29 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
30 $(MV) $*.o profiled/$*.o @@\
31 $(CC) -c $(CFLAGS) $*.c @@\
32 -$(LD) -x -r -o a.out $*.o @@\
34 #else /* ! mips && ! _AIX */
35 #define library_obj_rule() @@\
37 $(CC) PROF_FLAG -c $(CFLAGS) $*.c @@\
38 -$(LD) -X -r -o profiled/$*.o $*.o @@\
39 $(CC) -c $(CFLAGS) $*.c @@\
40 -$(LD) -x -r -o a.out $*.o @@\
44 * cc -R breaks profiling with -p on 4.3BSD on the VAX
45 * (and probably elsewhere), so we don't do it for the profiled version.
48 #define library_ro_object(cfile) @@\
49 concat(cfile,.o): concat(cfile,.c) @@\
50 $(CC) PROF_FLAG -c $(CFLAGS) concat(cfile,.c) @@\
51 -$(LD) -X -r -o profiled/$*.o $*.o @@\
52 $(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
53 -$(LD) -x -r -o a.out $*.o @@\
56 #define library_asm_object(ofile,sfile) @@\
59 $(CPP) -DPROF x.c | $(AS) - @@\
60 -$(LD) -X -r -o profiled/$*.o a.out @@\
61 $(CPP) x.c | $(AS) - @@\
62 -$(LD) -x -r -o $*.o a.out @@\
65 #define install_library_target(libname,objs,srcs,lintlibs) @@\
67 all:: concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\
68 all:: concat3(llib-l,libname,.ln) @@\
70 concat3(lib,libname,.a): objs @@\
73 $(ARCHIVE) $@ objs @@\
76 concat3(lib,libname,_p.a): objs @@\
79 cd profiled; $(ARCHIVE) ../$@ objs @@\
82 lint:: concat3(llib-l,libname,.ln) @@\
84 concat3(llib-l,libname,.ln): srcs @@\
85 $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\
88 $(RM) concat3(lib,libname,.a) concat3(lib,libname,_p.a) @@\
89 $(RM) concat3(llib-l,libname,.ln) @@\
91 $(RM) profiled/?*.o @@\
94 $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
95 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
96 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
97 $(INSTALLRAW) -c -m 644 concat3(lib,libname,_p.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
98 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
99 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,_p.a) @@\
100 $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
102 #else /* !PROFILED_LIBS */
104 * Rule for building objects in libraries.
108 /* When debugging, leave symbols alone (don't do LD) */
109 #define library_obj_rule() @@\
111 $(CC) -c $(CFLAGS) $*.c
113 #define library_obj_rule() @@\
115 $(CC) -c $(CFLAGS) $*.c @@\
116 -$(LD) -x -r -o a.out $*.o @@\
120 #define library_ro_object(cfile) @@\
121 concat(cfile,.o): concat(cfile,.c) @@\
122 $(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
123 -$(LD) -x -r -o a.out $*.o @@\
126 #define library_asm_object(ofile,sfile) @@\
128 $(CPP) x.c | $(AS) - @@\
129 -$(LD) -x -r -o $*.o a.out @@\
132 #define install_library_target(libname,objs,srcs,lintlibs) @@\
134 all:: concat3(lib,libname,.a) @@\
135 all:: concat3(llib-l,libname,.ln) @@\
137 concat3(lib,libname,.a): objs @@\
140 $(ARCHIVE) $@ objs @@\
143 lint:: concat3(llib-l,libname,.ln) @@\
145 concat3(llib-l,libname,.ln): srcs @@\
146 $(LINT) concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srcs lintlibs @@\
149 $(RM) concat3(lib,libname,.a) @@\
150 $(RM) concat3(llib-l,libname,.ln) @@\
154 $(INSTALLRAW) -c -m 644 concat3(lib,libname,.a) concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
155 $(RANLIB) -t concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
156 $(CHMOD) 444 concat4($(DESTDIR)$(LIBDIR)/,lib,libname,.a) @@\
157 $(INSTALLFILE) concat3(llib-l,libname,.ln) concat4($(DESTDIR)$(LINTLIBDIR)/,llib-l,libname,.ln) @@\
159 #endif /* PROFILED_LIBS */
162 * Rule for building utilities (binaries which don't get installed)
164 #define genutil(pgm,objs,localdeps,syslibs) @@\
167 pgm: objs localdeps @@\
168 $(CC) $(CFLAGS) -o $@ objs syslibs @@\
174 * Rule for building "generator" programs.
177 #define generate(file,pgm,libs) @@\
179 pgm: concat(pgm,.c) libs @@\
180 $(HCC) $(HCFLAGS) -o $@ $@.c libs @@\
186 $(RM) file pgm concat(pgm,.o)
188 #define generate_depend(file,pgm,libs) @@\
189 generate(file,pgm,libs) @@\
195 * Rule for building test programs (something which is not installed)
198 #define test(pgm,locallibs,syslibs) @@\
202 pgm: concat(pgm,.c) locallibs @@\
203 $(CC) $(CFLAGS) -o $@ $@.c locallibs syslibs @@\
206 $(RM) pgm concat(pgm,.o) @@\
209 * Rule for compileing files with "et"
212 #define comp_et(tbl) @@\
213 concat(tbl,.h) concat(tbl,.c): concat(tbl,.et) @@\
214 $(COMPILE_ET) concat(tbl,.et) @@\
216 $(RM) concat(tbl,.c) concat(tbl,.h)
218 #define comp_et_depend(src) @@\
221 depend:: concat(src,.h)
223 #define mk_cmds(tbl) @@\
224 concat(tbl,.o): concat(tbl,.ct) @@\
225 $(MAKE_COMMANDS) concat(tbl,.ct) @@\
230 * Rule for building some random object module
233 #define host_simple_object(obj,src) @@\
235 $(HCC) $(HCFLAGS) -c src @@\
240 #define ro_object(obj,src) @@\
242 $(CCRO) $(CFLAGS) -c src @@\
248 * Rule for building some random object module with compile flags and
249 * other dependendcies
252 #define host_flag_object(obj,src,flags,localdeps) @@\
253 obj: src localdeps @@\
254 $(HCC) $(HCFLAGS) flags -c src @@\
259 #define ro_flag_object(obj,src,flags,localdeps) @@\
260 obj: src localdeps @@\
261 $(CCRO) $(CFLAGS) flags -c src @@\
267 * Rule for building some random object module with compile flags, an
268 * intermediate output, and some other dependencies
271 #define host_cplx_object(obj,interim,src,flags,localdeps) @@\
272 obj: interim src localdeps @@\
273 $(HCC) $(HCFLAGS) flags -c src @@\
274 $(MV) interim obj @@\
279 #define ro_cplx_object(obj,interim,src,flags,localdeps) @@\
280 obj: src localdeps interim @@\
281 $(CCRO) $(CFLAGS) flags -c src @@\
282 $(MV) interim obj @@\
288 * Rule for building a program which is to be installed:
291 #define program(pgm,objs,localdeps,syslibs,installdir) @@\
294 pgm: localdeps objs @@\
295 $(CC) $(CFLAGS) -o $@ objs syslibs @@\
298 $(INSTALLPROG) pgm ${DESTDIR}installdir/pgm @@\
304 * Rule for building a specially installed program
307 #define program_spinst(pgm,objs,localdeps,syslibs,installdir,instopts) @@\
310 pgm: objs localdeps @@\
311 $(CC) $(CFLAGS) -o $@ objs syslibs @@\
314 $(INSTALLRAW) instopts pgm ${DESTDIR}installdir/pgm @@\
320 * Rule for installing man pages. Section installing into should match
321 * suffix, or the man page won't show up when using man(1).
324 #define manpage(section,page) @@\
327 $(INSTALLFILE) page concat4(${DESTDIR}${MANDIR}/man,section,/,`basename page`) @@\
330 * Rule for building makefile dependencies.
333 #define depend_target() @@\
335 @echo "### Now computing dependencies" @@\
336 @$(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) @@\
338 #define clean_target() @@\
340 $(RM) *~ \#* *.bak $(TAGSFILE)
342 #define tags_target() @@\
346 #define makefile_target() @@\
348 -$(RM) Makefile.bak; $(MV) Makefile Makefile.bak @@\
349 $(IMAKE) -DNEW_TOP=$(NEWTOP) -s Makefile @@\
351 #define foreach_subdirs(name,subdirs) @@\
353 @for d in subdirs; \ @@\
355 (cd $$d; echo "### Making" name "in" `pwd`; \ @@\
356 $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) name ; \ @@\
357 echo "### Done with" `pwd`); \ @@\
360 #define print_target() @@\
364 #define src_target() @@\
369 -$(LN) ${SRCDIR}/$@ $@
371 #define do_subdirs_no_imakefile(subdirs) @@\
372 foreach_subdirs(all, subdirs) @@\
373 foreach_subdirs(install, subdirs) @@\
374 foreach_subdirs(clean, subdirs) @@\
375 foreach_subdirs(depend, subdirs) @@\
376 foreach_subdirs(tags, subdirs) @@\
377 foreach_subdirs(print, subdirs) @@\
378 foreach_subdirs(src, subdirs) @@\
380 #define do_subdirs(subdirs) @@\
381 do_subdirs_no_imakefile(subdirs) @@\
384 @echo "### Making Makefiles in" `pwd` @@\
385 @for d in subdirs; \ @@\
387 (cd $$d; echo "### Making Makefile in" `pwd`; \ @@\
388 $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\
389 NEWTOP=../$(BUILDTOP) \ @@\
390 BUILDTOP=../$(BUILDTOP) \ @@\
393 $(MAKE) $(MFLAGS) SRCTOP=$(SRCTOP) \ @@\
394 NEWTOP=../$(BUILDTOP) \ @@\
396 echo "### Done with" `pwd`); \ @@\
400 /* Compile Embeded SQL source */
403 #define sqlrule() @@\
404 .SUFFIXES: .sc .dc @@\
406 $(AWK) -f $(SRCTOP)/util/imake.includes/ingres.awk < $< > $*.sc @@\
409 /usr/rtingres/bin/esqlc -p $*
410 #define sqlfile(file) @@\
411 concat(file,.sc): concat(file,.dc) @@\
412 concat(file,.c): concat(file,.sc) @@\
414 $(RM) concat(file,.sc) concat(file,.c)
417 #define sqlrule() @@\
418 .SUFFIXES: .ec .dc @@\
420 $(AWK) -f $(SRCTOP)/util/imake.includes/informix.awk < $< > $*.ec @@\
423 /usr/informix/bin/esql -e $*.ec
424 #define sqlfile(file) @@\
425 concat(file,.ec): concat(file,.dc) @@\
426 concat(file,.c): concat(file,.ec) @@\
428 $(RM) concat(file,.ec) concat(file,.c)
431 #define sqlrule() @@\
432 .SUFFIXES: .pc .dc @@\
434 $(AWK) -f $(SRCTOP)/util/imake.includes/oracle.awk < $< > $*.pc @@\
437 /usr/oracle/bin/pcc INAME=$*.pc
438 #define sqlfile(file) @@\
439 concat(file,.pc): concat(file,.dc) @@\
440 concat(file,.c): concat(file,.pc) @@\
442 $(RM) concat(file,.pc) concat(file,.c)