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.]
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.
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.
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
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.
23 ------------------------------------------------------------------------
25 Adds a sufix to the .SUFFIXES: list.
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
39 ------------------------------------------------------------------------
40 AliasedLibraryTarget(libname,alias):
41 Generate rules to link one library to another.
43 AllTarget(lib/**/alias.a)
45 lib/**/alias.a: lib^^libname.a
47 $(LN) lib/**/libname.a $@
49 ------------------------------------------------------------------------
51 Generate rules to build necessary things during make all.
58 ------------------------------------------------------------------------
60 Generate rules to build a Makefile from a Makefile.SH.
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.
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~; \
79 echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" jmakeflags; \
80 $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) jmakeflags; \
83 ------------------------------------------------------------------------
85 Generate rules to recursively clean out garbage files.
87 NamedDepthTargetSubdirs(clean,"Cleaning",/**/)
88 NamedDepthTargetSubdirs(realclean,"Real cleaning",/**/)
89 NamedDepthTargetSubdirs(clobber,"Clobbering",/**/)
91 ------------------------------------------------------------------------
93 Generate rules to remove any garbage files.
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
103 if test -f core; then $(RM) core; fi
106 local_realclean:: local_clean
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
115 ------------------------------------------------------------------------
116 CommonSubdirsRule(dirs):
117 Rule for making $(TARGET) in every subdirectory, with $(VERB) as
118 verbose message and $(FLAGS) as additional flags.
121 @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
124 (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \
125 $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)) || exit 1; \
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.
142 RemoveTargetProgram($@)
143 $(CC) -o $@ $(OBJS) $(JLDFLAGS) $(LIBS)
145 InstallProgram(program,$(BINDIR))
146 InstallManPage(program,$(MANSRC))
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.
165 RemoveTargetProgram($@)
166 $(CC) -o $@ $(OBJS1) $(JLDFLAGS) $(LIBS)
168 InstallProgram(program,$(BINDIR))
169 InstallManPage(program,$(MANSRC))
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.
188 RemoveTargetProgram($@)
189 $(CC) -o $@ $(OBJS2) $(JLDFLAGS) $(LIBS)
191 InstallProgram(program,$(BINDIR))
192 InstallManPage(program,$(MANSRC))
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.
208 RemoveTargetProgram($@)
209 $(CC) -o $@ $(OBJS3) $(JLDFLAGS) $(LIBS)
211 InstallProgram(program,$(BINDIR))
212 InstallManPage(program,$(MANSRC))
214 ------------------------------------------------------------------------
215 ComplexShellManualTarget(manpages):
216 Builds manual pages that are to be extracted from .SH files into
221 |once _ShellManualRule_
231 _MakeInstallDirIgnore($(MANSRC)) \
232 for file in manpages; do \
233 (set -x; $(INSTALL) -c -m 444 $$file \
234 $(INSTALL_PREFIX)$(MANSRC)) || exit 1; \
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); \
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.
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"; \
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"; \
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.
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
294 ------------------------------------------------------------------------
295 CppScriptTarget(dst,src,defs,deplist):
296 Generate rules to create a shell script by running the input
302 sed -e '/^# *[0-9][0-9]* *.*$$/d' >$@
305 ------------------------------------------------------------------------
306 DebuggedAndProfiledLibraryObjectRule():
307 Generate make rules to build debuggable, profiled, and "normal"
311 @if [ ! -d profiled ]; then mkdir profiled; fi
312 @if [ ! -d debugger ]; then mkdir debugger; fi
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
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
328 ------------------------------------------------------------------------
329 DebuggedLibraryObjectRule():
330 Generate make rules to build both debuggable and "normal"
334 @if [ ! -d debugger ]; then mkdir debugger; fi
338 $(CC) -g -c $(JCFLAGS) $*.c
339 $(MV) $*.o debugger/$*.o
340 $(CC) -c $(JCFLAGS) $*.c
343 -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \
344 $(RM) debugger/?*.o; fi
346 ------------------------------------------------------------------------
347 DebuggedLibraryTarget(libname,srclist,objlist):
348 Generate rules to create a debuggable library.
353 AllTarget(lib/**/libname^^_d.a)
355 lib/**/libname^^_d.a: objlist
357 cd debugger; $(AR) ../$@ objlist
360 ------------------------------------------------------------------------
361 DebuggedRelocatableTarget(objname,objlist):
362 Generate rules to produce a debuggable relocatable object file
363 instead of a library.
365 AllTarget(objname/**/_d.o)
367 objname/**/_d.o: objlist
369 $(LD) -X -r objlist -o $@
371 ------------------------------------------------------------------------
372 DeinstallMultipleDest(step,list,dest):
373 Generate rules to deinstall multiple files at once during a particular
377 @case '${MFLAGS}' in *[i]*) set +e;; esac; \
379 (set -x; $(RM) $(INSTALL_PREFIX)/***/dest/$$i); \
382 ------------------------------------------------------------------------
384 Generate rules to build the makedepend program.
386 depend:: 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
392 ------------------------------------------------------------------------
394 Generate rules to recursively compute dependencies as part of the
397 NamedTargetSubdirsRule(dirs,depend,"Depending",/**/)
399 ------------------------------------------------------------------------
401 Generate rules to recursively compute dependencies as part of the
404 DependDirs($(SUBDIRS))
406 ------------------------------------------------------------------------
408 Generate rules to compute dependencies for all files listed
409 in $(SOURCES) (automatically generated macro).
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' \
423 cp Makefile Makefile.bak
424 cp Makefile.new Makefile
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.
440 ------------------------------------------------------------------------
442 The force target will force reconstruction of all the other
443 targets which include .FORCE in their own dependencies.
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.
462 IdentifiedLexTarget(program,base,prefix)
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.
476 $(LEX) $(JLFLAGS) base.l
477 $(SED) -e 's/yy\(.\)/prefix\1/g' < lex.yy.c > base.c
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.
492 IdentifiedLexDependTarget(program,lexic,parser,prefix)
493 IdentifiedYaccTarget(program,parser,prefix)
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.
503 ComplexYaccTarget(program,base,prefix)
504 ComplexYaccInclude(base,prefix)
506 ------------------------------------------------------------------------
508 Generate rules to recursively put include files in build
510 NamedTargetSubdirs(includes,including,/**/)
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).
519 ------------------------------------------------------------------------
520 InstallLibrary(libname,dest):
521 Generate rules to install the indicated library.
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
530 $(RM) $(INSTALL_PREFIX)/***/dest/lib/**/libname.a
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.
537 local_install:: lib/**/libname.a
539 -(cd dest; $(LN) lib/**/libname.a lib^^alias.a)
542 $(RM) dest/lib/**/alias.a
544 ------------------------------------------------------------------------
545 InstallLintLibrary(libname,dest):
546 Generate rules to install the indicated lint library.
548 install.ln:: llib-l/**/libname.ln
549 _MakeInstallDirIgnore(dest) \
550 $(INSTALL) -c -m 444 llib-l/**/libname.ln $(INSTALL_PREFIX)/***/dest
553 $(RM) $(INSTALL_PREFIX)/***/dest/llib-l/**/libname.ln
555 ------------------------------------------------------------------------
556 InstallManPage(file,dest):
557 Generate rules to install the indicated manual page.
559 InstallManPageLong(file,dest,file)
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).
569 local_install.man:: file.man
570 _MakeInstallDirIgnore(destdir) \
571 $(INSTALL) -c -m 444 file.man $(INSTALL_PREFIX)/***/destdir/dest.$(L)
573 local_deinstall.man::
574 $(RM) $(INSTALL_PREFIX)/***/destdir/dest.$(L)
576 ------------------------------------------------------------------------
578 Generate rule to install/deinstall manual pages for scripts listed
579 in the automatically generated $(SCRIPTS) macro.
581 |once _InstallManScripts_
584 _MakeInstallDirIgnore($(MANSRC)) \
585 for file in $(SCRIPTS); do \
586 if test -f $$file.man; then \
588 $(INSTALL) -c -m 444 $$file.man \
589 $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)) || \
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)); \
603 ------------------------------------------------------------------------
605 Generate rules to recursively install and deinstall manual pages.
607 NamedSubTargetSubdirs(install.man,"Installing man pages",/**/)
608 NamedDepthTargetSubdirs(deinstall.man,"Deinstalling man pages",/**/)
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)
616 InstallMultipleDestFlags(local_install,list,dest,$(INSTALLFLAGS))
617 DeinstallMultipleDest(local_deinstall,list,dest)
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.
625 _MakeInstallDirIgnore(dest) \
627 (set -x; $(INSTALL) -c flags \
628 $$i $(INSTALL_PREFIX)/***/dest) || exit 1;\
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.
636 InstallMultipleDestFlags(local_install,list,dest,flags)
637 DeinstallMultipleDest(local_deinstall,list,dest)
639 ------------------------------------------------------------------------
640 InstallMultipleMan(list,dest):
641 Generate rules to install a variety of manual pages
642 during the install.man step of the build.
644 InstallMultipleDestFlags(local_install.man,list,dest,$(INSTALLFLAGS))
645 DeinstallMultipleDest(local_deinstall.man,list,dest)
647 ------------------------------------------------------------------------
648 InstallNonExec(file,dest):
649 Generate rules to install a data file using any special
653 _MakeInstallDirIgnore(dest) \
654 $(INSTALL) -c -m 444 file $(INSTALL_PREFIX)/***/dest
657 $(RM) $(INSTALL_PREFIX)/***/dest/file
659 ------------------------------------------------------------------------
660 InstallProgram(program,dest):
661 Generate rules to install an executable program using any special
662 install flags set in $(INSTALLFLAGS).
664 InstallProgramWithFlags(program,dest,/**/)
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.
672 InstallProgramNoStripWithFlags(program,dest,/**/)
674 ------------------------------------------------------------------------
675 InstallProgramNoStripWithFlags(program,dest,flags):
676 Generate rules to install an executable program using given
679 local_install:: program
680 _MakeInstallDirIgnore(dest) \
681 $(INSTALL) -c -m 555 flags program/***/$(_EXE) $(INSTALL_PREFIX)/**/^dest
684 $(RM) $(INSTALL_PREFIX)/***/dest/program/**/^$(_EXE)
686 ------------------------------------------------------------------------
687 InstallProgramWithFlags(program,dest,flags):
688 Generate rules to install an executable program using given
691 local_install:: program
692 _MakeInstallDirIgnore(dest) \
693 $(INSTALL) -c -s -m 555 flags program/***/$(_EXE) $(INSTALL_PREFIX)/**/^dest
696 $(RM) $(INSTALL_PREFIX)/***/dest/program/**/^$(_EXE)
698 ------------------------------------------------------------------------
699 InstallScript(script,dest):
700 Generate rules to install an executable script using any special
701 install flags set in $(INSTALLFLAGS).
703 InstallScriptWithFlags(script,dest,/**/)
705 ------------------------------------------------------------------------
706 InstallScriptWithFlags(script,dest,flags):
707 Generate rules to install an executable script using given
710 local_install:: script
711 _MakeInstallDirIgnore(dest) \
712 $(INSTALL) -c -m 555 flags script $(INSTALL_PREFIX)/***/dest
715 $(RM) $(INSTALL_PREFIX)/***/dest/script
717 ------------------------------------------------------------------------
719 Generate rules to install all the scripts listed in the generated
720 $(SCRIPTS) and $(LSCRIPTS) macros.
722 |once _InstallScripts_
723 local_install:: $(SCRIPTS) $(LSCRIPTS)
724 _MakeInstallDirIgnore($(SCRIPTDIR)) \
725 for file in $(SCRIPTS) $(LSCRIPTS); do \
727 $(INSTALL) -c -m 555 $$file $(INSTALL_PREFIX)$(SCRIPTDIR)) || \
732 @for file in $(SCRIPTS) $(LSCRIPTS); do \
733 case '${MFLAGS}' in *[i]*) set +e;; esac; \
734 (set -x; $(RM) $(INSTALL_PREFIX)$(SCRIPTDIR)/$$file); \
738 ------------------------------------------------------------------------
739 InstallSharedLibrary(libname,rev,dest):
740 Generate rules to install the shared library.
742 local_install:: lib/**/libname.so.rev
743 _MakeInstallDirIgnore(dest) \
744 $(INSTALL) -c -m 444 lib/**/libname.so.rev $(INSTALL_PREFIX)/***/dest
747 $(RM) $(INSTALL_PREFIX)/***/dest/lib/**/libname.so.rev
749 ------------------------------------------------------------------------
750 InstallSharedLibraryData(libname,rev,dest):
751 Generate rules to install the shared library data
753 local_install:: lib/**/libname.sa.rev
754 _MakeInstallDirIgnore(dest) \
755 $(INSTALL) -c -m 444 lib/**/libname.sa.rev $(INSTALL_PREFIX)/***/dest
758 $(RM) $(INSTALL_PREFIX)/***/dest/lib/**/libname.sa.rev
760 ------------------------------------------------------------------------
762 Generate rules to recursively install and deinstall programs and
765 NamedSubTargetSubdirs(install,"Installing",/**/)
766 NamedDepthTargetSubdirs(deinstall,"Deinstalling",/**/)
768 ------------------------------------------------------------------------
770 Generate rules to recursively install files
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
781 (if MANSRC) install.man-yes: local_install.man
783 (if MANSRC) deinstall.man-yes: local_deinstall.man
786 ------------------------------------------------------------------------
787 LinkFileList(step,list,dir,sub):
788 Link a list of list of files from one place to another
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
794 ------------------------------------------------------------------------
795 LinkSourceFile(src,dir):
796 Snag source file from some other directory
802 ------------------------------------------------------------------------
804 Generate rules to recursively lint directories as part of the
807 MakeLintSubdirs(dirs,lint)
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.
814 lintlib:: llib-l/**/libname.ln
816 llib-l/**/libname.ln: srclist
818 $(LINT) $(LINTLIBFLAG)/**/libname $(LINTFLAGS) srclist
820 ------------------------------------------------------------------------
822 Generate rules to recursively lint directories as part of the
827 ------------------------------------------------------------------------
829 Generate rules to lint $(SOURCES) (automatically generated)
832 NormalLintTarget($(SOURCES))
835 ------------------------------------------------------------------------
836 MakeDirectories(step,dirs):
837 Generate rules to create a hierarchy of directories.
842 ------------------------------------------------------------------------
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.
848 @case '${MFLAGS}' in *[i]*) set +e;; esac; \
849 for dir in dirs; do \
850 (set -x; test -d $$dir || $(INSTALLDIR) $$dir) || \
854 ------------------------------------------------------------------------
855 MakeInstallDirectories(dirs):
856 Generate a rule to create a set of directories at installation
857 time (removed by deinstall).
860 _MakeInstallDirs(dirs)
865 ------------------------------------------------------------------------
866 MakeLintLibSubdirs(dirs):
867 Generate rules to recursively create lint libraries.
869 MakeLintSubdirs(dirs,lintlib)
871 ------------------------------------------------------------------------
872 MakeLintSubdirs(dirs,target):
873 Generate rules to recursively lint directories as part of the
876 NamedTargetSubdirsRule(dirs,target,"Linting",/**/)
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.
886 @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
887 for i in $(SUBDIRS);\
889 echo "Making "target" in $(DIR)$$i..."; \
891 if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \
892 $(MAKE) $(MFLAGS) target) || exit 1;\
895 ------------------------------------------------------------------------
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.
902 Makefiles.SH:: Makefile.SH
903 @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
904 for i in $(SUBDIRS);\
906 case "$(DIR)$$i/" in \
907 /**/*^^/^^*^^/^^*^^/^^*^^/) newtop=../../../..;; \
908 /**/*^^/^^*^^/^^*^^/) newtop=../../..;; \
909 /**/*^^/^^*^^/) newtop=../..;; \
910 */**//) newtop=..;; \
913 //**/*) newtop="$(TOP)" ;; \
915 echo "Making Makefiles.SH in $(DIR)$$i..."; \
917 if test -f Jmakefile; then \
918 $(MAKE) $(MFLAGS) -f ../Makefile \
919 Makefile TOP=$$newtop CURRENT=$(DIR)$$i && \
920 $(MAKE) $(MFLAGS) Makefiles.SH; \
925 ------------------------------------------------------------------------
926 MakeScriptFromCpp(name,defs):
927 Generate rules to create a script from a file with a
930 CppScriptTarget(name,name.cpp,defs,/**/)
932 ------------------------------------------------------------------------
934 Generate rules to do makes in the given subdirectories.
936 NamedTargetSubdirs(all,"Making all",/**/)
938 ------------------------------------------------------------------------
939 MakeSubincludesForBuild(step,dir,srclist):
940 Make includes in sub directories.
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; \
949 MakeDirectories(dir,dir)
952 @-(if [ -d dir ]; then \
953 list=`echo srclist | sed -e 's/[^ ]*\///g'`; \
954 set -x; cd dir; $(RM) $$list; fi)
956 ------------------------------------------------------------------------
958 Generate rules to create Makefiles.
960 MakeMakeSubdirs(Makefiles)
963 ------------------------------------------------------------------------
965 Generate rules to build a normal Makefile.
967 BuildMakefileSH(/**/)
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.
977 @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags
978 @echo "Back to $(CURRENT) for "name/**/...
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.
986 @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags
988 ------------------------------------------------------------------------
989 NamedTargetSubdirs(name,verb,flags):
990 Recursively make a series of steps.
993 @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags
995 ------------------------------------------------------------------------
996 NamedTargetSubdirsRule(dirs,name,verb,flags):
997 Recursively make a series of steps in the specified directories.
1000 @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
1003 (cd $$i ; echo verb "in $(DIR)$$i..."; \
1004 $(MAKE) $(MFLAGS) flags name) || exit 1; \
1007 ------------------------------------------------------------------------
1009 Actually forces the definition of NOMAN, which tells the jmake
1010 program to not generate rules for installing manual pages.
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.
1024 SimpleLexTarget(program,base)
1026 ------------------------------------------------------------------------
1027 NormalLibraryObjectRule():
1028 Generate make rules to build "normal" objects.
1033 $(CC) -c $(JCFLAGS) $<
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.
1046 NormalLibraryObjectRule()
1047 AllTarget(lib/**/libname.a)
1049 lib/**/libname.a: objlist
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.
1063 NormalLibraryObjectRule()
1064 AllTarget(lib/**/libname.a)
1066 lib/**/libname.a: objlist1 objlist2
1072 ------------------------------------------------------------------------
1073 NormalLintTarget(srclist):
1074 Generate rules to lint a set of sources.
1077 $(LINT) $(LINTFLAGS) srclist $(LINTLIBS)
1079 ------------------------------------------------------------------------
1081 Generate make rule to build usual object files.
1085 $(CC) -c $(JCFLAGS) $<
1089 ------------------------------------------------------------------------
1090 NormalObjectTarget(file):
1091 Generate rules to produce a single object file.o from a file.c.
1093 SOURCES += file/**/.c
1095 AllTarget(file/**/.o)
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.
1104 NormalLexDependTarget(program,lexic,parser)
1105 NormalYaccTarget(program,parser)
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.
1120 RemoveTargetProgram($@)
1121 $(CC) -o $@ objects $(JLDFLAGS) $(LIBS)
1123 ------------------------------------------------------------------------
1124 NormalRelocatableTarget(objname,objlist):
1125 Generate rules to produce a relocatable object file instead of a
1128 AllTarget(objname.o)
1132 $(LD) $(JLDFLAGS) -r objlist -o $@
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.
1140 AllTarget(lib/**/libname.sa.rev)
1142 lib/**/libname.sa.rev: salist
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.
1153 AllTarget(lib/**/libname.so.rev)
1155 lib/**/libname.so.rev: solist
1157 (cd shared; $(LD) -o ../$@~ -assert pure-text solist)
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.
1167 SimpleYaccTarget(program,base)
1168 SimpleYaccInclude(base)
1170 ------------------------------------------------------------------------
1171 PrelinkedRelocatableTarget(objname,objlist,libs):
1172 Generate rules to produce a relocatable object file instead of a
1175 AllTarget(objname.o)
1179 $(LD) $(JLDFLAGS) -r objlist -o $@ libs
1181 ------------------------------------------------------------------------
1182 ProfiledLibraryObjectRule():
1183 Generate make rules to build both profiled and "normal" objects.
1186 @if [ ! -d profiled ]; then mkdir profiled; fi
1189 $(RM) $@ profiled/$@
1190 $(CC) -pg -c $(JCFLAGS) $*.c
1191 $(MV) $*.o profiled/$*.o
1192 $(CC) -c $(JCFLAGS) $*.c
1195 -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \
1196 $(RM) profiled/?*.o; fi
1198 ------------------------------------------------------------------------
1199 ProfiledLibraryTarget(libname,srclist,objlist):
1200 Generate rules to create a profiled library.
1205 AllTarget(lib/**/libname^^_p.a)
1207 lib/**/libname^^_p.a: objlist
1209 cd profiled; $(AR) ../$@ objlist
1212 ------------------------------------------------------------------------
1213 ProfiledRelocatableTarget(objname,objlist):
1214 Generate rules to produce a profiled relocatable object file
1215 instead of a library.
1217 AllTarget(objname/**/_p.o)
1219 objname/**/_p.o: objlist
1221 $(LD) -X -r objlist -o $@
1223 ------------------------------------------------------------------------
1224 RemoteDependency(directory,dependency):
1225 Specify rules for making a remote dependency.
1228 |once =directory//***/dependency=
1229 directory//***/dependency: .FORCE
1230 @echo "Checking "/***/dependency" in "/**/^directory"..."
1231 cd /***/directory; $(MAKE) /**/^dependency
1232 @echo "Continuing in $(CURRENT)..."
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.
1242 RemoteDependency(directory,dependency)
1243 target: directory//***/dependency
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.
1253 if test -f program/***/$(_EXE); then \
1254 $(MV) program/***/$(_EXE) program/**/~^^^$(_EXE); fi
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
1266 ------------------------------------------------------------------------
1267 SharedAndDebuggedLibraryObjectRule():
1268 Generate make rules to build shared, debuggable, and "normal"
1272 @if [ ! -d shared ]; then mkdir shared; fi
1273 @if [ ! -d debugger ]; then mkdir debugger; fi
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
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
1289 ------------------------------------------------------------------------
1290 SharedLibraryObjectRule():
1291 Generate make rules to build shared and "normal" object files.
1294 @if [ ! -d shared ]; then mkdir shared; fi
1298 $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c
1299 $(MV) $*.o shared/$*.o
1300 $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c
1303 -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \
1304 $(RM) shared/?*.o; fi
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).
1313 LSCRIPTS += scriptname
1315 AllTarget(scriptname)
1317 scriptname: basename/**/.SH
1318 /bin/sh basename/**/.SH
1322 InstallManPageLong(basename,$(MANSRC),scriptname)
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.
1331 ShellScriptTargetExt(scripts,.SH)
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.
1342 SimpleShellScriptTargetExt(scripts,ext)
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.
1356 $(LEX) $(JLFLAGS) $<
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.
1372 NormalProgramTarget(program,program.c,program.o)
1374 ------------------------------------------------------------------------
1375 SimpleShellScriptTarget(scripts):
1376 Generate rules to create a set of scripts from .SH files.
1378 SimpleShellScriptTargetExt(scripts,.SH)
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..
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.
1403 @if test -f y.tab.h; then \
1404 echo " $(MV) y.tab.h $@"; \
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.
1427 ------------------------------------------------------------------------
1428 SingleProgramTarget(program,objects,libs):
1429 Obsolete version of NormalProgramTarget that doesn't have
1432 NormalProgramTarget(program,objects,libs)
1434 ------------------------------------------------------------------------
1435 SpecialDebuggedAndProfiledObjectRule(objs,depends,options):
1436 Generate rules to compile a file with special flags and to make
1437 debuggable and profiled versions.
1440 @if [ ! -d profiled ]; then mkdir profiled; fi
1441 @if [ ! -d debugger ]; then mkdir debugger; fi
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
1451 ------------------------------------------------------------------------
1452 SpecialDebuggedObjectRule(objs,depends,options):
1453 Generate rules to compile a file with special flags and to make a
1457 @if [ ! -d debugger ]; then mkdir debugger; fi
1460 $(RM) $@ debugger/$@
1461 $(CC) -g -c $(JCFLAGS) options $*.c
1462 $(MV) $*.o debugger/$*.o
1463 $(CC) -c $(JCFLAGS) options $*.c
1465 ------------------------------------------------------------------------
1466 SpecialObjectRule(objs,depends,options):
1467 Generate rules to compile a file with special flags.
1471 $(CC) -c $(JCFLAGS) options $*.c
1473 ------------------------------------------------------------------------
1474 SpecialProfiledObjectRule(objs,depends,options):
1475 Generate rules to compile a file with special flags and to make a
1479 @if [ ! -d profiled ]; then mkdir profiled; fi
1482 $(RM) $@ profiled/$@
1483 $(CC) -pg -c $(JCFLAGS) options $*.c
1484 $(MV) $*.o profiled/$*.o
1485 $(CC) -c $(JCFLAGS) options $*.c
1487 ------------------------------------------------------------------------
1488 SpecialSharedAndDebuggedObjectRule(objs,depends,options):
1489 Generate rules to compile a file with special flags and to make
1490 shared and debuggable versions.
1493 @if [ ! -d shared ]; then mkdir shared; fi
1494 @if [ ! -d debugger ]; then mkdir debugger; fi
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
1504 ------------------------------------------------------------------------
1505 SpecialSharedObjectRule(objs,depends,options):
1506 Generate rules to compile a file with special flags and to make
1507 shared and debuggable versions.
1510 @if [ ! -d shared ]; then mkdir shared; fi
1514 $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c
1515 $(MV) $*.o shared/$*.o
1516 $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c
1518 ------------------------------------------------------------------------
1520 Generate rules to recursively create tags files.
1522 NamedTargetSubdirsRule(dirs,tag,"Tagging",/**/)
1524 ------------------------------------------------------------------------
1526 Generate rules to compute tags files for C source code.
1530 $(CTAGS) -xw *.[ch] > tags
1535 ------------------------------------------------------------------------
1537 This is the rule which is used to build a .c file from a .y file.
1542 $(YACC) $(JYFLAGS) $<
1547 ------------------------------------------------------------------------
1548 _MakeInstallDir(dir):
1549 Internal macro to create a missing install directory.
1551 (set -x; test -d $(INSTALL_PREFIX)/***/dir || \
1552 $(INSTALLDIR) $(INSTALL_PREFIX)/***/dir);
1554 ------------------------------------------------------------------------
1555 _MakeInstallDirIgnore(dir):
1556 Same as _MakeInstallDir but handles "make -i" as well.
1558 @case '${MFLAGS}' in *[i]*) set +e;; esac; \
1559 _MakeInstallDir(dir)
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.
1567 @case '${MFLAGS}' in *[i]*) set +e;; esac; \
1568 for dir in dirs; do \
1569 _MakeInstallDir($$dir) \
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.
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); \
1583 ------------------------------------------------------------------------