Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | [This Index is automatically generated from Jmake.rules file. Do not |
2 | edit this file or your changes will be lost. Edit Jmake.rules instead.] | |
3 | ||
4 | This file contains a listing of all the macros that can be used in a | |
5 | Jmakefile. Only a few of these should be used in the Jmakefile (they | |
6 | are the top-level macros). However, some low-level ones may be useful, | |
7 | but it is up to you to make that decision. This explains why this file | |
8 | holds all the available macros for jmake. | |
9 | ||
10 | In the following listing, the macros are separated by a line of dashes. | |
11 | The signature of the macro is given, then a small comment of what it | |
12 | does precedes the actual definition. | |
13 | ||
14 | Lines preceded by '->' show the set of symbols defined when the macro is | |
15 | used. Initialization lines are shown as-is, i.e. have the form SYM = val | |
16 | while concatenation is shown by SYM += val (which means val is added to | |
17 | the value of SYM). | |
18 | ||
19 | Conditional lines are preceded by tests like (if SYM). This means the line | |
20 | is to be kept if and only if the symbol SYM is defined. Other internal | |
21 | requests are not formatted yet. | |
22 | ||
23 | ------------------------------------------------------------------------ | |
24 | AddSuffix(ext): | |
25 | Adds a sufix to the .SUFFIXES: list. | |
26 | ||
27 | .SUFFIXES: ext | |
28 | ||
29 | ------------------------------------------------------------------------ | |
30 | AddedByConfigure(files): | |
31 | Gives name of the files generated by Configure that can safely | |
32 | be removed when a "make clobber" is issued. Not that it is useless | |
33 | to name config.h or config.sh because these are already taken care | |
34 | of by jmake. | |
35 | ||
36 | local_clobber:: | |
37 | $(RM) files | |
38 | ||
39 | ------------------------------------------------------------------------ | |
40 | AliasedLibraryTarget(libname,alias): | |
41 | Generate rules to link one library to another. | |
42 | ||
43 | AllTarget(lib/**/alias.a) | |
44 | ||
45 | lib/**/alias.a: lib^^libname.a | |
46 | $(RM) $@ | |
47 | $(LN) lib/**/libname.a $@ | |
48 | ||
49 | ------------------------------------------------------------------------ | |
50 | AllTarget(depends): | |
51 | Generate rules to build necessary things during make all. | |
52 | ||
53 | all:: depends | |
54 | ||
55 | local_realclean:: | |
56 | $(RM) depends | |
57 | ||
58 | ------------------------------------------------------------------------ | |
59 | BuildMakefile(): | |
60 | Generate rules to build a Makefile from a Makefile.SH. | |
61 | ||
62 | Makefile: Makefile.SH | |
63 | /bin/sh Makefile.SH | |
64 | ||
65 | ------------------------------------------------------------------------ | |
66 | BuildMakefileSH(jmakeflags): | |
67 | Generate rules to build a Makefile.SH from an Jmakefile and any | |
68 | special jmake flags. This is generally done automatically by the | |
69 | template or by any special Jmakefiles. | |
70 | This function will simply touch Makefile.SH if no $(TOP)/.package | |
71 | exists, assuming the Jmakefile is not in a production environment. | |
72 | ||
73 | Makefile.SH: Jmakefile | |
74 | -@if test -f $(TOP)/.package; then \ | |
75 | if test -f Makefile.SH; then \ | |
76 | echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ | |
77 | $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ | |
78 | fi; \ | |
79 | echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" jmakeflags; \ | |
80 | $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) jmakeflags; \ | |
81 | else touch $@; fi | |
82 | ||
83 | ------------------------------------------------------------------------ | |
84 | CleanSubdirs(): | |
85 | Generate rules to recursively clean out garbage files. | |
86 | ||
87 | NamedDepthTargetSubdirs(clean,"Cleaning",/**/) | |
88 | NamedDepthTargetSubdirs(realclean,"Real cleaning",/**/) | |
89 | NamedDepthTargetSubdirs(clobber,"Clobbering",/**/) | |
90 | ||
91 | ------------------------------------------------------------------------ | |
92 | CleanTarget(): | |
93 | Generate rules to remove any garbage files. | |
94 | ||
95 | (if SUBDIRS) clean: sub_clean local_clean | |
96 | (not SUBDIRS) clean: local_clean | |
97 | (if SUBDIRS) realclean: sub_realclean local_realclean | |
98 | (not SUBDIRS) realclean: local_realclean | |
99 | (if SUBDIRS) clobber: sub_clobber local_clobber | |
100 | (not SUBDIRS) clobber: local_clobber | |
101 | ||
102 | local_clean:: | |
103 | if test -f core; then $(RM) core; fi | |
104 | $(RM) *~ *.o | |
105 | ||
106 | local_realclean:: local_clean | |
107 | (if TOP) $(RM) -r UU | |
108 | ||
109 | local_clobber:: local_realclean | |
110 | (not TOP) $(RM) Makefile config.sh | |
111 | (if TOP) $(RM) config.sh config.h | |
112 | (if TOP) $(RM) -r .config | |
113 | (if TOP) $(RM) Makefile | |
114 | ||
115 | ------------------------------------------------------------------------ | |
116 | CommonSubdirsRule(dirs): | |
117 | Rule for making $(TARGET) in every subdirectory, with $(VERB) as | |
118 | verbose message and $(FLAGS) as additional flags. | |
119 | ||
120 | subdirs: | |
121 | @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ | |
122 | for i in dirs ;\ | |
123 | do \ | |
124 | (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \ | |
125 | $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)) || exit 1; \ | |
126 | done | |
127 | ||
128 | ------------------------------------------------------------------------ | |
129 | ComplexProgramTarget(program): | |
130 | Generate rules for compiling and linking the program specified by | |
131 | $(OBJS) and $(SRCS), installing the program and its man page, and | |
132 | generating dependencies. It should only be used in Jmakefiles | |
133 | that describe a single program. | |
134 | ||
135 | OBJECTS += $(OBJS) | |
136 | SOURCES += $(SRCS) | |
137 | ||
138 | NormalObjectRule() | |
139 | AllTarget(program) | |
140 | ||
141 | program: $(OBJS) | |
142 | RemoveTargetProgram($@) | |
143 | $(CC) -o $@ $(OBJS) $(JLDFLAGS) $(LIBS) | |
144 | ||
145 | InstallProgram(program,$(BINDIR)) | |
146 | InstallManPage(program,$(MANSRC)) | |
147 | DependTarget() | |
148 | LintTarget() | |
149 | ||
150 | ------------------------------------------------------------------------ | |
151 | ComplexProgramTarget_1(program): | |
152 | Generate rules for compiling and linking the program specified by | |
153 | $(OBJS1) and $(SRCS1), installing the program and its man page, | |
154 | and generating dependencies for it and any programs described by | |
155 | $(SRCS2) and $(SRCS3). It should be used to build the primary | |
156 | program in Jmakefiles that describe multiple programs. | |
157 | ||
158 | OBJECTS += $(OBJS1) | |
159 | SOURCES += $(SRCS1) | |
160 | ||
161 | NormalObjectRule() | |
162 | AllTarget(program) | |
163 | ||
164 | program: $(OBJS1) | |
165 | RemoveTargetProgram($@) | |
166 | $(CC) -o $@ $(OBJS1) $(JLDFLAGS) $(LIBS) | |
167 | ||
168 | InstallProgram(program,$(BINDIR)) | |
169 | InstallManPage(program,$(MANSRC)) | |
170 | ||
171 | DependTarget() | |
172 | LintTarget() | |
173 | ||
174 | ------------------------------------------------------------------------ | |
175 | ComplexProgramTarget_2(program): | |
176 | Generate rules for compiling and linking the program specified by | |
177 | $(OBJS2) and $(SRCS2) and installing the program and man page. | |
178 | It should be used to build the second program in Jmakefiles | |
179 | describing more than one program. | |
180 | ||
181 | OBJECTS += $(OBJS2) | |
182 | SOURCES += $(SRCS2) | |
183 | ||
184 | NormalObjectRule() | |
185 | AllTarget(program) | |
186 | ||
187 | program: $(OBJS2) | |
188 | RemoveTargetProgram($@) | |
189 | $(CC) -o $@ $(OBJS2) $(JLDFLAGS) $(LIBS) | |
190 | ||
191 | InstallProgram(program,$(BINDIR)) | |
192 | InstallManPage(program,$(MANSRC)) | |
193 | ||
194 | ------------------------------------------------------------------------ | |
195 | ComplexProgramTarget_3(program): | |
196 | Generate rules for compiling and linking the program specified by | |
197 | $(OBJS3) and $(SRCS3) and installing the program and man page. It | |
198 | should be used to build the third program in Jmakefiles describing | |
199 | more than one program. | |
200 | ||
201 | OBJECTS += $(OBJS3) | |
202 | SOURCES += $(SRCS3) | |
203 | ||
204 | NormalObjectRule() | |
205 | AllTarget(program) | |
206 | ||
207 | program: $(OBJS3) | |
208 | RemoveTargetProgram($@) | |
209 | $(CC) -o $@ $(OBJS3) $(JLDFLAGS) $(LIBS) | |
210 | ||
211 | InstallProgram(program,$(BINDIR)) | |
212 | InstallManPage(program,$(MANSRC)) | |
213 | ||
214 | ------------------------------------------------------------------------ | |
215 | ComplexShellManualTarget(manpages): | |
216 | Builds manual pages that are to be extracted from .SH files into | |
217 | .$manext files. | |
218 | ||
219 | MANPAGE += manpages | |
220 | ||
221 | |once _ShellManualRule_ | |
222 | .SH.$manext: | |
223 | /bin/sh $< | |
224 | ||
225 | -once | |
226 | AddSuffix(.SH) | |
227 | AddSuffix(.$manext) | |
228 | AllTarget(manpages) | |
229 | ||
230 | local_install.man:: | |
231 | _MakeInstallDirIgnore($(MANSRC)) \ | |
232 | for file in manpages; do \ | |
233 | (set -x; $(INSTALL) -c -m 444 $$file \ | |
234 | $(INSTALL_PREFIX)$(MANSRC)) || exit 1; \ | |
235 | done | |
236 | ||
237 | local_deinstall.man:: | |
238 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
239 | for file in manpages; do \ | |
240 | (set -x; $(RM) $(INSTALL_PREFIX)$(MANSRC)/$$file); \ | |
241 | done | |
242 | ||
243 | ------------------------------------------------------------------------ | |
244 | ComplexYaccInclude(base,prefix): | |
245 | Declare that program will need an include file produced by | |
246 | the output of yacc on base.y, which typically produces a file | |
247 | named y.tab.h, which will be renamed as base.h. | |
248 | The difference with SimpleYaccInclude is the identifying process | |
249 | of the y.tab.h file where all 'yy' are renamed to prefix. | |
250 | The only problem is that the dependencies towards base.h have | |
251 | to be manually given in the Jmakefile. | |
252 | ||
253 | base.h: base.c | |
254 | @if test -f y.tab.h; then \ | |
255 | echo " $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h"; \ | |
256 | $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h; \ | |
257 | echo " $(RM) y.tab.h"; \ | |
258 | $(RM) y.tab.h; \ | |
259 | elif test -f base.h; then \ | |
260 | echo " $(CP) base.h base.ht"; \ | |
261 | $(CP) base.h base.ht; \ | |
262 | echo " $(SED) -e 's/yy\(.\)/prefix\1/g' < base.ht > base.h"; \ | |
263 | $(SED) -e 's/yy\(.\)/prefix\1/g' < base.ht > base.h; \ | |
264 | echo " $(RM) base.ht"; \ | |
265 | $(RM) base.ht; \ | |
266 | fi | |
267 | ||
268 | local_realclean:: | |
269 | $(RM) base.h | |
270 | ||
271 | ------------------------------------------------------------------------ | |
272 | ComplexYaccTarget(program,base,prefix): | |
273 | Declare a yacc base.y file to be used in the building of the | |
274 | specified target program. The source file must be given without | |
275 | its final .y extension. The name of the .c and .o will be | |
276 | derived from the source file basename provided. | |
277 | The difference with SimpleYaccTarget is the identifying process | |
278 | where all the 'yy' are replaced by the specified prefix. | |
279 | ||
280 | SOURCES += base.y | |
281 | OBJECTS += base.o | |
282 | ||
283 | program: base.c | |
284 | ||
285 | base.c: base.y | |
286 | $(YACC) $(JYFLAGS) base.y | |
287 | $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.c > base.c | |
288 | $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h | |
289 | $(RM) y.tab.c y.tab.h | |
290 | ||
291 | local_realclean:: | |
292 | $(RM) base.c | |
293 | ||
294 | ------------------------------------------------------------------------ | |
295 | CppScriptTarget(dst,src,defs,deplist): | |
296 | Generate rules to create a shell script by running the input | |
297 | through cpp. | |
298 | ||
299 | dst:: src deplist | |
300 | $(RM) $@ | |
301 | $(CPP) defs <src | \ | |
302 | sed -e '/^# *[0-9][0-9]* *.*$$/d' >$@ | |
303 | chmod a+x $@ | |
304 | ||
305 | ------------------------------------------------------------------------ | |
306 | DebuggedAndProfiledLibraryObjectRule(): | |
307 | Generate make rules to build debuggable, profiled, and "normal" | |
308 | objects. | |
309 | ||
310 | all:: | |
311 | @if [ ! -d profiled ]; then mkdir profiled; fi | |
312 | @if [ ! -d debugger ]; then mkdir debugger; fi | |
313 | ||
314 | .c.o: | |
315 | $(RM) $@ profiled/$@ debugger/$@ | |
316 | $(CC) -pg -c $(JCFLAGS) $*.c | |
317 | $(MV) $*.o profiled/$*.o | |
318 | $(CC) -g -c $(JCFLAGS) $*.c | |
319 | $(MV) $*.o debugger/$*.o | |
320 | $(CC) -c $(JCFLAGS) $*.c | |
321 | ||
322 | local_clean:: | |
323 | -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ | |
324 | $(RM) profiled/?*.o; fi | |
325 | -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ | |
326 | $(RM) debugger/?*.o; fi | |
327 | ||
328 | ------------------------------------------------------------------------ | |
329 | DebuggedLibraryObjectRule(): | |
330 | Generate make rules to build both debuggable and "normal" | |
331 | objects. | |
332 | ||
333 | all:: | |
334 | @if [ ! -d debugger ]; then mkdir debugger; fi | |
335 | ||
336 | .c.o: | |
337 | $(RM) $@ debugger/$@ | |
338 | $(CC) -g -c $(JCFLAGS) $*.c | |
339 | $(MV) $*.o debugger/$*.o | |
340 | $(CC) -c $(JCFLAGS) $*.c | |
341 | ||
342 | local_clean:: | |
343 | -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ | |
344 | $(RM) debugger/?*.o; fi | |
345 | ||
346 | ------------------------------------------------------------------------ | |
347 | DebuggedLibraryTarget(libname,srclist,objlist): | |
348 | Generate rules to create a debuggable library. | |
349 | ||
350 | SOURCES += srclist | |
351 | OBJECTS += objlist | |
352 | ||
353 | AllTarget(lib/**/libname^^_d.a) | |
354 | ||
355 | lib/**/libname^^_d.a: objlist | |
356 | $(RM) $@ | |
357 | cd debugger; $(AR) ../$@ objlist | |
358 | $(RANLIB) $@ | |
359 | ||
360 | ------------------------------------------------------------------------ | |
361 | DebuggedRelocatableTarget(objname,objlist): | |
362 | Generate rules to produce a debuggable relocatable object file | |
363 | instead of a library. | |
364 | ||
365 | AllTarget(objname/**/_d.o) | |
366 | ||
367 | objname/**/_d.o: objlist | |
368 | $(RM) $@ | |
369 | $(LD) -X -r objlist -o $@ | |
370 | ||
371 | ------------------------------------------------------------------------ | |
372 | DeinstallMultipleDest(step,list,dest): | |
373 | Generate rules to deinstall multiple files at once during a particular | |
374 | step in the build. | |
375 | ||
376 | step:: | |
377 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
378 | for i in list; do \ | |
379 | (set -x; $(RM) $(INSTALL_PREFIX)/***/dest/$$i); \ | |
380 | done | |
381 | ||
382 | ------------------------------------------------------------------------ | |
383 | DependDependency(): | |
384 | Generate rules to build the makedepend program. | |
385 | ||
386 | depend:: TOPDIR/mkdep | |
387 | ||
388 | TOPDIR/mkdep: | |
389 | (if TOP) @echo "You have to run Configure first."; exit 1 | |
390 | (not TOP) @echo "You have to run Configure in $(TOP) first."; exit 1 | |
391 | ||
392 | ------------------------------------------------------------------------ | |
393 | DependDirs(dirs): | |
394 | Generate rules to recursively compute dependencies as part of the | |
395 | make depend step. | |
396 | ||
397 | NamedTargetSubdirsRule(dirs,depend,"Depending",/**/) | |
398 | ||
399 | ------------------------------------------------------------------------ | |
400 | DependSubdirs(): | |
401 | Generate rules to recursively compute dependencies as part of the | |
402 | make depend step. | |
403 | ||
404 | DependDirs($(SUBDIRS)) | |
405 | ||
406 | ------------------------------------------------------------------------ | |
407 | DependTarget(): | |
408 | Generate rules to compute dependencies for all files listed | |
409 | in $(SOURCES) (automatically generated macro). | |
410 | ||
411 | USRINC = $usrinc | |
412 | ||
413 | |once _DependTarget_ | |
414 | DependDependency() | |
415 | ||
416 | depend:: | |
417 | ($(SED) '/^# DO NOT DELETE/q' Makefile && \ | |
418 | $(MKDEP) $(SOURCES) | \ | |
419 | $(SED) -e 's:/usr/lib[^ ]*::g; s:$(USRINC)[^ ]*::g; ' \ | |
420 | -e '/: / b print' -e '$$ b print' -e 'H; d; n; : print' \ | |
421 | -e 'x; s/\\$$//; s/\\\n//g; s/ /**/ */ /g; s/ :/:/;' -e '/: *$$/d' \ | |
422 | ) > Makefile.new | |
423 | cp Makefile Makefile.bak | |
424 | cp Makefile.new Makefile | |
425 | $(RM) Makefile.new | |
426 | ||
427 | -once | |
428 | ||
429 | ------------------------------------------------------------------------ | |
430 | Expand(rule, pattern): | |
431 | This powerful macro expands the `rule' given a `pattern'. It | |
432 | relies on a built-in command in jmake. The expansion is | |
433 | documented in the short notes file that comes with jmake and | |
434 | gives some insights on the internal syntax. | |
435 | ||
436 | |expand pattern | |
437 | rule | |
438 | -expand | |
439 | ||
440 | ------------------------------------------------------------------------ | |
441 | ForceTarget(): | |
442 | The force target will force reconstruction of all the other | |
443 | targets which include .FORCE in their own dependencies. | |
444 | ||
445 | |once _force_ | |
446 | .FORCE: | |
447 | ||
448 | -once | |
449 | ||
450 | ------------------------------------------------------------------------ | |
451 | IdentifiedLexDependTarget(program,base,parser,prefix): | |
452 | Declare that program will need an include file produced by | |
453 | the output of lex on base.l, which typically produces a file | |
454 | named lex.yy.c which will be renamed as base.c. Besides, the | |
455 | lexical analyzer needs the file parser.h produced by running | |
456 | parser.y through yacc and renaming y.tab.h as parser.h. | |
457 | The lexical analyzer is identified with the supplied prefix, | |
458 | which replaces the regular 'yy' prefix in the symbol names. | |
459 | ||
460 | base.o: parser.h | |
461 | ||
462 | IdentifiedLexTarget(program,base,prefix) | |
463 | ||
464 | ------------------------------------------------------------------------ | |
465 | IdentifiedLexTarget(program,base,prefix): | |
466 | This declares a lex base.l file which is to be ran through | |
467 | lex to produce a base.c file. The prefix is used to replace | |
468 | the 'yy', so that the lexical analyzer may be identified. | |
469 | ||
470 | SOURCES += base.l | |
471 | OBJECTS += base.o | |
472 | ||
473 | program: base.c | |
474 | ||
475 | base.c: base.l | |
476 | $(LEX) $(JLFLAGS) base.l | |
477 | $(SED) -e 's/yy\(.\)/prefix\1/g' < lex.yy.c > base.c | |
478 | $(RM) lex.yy.c | |
479 | ||
480 | local_realclean:: | |
481 | $(RM) base.c | |
482 | ||
483 | ------------------------------------------------------------------------ | |
484 | IdentifiedParserTarget(program,lexic,parser,prefix): | |
485 | Specify that program is using the lex/yacc combination to | |
486 | produce a parser. The lexic and parser parameters are the | |
487 | base name of the .l and .y file, respectively. The parser | |
488 | produced is identified via its prefix, which replaces all | |
489 | the normally supplied 'yy' prefix, hence making it possible | |
490 | to have multiple parsers in a single executable. | |
491 | ||
492 | IdentifiedLexDependTarget(program,lexic,parser,prefix) | |
493 | IdentifiedYaccTarget(program,parser,prefix) | |
494 | ||
495 | ------------------------------------------------------------------------ | |
496 | IdentifiedYaccTarget(program,base,prefix): | |
497 | Declare a yacc base.y file which should produce a base.c and | |
498 | base.h file as derived from the output of yacc, to be used by | |
499 | the specified program. The specified prefix is used to remplace | |
500 | all the 'yy' in the generated file, for use when more than a | |
501 | single parser is needed in one executable. | |
502 | ||
503 | ComplexYaccTarget(program,base,prefix) | |
504 | ComplexYaccInclude(base,prefix) | |
505 | ||
506 | ------------------------------------------------------------------------ | |
507 | IncludesSubdirs(): | |
508 | Generate rules to recursively put include files in build | |
509 | ||
510 | NamedTargetSubdirs(includes,including,/**/) | |
511 | ||
512 | ------------------------------------------------------------------------ | |
513 | Initialize(symbol,value): | |
514 | Puts the line symbol = value in the initialization section of | |
515 | Makefile.SH (the one that is subject to parameter substitutions). | |
516 | ||
517 | symbol = value | |
518 | ||
519 | ------------------------------------------------------------------------ | |
520 | InstallLibrary(libname,dest): | |
521 | Generate rules to install the indicated library. | |
522 | ||
523 | local_install:: lib/**/libname.a | |
524 | _MakeInstallDirIgnore(dest) \ | |
525 | $(INSTALL) -c -m 644 lib/**/libname.a $(INSTALL_PREFIX)/***/dest | |
526 | $(RANLIB) dest/lib/**/libname.a | |
527 | chmod 444 dest/lib/**/libnane.a | |
528 | ||
529 | local_deinstall:: | |
530 | $(RM) $(INSTALL_PREFIX)/***/dest/lib/**/libname.a | |
531 | ||
532 | ------------------------------------------------------------------------ | |
533 | InstallLibraryAlias(libname,alias,dest): | |
534 | Generate rules to create a link from one library name to another | |
535 | for the purposes of aliasing. | |
536 | ||
537 | local_install:: lib/**/libname.a | |
538 | $(RM) lib/**/alias.a | |
539 | -(cd dest; $(LN) lib/**/libname.a lib^^alias.a) | |
540 | ||
541 | local_deinstall:: | |
542 | $(RM) dest/lib/**/alias.a | |
543 | ||
544 | ------------------------------------------------------------------------ | |
545 | InstallLintLibrary(libname,dest): | |
546 | Generate rules to install the indicated lint library. | |
547 | ||
548 | install.ln:: llib-l/**/libname.ln | |
549 | _MakeInstallDirIgnore(dest) \ | |
550 | $(INSTALL) -c -m 444 llib-l/**/libname.ln $(INSTALL_PREFIX)/***/dest | |
551 | ||
552 | deinstall.ln:: | |
553 | $(RM) $(INSTALL_PREFIX)/***/dest/llib-l/**/libname.ln | |
554 | ||
555 | ------------------------------------------------------------------------ | |
556 | InstallManPage(file,dest): | |
557 | Generate rules to install the indicated manual page. | |
558 | ||
559 | InstallManPageLong(file,dest,file) | |
560 | ||
561 | ------------------------------------------------------------------------ | |
562 | InstallManPageLong(file,destdir,dest): | |
563 | Generate rules to install the indicated manual page, giving it an | |
564 | alternate name. This is used for installing man pages whose base | |
565 | name without the .man suffix would normally be longer than 8 | |
566 | characters (the limit for using source code control systems on | |
567 | files systems with short file names). | |
568 | ||
569 | local_install.man:: file.man | |
570 | _MakeInstallDirIgnore(destdir) \ | |
571 | $(INSTALL) -c -m 444 file.man $(INSTALL_PREFIX)/***/destdir/dest.$(L) | |
572 | ||
573 | local_deinstall.man:: | |
574 | $(RM) $(INSTALL_PREFIX)/***/destdir/dest.$(L) | |
575 | ||
576 | ------------------------------------------------------------------------ | |
577 | InstallManScripts(): | |
578 | Generate rule to install/deinstall manual pages for scripts listed | |
579 | in the automatically generated $(SCRIPTS) macro. | |
580 | ||
581 | |once _InstallManScripts_ | |
582 | #ifndef NOMAN | |
583 | local_install.man:: | |
584 | _MakeInstallDirIgnore($(MANSRC)) \ | |
585 | for file in $(SCRIPTS); do \ | |
586 | if test -f $$file.man; then \ | |
587 | (set -x; \ | |
588 | $(INSTALL) -c -m 444 $$file.man \ | |
589 | $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)) || \ | |
590 | exit 1; \ | |
591 | fi; \ | |
592 | done | |
593 | ||
594 | local_deinstall.man:: | |
595 | case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
596 | for file in $(SCRIPTS); do \ | |
597 | (set -x; $(RM) $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)); \ | |
598 | done | |
599 | ||
600 | #endif | |
601 | -once | |
602 | ||
603 | ------------------------------------------------------------------------ | |
604 | InstallManSubdirs(): | |
605 | Generate rules to recursively install and deinstall manual pages. | |
606 | ||
607 | NamedSubTargetSubdirs(install.man,"Installing man pages",/**/) | |
608 | NamedDepthTargetSubdirs(deinstall.man,"Deinstalling man pages",/**/) | |
609 | ||
610 | ------------------------------------------------------------------------ | |
611 | InstallMultiple(list,dest): | |
612 | Generate rules to install multiple files at once during the install | |
613 | step of the build using any install flags set in $(INSTALLFLAGS) | |
614 | and deinstall them. | |
615 | ||
616 | InstallMultipleDestFlags(local_install,list,dest,$(INSTALLFLAGS)) | |
617 | DeinstallMultipleDest(local_deinstall,list,dest) | |
618 | ||
619 | ------------------------------------------------------------------------ | |
620 | InstallMultipleDestFlags(step,list,dest,flags): | |
621 | Generate rules to install multiple files at once during a particular | |
622 | step in the build using a specific set of install flags. | |
623 | ||
624 | step:: list | |
625 | _MakeInstallDirIgnore(dest) \ | |
626 | for i in list; do \ | |
627 | (set -x; $(INSTALL) -c flags \ | |
628 | $$i $(INSTALL_PREFIX)/***/dest) || exit 1;\ | |
629 | done | |
630 | ||
631 | ------------------------------------------------------------------------ | |
632 | InstallMultipleFlags(list,dest,flags): | |
633 | Generate rules to install multiple files at once during the | |
634 | install step of the build using the given install flags. | |
635 | ||
636 | InstallMultipleDestFlags(local_install,list,dest,flags) | |
637 | DeinstallMultipleDest(local_deinstall,list,dest) | |
638 | ||
639 | ------------------------------------------------------------------------ | |
640 | InstallMultipleMan(list,dest): | |
641 | Generate rules to install a variety of manual pages | |
642 | during the install.man step of the build. | |
643 | ||
644 | InstallMultipleDestFlags(local_install.man,list,dest,$(INSTALLFLAGS)) | |
645 | DeinstallMultipleDest(local_deinstall.man,list,dest) | |
646 | ||
647 | ------------------------------------------------------------------------ | |
648 | InstallNonExec(file,dest): | |
649 | Generate rules to install a data file using any special | |
650 | install flags. | |
651 | ||
652 | local_install:: file | |
653 | _MakeInstallDirIgnore(dest) \ | |
654 | $(INSTALL) -c -m 444 file $(INSTALL_PREFIX)/***/dest | |
655 | ||
656 | local_deinstall:: | |
657 | $(RM) $(INSTALL_PREFIX)/***/dest/file | |
658 | ||
659 | ------------------------------------------------------------------------ | |
660 | InstallProgram(program,dest): | |
661 | Generate rules to install an executable program using any special | |
662 | install flags set in $(INSTALLFLAGS). | |
663 | ||
664 | InstallProgramWithFlags(program,dest,/**/) | |
665 | ||
666 | ------------------------------------------------------------------------ | |
667 | InstallProgramNoStrip(program,dest): | |
668 | Generate rules to install an executable program using any special | |
669 | install flags set in $(INSTALLFLAGS), but without stripping the | |
670 | executable from debugging symbols. | |
671 | ||
672 | InstallProgramNoStripWithFlags(program,dest,/**/) | |
673 | ||
674 | ------------------------------------------------------------------------ | |
675 | InstallProgramNoStripWithFlags(program,dest,flags): | |
676 | Generate rules to install an executable program using given | |
677 | install flags. | |
678 | ||
679 | local_install:: program | |
680 | _MakeInstallDirIgnore(dest) \ | |
681 | $(INSTALL) -c -m 555 flags program/***/$(_EXE) $(INSTALL_PREFIX)/**/^dest | |
682 | ||
683 | local_deinstall:: | |
684 | $(RM) $(INSTALL_PREFIX)/***/dest/program/**/^$(_EXE) | |
685 | ||
686 | ------------------------------------------------------------------------ | |
687 | InstallProgramWithFlags(program,dest,flags): | |
688 | Generate rules to install an executable program using given | |
689 | install flags. | |
690 | ||
691 | local_install:: program | |
692 | _MakeInstallDirIgnore(dest) \ | |
693 | $(INSTALL) -c -s -m 555 flags program/***/$(_EXE) $(INSTALL_PREFIX)/**/^dest | |
694 | ||
695 | local_deinstall:: | |
696 | $(RM) $(INSTALL_PREFIX)/***/dest/program/**/^$(_EXE) | |
697 | ||
698 | ------------------------------------------------------------------------ | |
699 | InstallScript(script,dest): | |
700 | Generate rules to install an executable script using any special | |
701 | install flags set in $(INSTALLFLAGS). | |
702 | ||
703 | InstallScriptWithFlags(script,dest,/**/) | |
704 | ||
705 | ------------------------------------------------------------------------ | |
706 | InstallScriptWithFlags(script,dest,flags): | |
707 | Generate rules to install an executable script using given | |
708 | install flags. | |
709 | ||
710 | local_install:: script | |
711 | _MakeInstallDirIgnore(dest) \ | |
712 | $(INSTALL) -c -m 555 flags script $(INSTALL_PREFIX)/***/dest | |
713 | ||
714 | local_deinstall:: | |
715 | $(RM) $(INSTALL_PREFIX)/***/dest/script | |
716 | ||
717 | ------------------------------------------------------------------------ | |
718 | InstallScripts(): | |
719 | Generate rules to install all the scripts listed in the generated | |
720 | $(SCRIPTS) and $(LSCRIPTS) macros. | |
721 | ||
722 | |once _InstallScripts_ | |
723 | local_install:: $(SCRIPTS) $(LSCRIPTS) | |
724 | _MakeInstallDirIgnore($(SCRIPTDIR)) \ | |
725 | for file in $(SCRIPTS) $(LSCRIPTS); do \ | |
726 | (set -x; \ | |
727 | $(INSTALL) -c -m 555 $$file $(INSTALL_PREFIX)$(SCRIPTDIR)) || \ | |
728 | exit 1; \ | |
729 | done | |
730 | ||
731 | local_deinstall:: | |
732 | @for file in $(SCRIPTS) $(LSCRIPTS); do \ | |
733 | case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
734 | (set -x; $(RM) $(INSTALL_PREFIX)$(SCRIPTDIR)/$$file); \ | |
735 | done | |
736 | -once | |
737 | ||
738 | ------------------------------------------------------------------------ | |
739 | InstallSharedLibrary(libname,rev,dest): | |
740 | Generate rules to install the shared library. | |
741 | ||
742 | local_install:: lib/**/libname.so.rev | |
743 | _MakeInstallDirIgnore(dest) \ | |
744 | $(INSTALL) -c -m 444 lib/**/libname.so.rev $(INSTALL_PREFIX)/***/dest | |
745 | ||
746 | local_deinstall:: | |
747 | $(RM) $(INSTALL_PREFIX)/***/dest/lib/**/libname.so.rev | |
748 | ||
749 | ------------------------------------------------------------------------ | |
750 | InstallSharedLibraryData(libname,rev,dest): | |
751 | Generate rules to install the shared library data | |
752 | ||
753 | local_install:: lib/**/libname.sa.rev | |
754 | _MakeInstallDirIgnore(dest) \ | |
755 | $(INSTALL) -c -m 444 lib/**/libname.sa.rev $(INSTALL_PREFIX)/***/dest | |
756 | ||
757 | local_deinstall:: | |
758 | $(RM) $(INSTALL_PREFIX)/***/dest/lib/**/libname.sa.rev | |
759 | ||
760 | ------------------------------------------------------------------------ | |
761 | InstallSubdirs(): | |
762 | Generate rules to recursively install and deinstall programs and | |
763 | files. | |
764 | ||
765 | NamedSubTargetSubdirs(install,"Installing",/**/) | |
766 | NamedDepthTargetSubdirs(deinstall,"Deinstalling",/**/) | |
767 | ||
768 | ------------------------------------------------------------------------ | |
769 | InstallTarget(): | |
770 | Generate rules to recursively install files | |
771 | ||
772 | (if SUBDIRS) install:: local_install sub_install | |
773 | (not SUBDIRS) install:: local_install | |
774 | (if SUBDIRS) install.man:: maybe_install.man sub_install.man | |
775 | (not SUBDIRS) install.man:: maybe_install.man | |
776 | (if SUBDIRS) deinstall:: sub_deinstall local_deinstall | |
777 | (not SUBDIRS) deinstall:: local_deinstall | |
778 | (if SUBDIRS) deinstall.man:: sub_deinstall.man maybe_deinstall.man | |
779 | (not SUBDIRS) deinstall.man:: maybe_deinstall.man | |
780 | ||
781 | (if MANSRC) install.man-yes: local_install.man | |
782 | install.man-no: | |
783 | (if MANSRC) deinstall.man-yes: local_deinstall.man | |
784 | deinstall.man-no: | |
785 | ||
786 | ------------------------------------------------------------------------ | |
787 | LinkFileList(step,list,dir,sub): | |
788 | Link a list of list of files from one place to another | |
789 | ||
790 | step:: list | |
791 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
792 | echo " cd" dir; cd dir; for i in list; do (set -x; $(LN) sub/$$i .); done | |
793 | ||
794 | ------------------------------------------------------------------------ | |
795 | LinkSourceFile(src,dir): | |
796 | Snag source file from some other directory | |
797 | ||
798 | src: dir/src | |
799 | $(RM) $@ | |
800 | $(LN) $? $@ | |
801 | ||
802 | ------------------------------------------------------------------------ | |
803 | LintDirs(dirs): | |
804 | Generate rules to recursively lint directories as part of the | |
805 | make lint step. | |
806 | ||
807 | MakeLintSubdirs(dirs,lint) | |
808 | ||
809 | ------------------------------------------------------------------------ | |
810 | LintLibraryTarget(libname,srclist): | |
811 | Generate rules to create a lint library. Note that the lint | |
812 | library is always forced to be newer than the library itself. | |
813 | ||
814 | lintlib:: llib-l/**/libname.ln | |
815 | ||
816 | llib-l/**/libname.ln: srclist | |
817 | $(RM) $@ | |
818 | $(LINT) $(LINTLIBFLAG)/**/libname $(LINTFLAGS) srclist | |
819 | ||
820 | ------------------------------------------------------------------------ | |
821 | LintSubdirs(): | |
822 | Generate rules to recursively lint directories as part of the | |
823 | make lint step. | |
824 | ||
825 | LintDirs($(SUBDIRS)) | |
826 | ||
827 | ------------------------------------------------------------------------ | |
828 | LintTarget(): | |
829 | Generate rules to lint $(SOURCES) (automatically generated) | |
830 | ||
831 | |once _LintTarget_ | |
832 | NormalLintTarget($(SOURCES)) | |
833 | -once | |
834 | ||
835 | ------------------------------------------------------------------------ | |
836 | MakeDirectories(step,dirs): | |
837 | Generate rules to create a hierarchy of directories. | |
838 | ||
839 | step:: | |
840 | MakeDirs(dirs) | |
841 | ||
842 | ------------------------------------------------------------------------ | |
843 | MakeDirs(dirs): | |
844 | Creates a set of directories, even if some directories in the path | |
845 | do not already exist. There should be no '@!' at the end of the | |
846 | '#define' line, because this macro is used *inside* building rules. | |
847 | ||
848 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
849 | for dir in dirs; do \ | |
850 | (set -x; test -d $$dir || $(INSTALLDIR) $$dir) || \ | |
851 | exit 1; \ | |
852 | done | |
853 | ||
854 | ------------------------------------------------------------------------ | |
855 | MakeInstallDirectories(dirs): | |
856 | Generate a rule to create a set of directories at installation | |
857 | time (removed by deinstall). | |
858 | ||
859 | local_install:: | |
860 | _MakeInstallDirs(dirs) | |
861 | ||
862 | local_deinstall:: | |
863 | _RmInstallDirs(dirs) | |
864 | ||
865 | ------------------------------------------------------------------------ | |
866 | MakeLintLibSubdirs(dirs): | |
867 | Generate rules to recursively create lint libraries. | |
868 | ||
869 | MakeLintSubdirs(dirs,lintlib) | |
870 | ||
871 | ------------------------------------------------------------------------ | |
872 | MakeLintSubdirs(dirs,target): | |
873 | Generate rules to recursively lint directories as part of the | |
874 | named step. | |
875 | ||
876 | NamedTargetSubdirsRule(dirs,target,"Linting",/**/) | |
877 | ||
878 | ------------------------------------------------------------------------ | |
879 | MakeMakeSubdirs(target): | |
880 | Generate rules to recursively recreate target as part of the | |
881 | specified step in the build. This assumes Makefile.SH has | |
882 | already been built (which is the case for a delivery), but does | |
883 | not rely on the existence of a Makefile. | |
884 | ||
885 | target:: | |
886 | @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ | |
887 | for i in $(SUBDIRS);\ | |
888 | do \ | |
889 | echo "Making "target" in $(DIR)$$i..."; \ | |
890 | (cd $$i || exit 1; \ | |
891 | if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \ | |
892 | $(MAKE) $(MFLAGS) target) || exit 1;\ | |
893 | done | |
894 | ||
895 | ------------------------------------------------------------------------ | |
896 | MakeMakefilesSH(): | |
897 | Generate rules to recursively recreate target as part of the | |
898 | specified step in the build. If $(TOP) is set to an absolute | |
899 | path, don't prepend the ../ prefix. This makes running things | |
900 | outside of the source tree to be much easier. | |
901 | ||
902 | Makefiles.SH:: Makefile.SH | |
903 | @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ | |
904 | for i in $(SUBDIRS);\ | |
905 | do \ | |
906 | case "$(DIR)$$i/" in \ | |
907 | /**/*^^/^^*^^/^^*^^/^^*^^/) newtop=../../../..;; \ | |
908 | /**/*^^/^^*^^/^^*^^/) newtop=../../..;; \ | |
909 | /**/*^^/^^*^^/) newtop=../..;; \ | |
910 | */**//) newtop=..;; \ | |
911 | esac; \ | |
912 | case "$(TOP)" in \ | |
913 | //**/*) newtop="$(TOP)" ;; \ | |
914 | esac; \ | |
915 | echo "Making Makefiles.SH in $(DIR)$$i..."; \ | |
916 | (cd $$i || exit 1; \ | |
917 | if test -f Jmakefile; then \ | |
918 | $(MAKE) $(MFLAGS) -f ../Makefile \ | |
919 | Makefile TOP=$$newtop CURRENT=$(DIR)$$i && \ | |
920 | $(MAKE) $(MFLAGS) Makefiles.SH; \ | |
921 | fi; \ | |
922 | ) || exit 1; \ | |
923 | done | |
924 | ||
925 | ------------------------------------------------------------------------ | |
926 | MakeScriptFromCpp(name,defs): | |
927 | Generate rules to create a script from a file with a | |
928 | .cpp suffix. | |
929 | ||
930 | CppScriptTarget(name,name.cpp,defs,/**/) | |
931 | ||
932 | ------------------------------------------------------------------------ | |
933 | MakeSubdirs(): | |
934 | Generate rules to do makes in the given subdirectories. | |
935 | ||
936 | NamedTargetSubdirs(all,"Making all",/**/) | |
937 | ||
938 | ------------------------------------------------------------------------ | |
939 | MakeSubincludesForBuild(step,dir,srclist): | |
940 | Make includes in sub directories. | |
941 | ||
942 | step:: dir srclist | |
943 | @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ | |
944 | set -x; cd dir; $(RM) $$list) | |
945 | @for i in srclist; do \ | |
946 | (set -x; cd dir; $(LN) ../$$i .) || exit 1; \ | |
947 | done | |
948 | ||
949 | MakeDirectories(dir,dir) | |
950 | ||
951 | local_realclean:: | |
952 | @-(if [ -d dir ]; then \ | |
953 | list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ | |
954 | set -x; cd dir; $(RM) $$list; fi) | |
955 | ||
956 | ------------------------------------------------------------------------ | |
957 | MakefileSubdirs(): | |
958 | Generate rules to create Makefiles. | |
959 | ||
960 | MakeMakeSubdirs(Makefiles) | |
961 | MakeMakefilesSH() | |
962 | ||
963 | ------------------------------------------------------------------------ | |
964 | MakefileTarget(): | |
965 | Generate rules to build a normal Makefile. | |
966 | ||
967 | BuildMakefileSH(/**/) | |
968 | BuildMakefile() | |
969 | ||
970 | ------------------------------------------------------------------------ | |
971 | NamedDepthTargetSubdirs(name,verb,flags): | |
972 | Recursively make a series of steps. We first enter the | |
973 | subdirectories, then perform the local entries. | |
974 | The supplied "name" has "sub_" prefixed to it. | |
975 | ||
976 | sub_/***/name:: | |
977 | @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags | |
978 | @echo "Back to $(CURRENT) for "name/**/... | |
979 | ||
980 | ------------------------------------------------------------------------ | |
981 | NamedSubTargetSubdirs(name,verb,flags): | |
982 | Recursively make a series of steps, like NamedTargetSubdirs. | |
983 | However, the supplied "name" has "sub_" prefixed to it. | |
984 | ||
985 | sub_/***/name:: | |
986 | @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags | |
987 | ||
988 | ------------------------------------------------------------------------ | |
989 | NamedTargetSubdirs(name,verb,flags): | |
990 | Recursively make a series of steps. | |
991 | ||
992 | name:: | |
993 | @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags | |
994 | ||
995 | ------------------------------------------------------------------------ | |
996 | NamedTargetSubdirsRule(dirs,name,verb,flags): | |
997 | Recursively make a series of steps in the specified directories. | |
998 | ||
999 | name:: | |
1000 | @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ | |
1001 | for i in dirs ;\ | |
1002 | do \ | |
1003 | (cd $$i ; echo verb "in $(DIR)$$i..."; \ | |
1004 | $(MAKE) $(MFLAGS) flags name) || exit 1; \ | |
1005 | done | |
1006 | ||
1007 | ------------------------------------------------------------------------ | |
1008 | NoManPages(): | |
1009 | Actually forces the definition of NOMAN, which tells the jmake | |
1010 | program to not generate rules for installing manual pages. | |
1011 | ||
1012 | -> NOMAN. | |
1013 | ||
1014 | ------------------------------------------------------------------------ | |
1015 | NormalLexDependTarget(program,base,parser): | |
1016 | Declare that program will need an include file produced by | |
1017 | the output of lex on base.l, which typically produces a file | |
1018 | named lex.yy.c which will be renamed as base.c. Besides, the | |
1019 | lexical analyzer needs the file parser.h produced by running | |
1020 | parser.y through yacc and renaming y.tab.h as parser.h. | |
1021 | ||
1022 | base.o: parser.h | |
1023 | ||
1024 | SimpleLexTarget(program,base) | |
1025 | ||
1026 | ------------------------------------------------------------------------ | |
1027 | NormalLibraryObjectRule(): | |
1028 | Generate make rules to build "normal" objects. | |
1029 | ||
1030 | |once _ObjectRule_ | |
1031 | .c.o: | |
1032 | $(RM) $@ | |
1033 | $(CC) -c $(JCFLAGS) $< | |
1034 | ||
1035 | -once | |
1036 | ||
1037 | ------------------------------------------------------------------------ | |
1038 | NormalLibraryTarget(libname,srclist,objlist): | |
1039 | Generate rules to create a library. The 'srclist' and 'objlist' | |
1040 | parameters are added to SOURCES and OBJECTS macros. The 'srclist' | |
1041 | is not otherwise used by this rule, but is necessary for make depend. | |
1042 | ||
1043 | OBJECTS += objlist | |
1044 | SOURCES += srclist | |
1045 | ||
1046 | NormalLibraryObjectRule() | |
1047 | AllTarget(lib/**/libname.a) | |
1048 | ||
1049 | lib/**/libname.a: objlist | |
1050 | $(RM) $@ | |
1051 | $(AR) $@ objlist | |
1052 | $(RANLIB) $@ | |
1053 | ||
1054 | ------------------------------------------------------------------------ | |
1055 | NormalLibraryTarget2(libname,srclist,objlist1,objlist2): | |
1056 | Generate rules to create a library in two steps. This is used to | |
1057 | create libraries with large numbers of files. | |
1058 | ||
1059 | SOURCES += srclist | |
1060 | OBJECTS += objlist1 | |
1061 | OBJECTS += objlist2 | |
1062 | ||
1063 | NormalLibraryObjectRule() | |
1064 | AllTarget(lib/**/libname.a) | |
1065 | ||
1066 | lib/**/libname.a: objlist1 objlist2 | |
1067 | $(RM) $@ | |
1068 | $(AR) $@ objlist1 | |
1069 | $(AR) $@ objlist2 | |
1070 | $(RANLIB) $@ | |
1071 | ||
1072 | ------------------------------------------------------------------------ | |
1073 | NormalLintTarget(srclist): | |
1074 | Generate rules to lint a set of sources. | |
1075 | ||
1076 | lint: | |
1077 | $(LINT) $(LINTFLAGS) srclist $(LINTLIBS) | |
1078 | ||
1079 | ------------------------------------------------------------------------ | |
1080 | NormalObjectRule(): | |
1081 | Generate make rule to build usual object files. | |
1082 | ||
1083 | |once _ObjectRule_ | |
1084 | .c.o: | |
1085 | $(CC) -c $(JCFLAGS) $< | |
1086 | ||
1087 | -once | |
1088 | ||
1089 | ------------------------------------------------------------------------ | |
1090 | NormalObjectTarget(file): | |
1091 | Generate rules to produce a single object file.o from a file.c. | |
1092 | ||
1093 | SOURCES += file/**/.c | |
1094 | ||
1095 | AllTarget(file/**/.o) | |
1096 | NormalObjectRule() | |
1097 | ||
1098 | ------------------------------------------------------------------------ | |
1099 | NormalParserTarget(program,lexic,parser): | |
1100 | Specify that program is using the lex/yacc combination to | |
1101 | produce a parser. The lexic and parser parameters are the | |
1102 | base name of the .l and .y file, respectively. | |
1103 | ||
1104 | NormalLexDependTarget(program,lexic,parser) | |
1105 | NormalYaccTarget(program,parser) | |
1106 | ||
1107 | ------------------------------------------------------------------------ | |
1108 | NormalProgramTarget(program,sources,objects): | |
1109 | Generate rules to compile and link the indicated program; since | |
1110 | it does not use any default object files, it may be used for | |
1111 | multiple programs in the same Jmakefile. | |
1112 | ||
1113 | OBJECTS += objects | |
1114 | SOURCES += sources | |
1115 | ||
1116 | NormalObjectRule() | |
1117 | AllTarget(program) | |
1118 | ||
1119 | program: objects | |
1120 | RemoveTargetProgram($@) | |
1121 | $(CC) -o $@ objects $(JLDFLAGS) $(LIBS) | |
1122 | ||
1123 | ------------------------------------------------------------------------ | |
1124 | NormalRelocatableTarget(objname,objlist): | |
1125 | Generate rules to produce a relocatable object file instead of a | |
1126 | library. | |
1127 | ||
1128 | AllTarget(objname.o) | |
1129 | ||
1130 | objname.o: objlist | |
1131 | $(RM) $@ | |
1132 | $(LD) $(JLDFLAGS) -r objlist -o $@ | |
1133 | ||
1134 | ------------------------------------------------------------------------ | |
1135 | NormalSharedLibraryDataTarget(libname,rev,salist): | |
1136 | Generate rules to create shlib data file; build it into a | |
1137 | different name so that the we don't hose people by having the | |
1138 | library gone for long periods. | |
1139 | ||
1140 | AllTarget(lib/**/libname.sa.rev) | |
1141 | ||
1142 | lib/**/libname.sa.rev: salist | |
1143 | $(RM) $@ | |
1144 | $(AR) $@ salist | |
1145 | $(RANLIB) $@ | |
1146 | ||
1147 | ------------------------------------------------------------------------ | |
1148 | NormalSharedLibraryTarget(libname,rev,solist): | |
1149 | Generate rules to create a shared library; build it into a | |
1150 | different name so that the we don't hose people by having the | |
1151 | library gone for long periods. | |
1152 | ||
1153 | AllTarget(lib/**/libname.so.rev) | |
1154 | ||
1155 | lib/**/libname.so.rev: solist | |
1156 | $(RM) $@~ | |
1157 | (cd shared; $(LD) -o ../$@~ -assert pure-text solist) | |
1158 | $(RM) $@ | |
1159 | $(MV) $@~ $@ | |
1160 | ||
1161 | ------------------------------------------------------------------------ | |
1162 | NormalYaccTarget(program,base): | |
1163 | Declare a yacc base.y file which should produce a base.c and | |
1164 | base.h file as derived from the output of yacc, to be used by | |
1165 | the specified program. | |
1166 | ||
1167 | SimpleYaccTarget(program,base) | |
1168 | SimpleYaccInclude(base) | |
1169 | ||
1170 | ------------------------------------------------------------------------ | |
1171 | PrelinkedRelocatableTarget(objname,objlist,libs): | |
1172 | Generate rules to produce a relocatable object file instead of a | |
1173 | library. | |
1174 | ||
1175 | AllTarget(objname.o) | |
1176 | ||
1177 | objname.o: objlist | |
1178 | $(RM) $@ | |
1179 | $(LD) $(JLDFLAGS) -r objlist -o $@ libs | |
1180 | ||
1181 | ------------------------------------------------------------------------ | |
1182 | ProfiledLibraryObjectRule(): | |
1183 | Generate make rules to build both profiled and "normal" objects. | |
1184 | ||
1185 | all:: | |
1186 | @if [ ! -d profiled ]; then mkdir profiled; fi | |
1187 | ||
1188 | .c.o: | |
1189 | $(RM) $@ profiled/$@ | |
1190 | $(CC) -pg -c $(JCFLAGS) $*.c | |
1191 | $(MV) $*.o profiled/$*.o | |
1192 | $(CC) -c $(JCFLAGS) $*.c | |
1193 | ||
1194 | local_clean:: | |
1195 | -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ | |
1196 | $(RM) profiled/?*.o; fi | |
1197 | ||
1198 | ------------------------------------------------------------------------ | |
1199 | ProfiledLibraryTarget(libname,srclist,objlist): | |
1200 | Generate rules to create a profiled library. | |
1201 | ||
1202 | SOURCES += srclist | |
1203 | OBJECTS += objlist | |
1204 | ||
1205 | AllTarget(lib/**/libname^^_p.a) | |
1206 | ||
1207 | lib/**/libname^^_p.a: objlist | |
1208 | $(RM) $@ | |
1209 | cd profiled; $(AR) ../$@ objlist | |
1210 | $(RANLIB) $@ | |
1211 | ||
1212 | ------------------------------------------------------------------------ | |
1213 | ProfiledRelocatableTarget(objname,objlist): | |
1214 | Generate rules to produce a profiled relocatable object file | |
1215 | instead of a library. | |
1216 | ||
1217 | AllTarget(objname/**/_p.o) | |
1218 | ||
1219 | objname/**/_p.o: objlist | |
1220 | $(RM) $@ | |
1221 | $(LD) -X -r objlist -o $@ | |
1222 | ||
1223 | ------------------------------------------------------------------------ | |
1224 | RemoteDependency(directory,dependency): | |
1225 | Specify rules for making a remote dependency. | |
1226 | ||
1227 | ForceTarget() | |
1228 | |once =directory//***/dependency= | |
1229 | directory//***/dependency: .FORCE | |
1230 | @echo "Checking "/***/dependency" in "/**/^directory"..." | |
1231 | cd /***/directory; $(MAKE) /**/^dependency | |
1232 | @echo "Continuing in $(CURRENT)..." | |
1233 | ||
1234 | -once | |
1235 | ||
1236 | ------------------------------------------------------------------------ | |
1237 | RemoteTargetDependency(target,directory,dependency): | |
1238 | A local target may rely on a remote dependency (e.g. a library) | |
1239 | made in a separate directory. This rule explicits the dependency | |
1240 | and forces a make of that dependency in the remote directory. | |
1241 | ||
1242 | RemoteDependency(directory,dependency) | |
1243 | target: directory//***/dependency | |
1244 | ||
1245 | ------------------------------------------------------------------------ | |
1246 | RemoveTargetProgram(program): | |
1247 | This is used in some other macros in order to remove the target | |
1248 | before starting its building (saves disk space). There should be | |
1249 | no '@!' at the end of the '#define' line, because this macro is | |
1250 | used *inside* building rules. | |
1251 | ||
1252 | $(RM) program | |
1253 | if test -f program/***/$(_EXE); then \ | |
1254 | $(MV) program/***/$(_EXE) program/**/~^^^$(_EXE); fi | |
1255 | ||
1256 | ------------------------------------------------------------------------ | |
1257 | SetSubdirs(subdirs): | |
1258 | Actually forces the definition of SUBDIRS, and lets the user | |
1259 | specify what the sub-directories are. This will be added to the | |
1260 | customization part. | |
1261 | ||
1262 | -> SUBDIRS. | |
1263 | ||
1264 | SUBDIRS = subdirs | |
1265 | ||
1266 | ------------------------------------------------------------------------ | |
1267 | SharedAndDebuggedLibraryObjectRule(): | |
1268 | Generate make rules to build shared, debuggable, and "normal" | |
1269 | object files. | |
1270 | ||
1271 | all:: | |
1272 | @if [ ! -d shared ]; then mkdir shared; fi | |
1273 | @if [ ! -d debugger ]; then mkdir debugger; fi | |
1274 | ||
1275 | .c.o: | |
1276 | $(RM) $@ shared/$@ debugger/$@ | |
1277 | $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c | |
1278 | $(MV) $*.o shared/$*.o | |
1279 | $(CC) -g -c $(SHLIBDEF) $(JCFLAGS) $*.c | |
1280 | $(MV) $*.o debugger/$*.o | |
1281 | $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c | |
1282 | ||
1283 | local_clean:: | |
1284 | -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ | |
1285 | $(RM) shared/?*.o; fi | |
1286 | -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ | |
1287 | $(RM) debugger/?*.o; fi | |
1288 | ||
1289 | ------------------------------------------------------------------------ | |
1290 | SharedLibraryObjectRule(): | |
1291 | Generate make rules to build shared and "normal" object files. | |
1292 | ||
1293 | all:: | |
1294 | @if [ ! -d shared ]; then mkdir shared; fi | |
1295 | ||
1296 | .c.o: | |
1297 | $(RM) $@ shared/$@ | |
1298 | $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c | |
1299 | $(MV) $*.o shared/$*.o | |
1300 | $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c | |
1301 | ||
1302 | local_clean:: | |
1303 | -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ | |
1304 | $(RM) shared/?*.o; fi | |
1305 | ||
1306 | ------------------------------------------------------------------------ | |
1307 | ShellScriptLongTarget(basename,scriptname): | |
1308 | Generate rules to create a set of scripts from .SH files where | |
1309 | the name of the generated file is different from the basename of | |
1310 | the .SH file (when, for instance, the total length with the .SH | |
1311 | extension would not leave enough space for RCS ,v extension). | |
1312 | ||
1313 | LSCRIPTS += scriptname | |
1314 | ||
1315 | AllTarget(scriptname) | |
1316 | ||
1317 | scriptname: basename/**/.SH | |
1318 | /bin/sh basename/**/.SH | |
1319 | ||
1320 | InstallScripts() | |
1321 | #ifndef NOMAN | |
1322 | InstallManPageLong(basename,$(MANSRC),scriptname) | |
1323 | #endif | |
1324 | ||
1325 | ------------------------------------------------------------------------ | |
1326 | ShellScriptTarget(scripts): | |
1327 | Generate rules to create and install a set of scripts from | |
1328 | .SH files. Man pages derived from the name of the scripts are | |
1329 | also installed unless NoManPages() is specified. | |
1330 | ||
1331 | ShellScriptTargetExt(scripts,.SH) | |
1332 | ||
1333 | ------------------------------------------------------------------------ | |
1334 | ShellScriptTargetExt(scripts,ext): | |
1335 | Generate rules to create and install a set of scripts from | |
1336 | ext files (.sh and .SH are the most common examples). Man pages | |
1337 | derived from the name of the scripts are also installed unless | |
1338 | NoManPages() is specified. | |
1339 | ||
1340 | SCRIPTS += scripts | |
1341 | ||
1342 | SimpleShellScriptTargetExt(scripts,ext) | |
1343 | InstallScripts() | |
1344 | InstallManScripts() | |
1345 | ||
1346 | ------------------------------------------------------------------------ | |
1347 | SimpleLexTarget(program,base): | |
1348 | This declares a lex base.l file which is to be ran through | |
1349 | lex to produce a base.c file. | |
1350 | ||
1351 | SOURCES += base.l | |
1352 | OBJECTS += base.o | |
1353 | ||
1354 | |once _LexRule_ | |
1355 | .l.c: | |
1356 | $(LEX) $(JLFLAGS) $< | |
1357 | $(MV) lex.yy.c $@ | |
1358 | ||
1359 | -once | |
1360 | AddSuffix(.l) | |
1361 | program: base.c | |
1362 | ||
1363 | local_realclean:: | |
1364 | $(RM) base.c | |
1365 | ||
1366 | ------------------------------------------------------------------------ | |
1367 | SimpleProgramTarget(program): | |
1368 | Generate rules for compiling and linking programs that only have | |
1369 | one C source file. It should only be used in Jmakefiles that | |
1370 | describe a single program. | |
1371 | ||
1372 | NormalProgramTarget(program,program.c,program.o) | |
1373 | ||
1374 | ------------------------------------------------------------------------ | |
1375 | SimpleShellScriptTarget(scripts): | |
1376 | Generate rules to create a set of scripts from .SH files. | |
1377 | ||
1378 | SimpleShellScriptTargetExt(scripts,.SH) | |
1379 | ||
1380 | ------------------------------------------------------------------------ | |
1381 | SimpleShellScriptTargetExt(scripts,ext): | |
1382 | Generate rules to create a set of scripts from ext files where | |
1383 | ext is usually something like .sh or .SH, or whatever file | |
1384 | extension you like.. | |
1385 | ||
1386 | AllTarget(scripts) | |
1387 | ||
1388 | |expand s!scripts! | |
1389 | !s: !s/**/ext | |
1390 | /bin/sh !s/**/ext | |
1391 | ||
1392 | -expand | |
1393 | ||
1394 | ------------------------------------------------------------------------ | |
1395 | SimpleYaccInclude(base): | |
1396 | Declare that program will need an include file produced by | |
1397 | the output of yacc on base.y, which typically produces a file | |
1398 | named y.tab.h, which will be renamed as base.h. | |
1399 | The only problem is that the dependencies towards base.h have | |
1400 | to be manually given in the Jmakefile. | |
1401 | ||
1402 | base.h: base.c | |
1403 | @if test -f y.tab.h; then \ | |
1404 | echo " $(MV) y.tab.h $@"; \ | |
1405 | $(MV) y.tab.h $@; \ | |
1406 | fi | |
1407 | ||
1408 | local_realclean:: | |
1409 | $(RM) base.h | |
1410 | ||
1411 | ------------------------------------------------------------------------ | |
1412 | SimpleYaccTarget(program,base): | |
1413 | Declare a yacc base.y file to be used in the building of the | |
1414 | specified target program. The source file must be given without | |
1415 | its final .y extension. The name of the .c and .o will be | |
1416 | derived from the source file basename provided. | |
1417 | ||
1418 | SOURCES += base.y | |
1419 | OBJECTS += base.o | |
1420 | ||
1421 | YaccRule() | |
1422 | program: base.c | |
1423 | ||
1424 | local_realclean:: | |
1425 | $(RM) base.c | |
1426 | ||
1427 | ------------------------------------------------------------------------ | |
1428 | SingleProgramTarget(program,objects,libs): | |
1429 | Obsolete version of NormalProgramTarget that doesn't have | |
1430 | deplibs. | |
1431 | ||
1432 | NormalProgramTarget(program,objects,libs) | |
1433 | ||
1434 | ------------------------------------------------------------------------ | |
1435 | SpecialDebuggedAndProfiledObjectRule(objs,depends,options): | |
1436 | Generate rules to compile a file with special flags and to make | |
1437 | debuggable and profiled versions. | |
1438 | ||
1439 | all:: | |
1440 | @if [ ! -d profiled ]; then mkdir profiled; fi | |
1441 | @if [ ! -d debugger ]; then mkdir debugger; fi | |
1442 | ||
1443 | objs: depends | |
1444 | $(RM) $@ profiled/$@ debugger/$@ | |
1445 | $(CC) -pg -c $(JCFLAGS) options $*.c | |
1446 | $(MV) $*.o profiled/$*.o | |
1447 | $(CC) -g -c $(JCFLAGS) options $*.c | |
1448 | $(MV) $*.o debugger/$*.o | |
1449 | $(CC) -c $(JCFLAGS) options $*.c | |
1450 | ||
1451 | ------------------------------------------------------------------------ | |
1452 | SpecialDebuggedObjectRule(objs,depends,options): | |
1453 | Generate rules to compile a file with special flags and to make a | |
1454 | debuggable version. | |
1455 | ||
1456 | all:: | |
1457 | @if [ ! -d debugger ]; then mkdir debugger; fi | |
1458 | ||
1459 | objs: depends | |
1460 | $(RM) $@ debugger/$@ | |
1461 | $(CC) -g -c $(JCFLAGS) options $*.c | |
1462 | $(MV) $*.o debugger/$*.o | |
1463 | $(CC) -c $(JCFLAGS) options $*.c | |
1464 | ||
1465 | ------------------------------------------------------------------------ | |
1466 | SpecialObjectRule(objs,depends,options): | |
1467 | Generate rules to compile a file with special flags. | |
1468 | ||
1469 | objs: depends | |
1470 | $(RM) $@ | |
1471 | $(CC) -c $(JCFLAGS) options $*.c | |
1472 | ||
1473 | ------------------------------------------------------------------------ | |
1474 | SpecialProfiledObjectRule(objs,depends,options): | |
1475 | Generate rules to compile a file with special flags and to make a | |
1476 | profiled version. | |
1477 | ||
1478 | all:: | |
1479 | @if [ ! -d profiled ]; then mkdir profiled; fi | |
1480 | ||
1481 | objs: depends | |
1482 | $(RM) $@ profiled/$@ | |
1483 | $(CC) -pg -c $(JCFLAGS) options $*.c | |
1484 | $(MV) $*.o profiled/$*.o | |
1485 | $(CC) -c $(JCFLAGS) options $*.c | |
1486 | ||
1487 | ------------------------------------------------------------------------ | |
1488 | SpecialSharedAndDebuggedObjectRule(objs,depends,options): | |
1489 | Generate rules to compile a file with special flags and to make | |
1490 | shared and debuggable versions. | |
1491 | ||
1492 | all:: | |
1493 | @if [ ! -d shared ]; then mkdir shared; fi | |
1494 | @if [ ! -d debugger ]; then mkdir debugger; fi | |
1495 | ||
1496 | objs: depends | |
1497 | $(RM) $@ shared/$@ debugger/$@ | |
1498 | $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c | |
1499 | $(MV) $*.o shared/$*.o | |
1500 | $(CC) -g -c $(SHLIBDEF) $(JCFLAGS) options $*.c | |
1501 | $(MV) $*.o debugger/$*.o | |
1502 | $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c | |
1503 | ||
1504 | ------------------------------------------------------------------------ | |
1505 | SpecialSharedObjectRule(objs,depends,options): | |
1506 | Generate rules to compile a file with special flags and to make | |
1507 | shared and debuggable versions. | |
1508 | ||
1509 | all:: | |
1510 | @if [ ! -d shared ]; then mkdir shared; fi | |
1511 | ||
1512 | objs: depends | |
1513 | $(RM) $@ shared/$@ | |
1514 | $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c | |
1515 | $(MV) $*.o shared/$*.o | |
1516 | $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c | |
1517 | ||
1518 | ------------------------------------------------------------------------ | |
1519 | TagSubdirs(dirs): | |
1520 | Generate rules to recursively create tags files. | |
1521 | ||
1522 | NamedTargetSubdirsRule(dirs,tag,"Tagging",/**/) | |
1523 | ||
1524 | ------------------------------------------------------------------------ | |
1525 | TagsTarget(): | |
1526 | Generate rules to compute tags files for C source code. | |
1527 | ||
1528 | tags:: | |
1529 | $(CTAGS) -w *.[ch] | |
1530 | $(CTAGS) -xw *.[ch] > tags | |
1531 | ||
1532 | local_clobber:: | |
1533 | $(RM) tags | |
1534 | ||
1535 | ------------------------------------------------------------------------ | |
1536 | YaccRule(): | |
1537 | This is the rule which is used to build a .c file from a .y file. | |
1538 | ||
1539 | AddSuffix(.y) | |
1540 | |once _YaccRule_ | |
1541 | .y.c: | |
1542 | $(YACC) $(JYFLAGS) $< | |
1543 | $(MV) y.tab.c $@ | |
1544 | ||
1545 | -once | |
1546 | ||
1547 | ------------------------------------------------------------------------ | |
1548 | _MakeInstallDir(dir): | |
1549 | Internal macro to create a missing install directory. | |
1550 | ||
1551 | (set -x; test -d $(INSTALL_PREFIX)/***/dir || \ | |
1552 | $(INSTALLDIR) $(INSTALL_PREFIX)/***/dir); | |
1553 | ||
1554 | ------------------------------------------------------------------------ | |
1555 | _MakeInstallDirIgnore(dir): | |
1556 | Same as _MakeInstallDir but handles "make -i" as well. | |
1557 | ||
1558 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
1559 | _MakeInstallDir(dir) | |
1560 | ||
1561 | ------------------------------------------------------------------------ | |
1562 | _MakeInstallDirs(dirs): | |
1563 | Creates a set of intall directories, even if some directories in the path | |
1564 | do not already exist. There should be no '@!' at the end of the | |
1565 | '#define' line, because this macro is used *inside* building rules. | |
1566 | ||
1567 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
1568 | for dir in dirs; do \ | |
1569 | _MakeInstallDir($$dir) \ | |
1570 | done | |
1571 | ||
1572 | ------------------------------------------------------------------------ | |
1573 | _RmInstallDirs(dirs): | |
1574 | Removes a set of intall directories. | |
1575 | There should be no '@!' at the end of the '#define' line, because this | |
1576 | macro is used *inside* building rules. | |
1577 | ||
1578 | @case '${MFLAGS}' in *[i]*) set +e;; esac; \ | |
1579 | for dir in dirs; do \ | |
1580 | (set -x; test -d $$dir && $(RM) -r $(INSTALL_PREFIX)$$dir); \ | |
1581 | done | |
1582 | ||
1583 | ------------------------------------------------------------------------ |