From 8bfc5756fb68e0b13d7e7c0073ad5b9a4790d1b6 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Thu, 24 Aug 2006 12:32:52 +0000 Subject: Moving project to sourceforge. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@1 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/Jmakefile | 51 ++ jmake/Makefile.SH | 300 ++++++++ jmake/NOTES | 189 +++++ jmake/README | 70 ++ jmake/bindex.SH | 185 +++++ jmake/files/Jmake.rules | 1801 +++++++++++++++++++++++++++++++++++++++++++++++ jmake/files/Jmake.tmpl | 253 +++++++ jmake/fixcpp.SH | 183 +++++ jmake/jmake.SH | 526 ++++++++++++++ jmake/jmake.man | 491 +++++++++++++ jmake/jmkmf.SH | 106 +++ jmake/jmkmf.man | 80 +++ 12 files changed, 4235 insertions(+) create mode 100644 jmake/Jmakefile create mode 100755 jmake/Makefile.SH create mode 100644 jmake/NOTES create mode 100644 jmake/README create mode 100755 jmake/bindex.SH create mode 100644 jmake/files/Jmake.rules create mode 100644 jmake/files/Jmake.tmpl create mode 100755 jmake/fixcpp.SH create mode 100755 jmake/jmake.SH create mode 100644 jmake/jmake.man create mode 100755 jmake/jmkmf.SH create mode 100644 jmake/jmkmf.man (limited to 'jmake') diff --git a/jmake/Jmakefile b/jmake/Jmakefile new file mode 100644 index 0000000..81b9dc4 --- /dev/null +++ b/jmake/Jmakefile @@ -0,0 +1,51 @@ +/* + * Jmakefile for jmake + */ + +;# $Id: Jmakefile,v 3.0.1.2 1995/03/21 08:34:16 ram Exp ram $ +;# +;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 4.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.2 1995/03/21 08:34:16 ram +;# patch52: now installs new fixcpp script in the private libdir +;# +;# Revision 3.0.1.1 1994/01/24 13:42:36 ram +;# patch16: added dependency generation stage +;# +;# Revision 3.0 1993/08/18 12:04:09 ram +;# Baseline for dist 3.0 netwide release. +;# + +AllTarget(Index) + +Index: bindex + chmod +x bindex + ./bindex + +ShellScriptTarget(jmake jmkmf) +SimpleShellScriptTarget(bindex fixcpp) + +MakeInstallDirectories($(PRIVLIB) $(PRIVLIB)/files) +InstallNonExec(Index,$(PRIVLIB)) +InstallScript(bindex,$(PRIVLIB)) +InstallScript(fixcpp,$(PRIVLIB)/files) +InstallMultipleFlags(files/Jmake*,$(PRIVLIB)/files,-m 444) + +BINSH = jmake.SH fixcpp.SH + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(BINSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + diff --git a/jmake/Makefile.SH b/jmake/Makefile.SH new file mode 100755 index 0000000..e562274 --- /dev/null +++ b/jmake/Makefile.SH @@ -0,0 +1,300 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL70] +: $X-Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp ram $ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=jmake +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` + +$spitshell >Makefile <>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.7 2004/08/22 08:28:58 ram Exp ram $ + +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.2 1995/03/21 08:34:16 ram Exp ram $ +# +# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 4.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.2 1995/03/21 08:34:16 ram +# patch52: now installs new fixcpp script in the private libdir +# +# Revision 3.0.1.1 1994/01/24 13:42:36 ram +# patch16: added dependency generation stage +# +# Revision 3.0 1993/08/18 12:04:09 ram +# Baseline for dist 3.0 netwide release. +# + +all:: Index + +local_realclean:: + $(RM) Index + +Index: bindex + chmod +x bindex + ./bindex + +all:: jmake jmkmf + +local_realclean:: + $(RM) jmake jmkmf + +jmake: jmake.SH + /bin/sh jmake.SH + +jmkmf: jmkmf.SH + /bin/sh jmkmf.SH + + +local_install:: $(SCRIPTS) $(LSCRIPTS) + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $(INSTALL_PREFIX)$(SCRIPTDIR) || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$(SCRIPTDIR)); \ + for file in $(SCRIPTS) $(LSCRIPTS); do \ + (set -x; \ + $(INSTALL) -c -m 555 $$file $(INSTALL_PREFIX)$(SCRIPTDIR)); \ + done + +local_deinstall:: + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(RM) $(INSTALL_PREFIX)$(SCRIPTDIR)/$$file); \ + done + +local_install.man:: + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $(INSTALL_PREFIX)$(MANSRC) || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$(MANSRC)); \ + for file in $(SCRIPTS); do \ + if test -f $$file.man; then \ + (set -x; \ + $(INSTALL) -c -m 444 $$file.man \ + $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)); \ + fi; \ + done + +local_deinstall.man:: + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; $(RM) $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)); \ + done + +all:: bindex fixcpp + +local_realclean:: + $(RM) bindex fixcpp + +bindex: bindex.SH + /bin/sh bindex.SH + +fixcpp: fixcpp.SH + /bin/sh fixcpp.SH + + +local_install:: + + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for dir in $(PRIVLIB) $(PRIVLIB)/files; do \ + (set -x; test -d $(INSTALL_PREFIX)$$dir || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$$dir); \ + done + +local_deinstall:: + + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for dir in $(PRIVLIB) $(PRIVLIB)/files; do \ + (set -x; test -d $$dir && $(RM) -r $(INSTALL_PREFIX)$$dir); \ + done + +local_install:: Index + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB) || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)); \ + $(INSTALL) -c -m 444 Index $(INSTALL_PREFIX)$(PRIVLIB) + +local_deinstall:: + $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/Index + +local_install:: bindex + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB) || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)); \ + $(INSTALL) -c -m 555 bindex $(INSTALL_PREFIX)$(PRIVLIB) + +local_deinstall:: + $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/bindex + +local_install:: fixcpp + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB)/files || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)/files); \ + $(INSTALL) -c -m 555 fixcpp $(INSTALL_PREFIX)$(PRIVLIB)/files + +local_deinstall:: + $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/files/fixcpp + +local_install:: files/Jmake* + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB)/files || \ + $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)/files); \ + for i in files/Jmake*; do \ + (set -x; $(INSTALL) -c -m 444 $$i $(INSTALL_PREFIX)$(PRIVLIB)/files); \ + done + +local_deinstall:: + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for i in files/Jmake*; do \ + (set -x; $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/files/$$i); \ + done + +BINSH = jmake.SH fixcpp.SH + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(BINSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: local_clean +realclean: local_realclean +clobber: local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + +local_clobber:: local_realclean + $(RM) Makefile config.sh + +install: local_install +install.man: maybe_install.man +deinstall: local_deinstall +deinstall.man: maybe_deinstall.man + +install.man-yes: local_install.man +install.man-no: +deinstall.man-yes: local_deinstall.man +deinstall.man-no: + +!NO!SUBS! +case "$installmansrc" in +'') man=no;; +*) man=yes;; +esac +$spitshell >>Makefile <>Makefile <<'!NO!SUBS!' + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Empty rules for directories with no sub-directories -- do not edit + +local_install:: + @echo "install in $(CURRENT) done." + +local_deinstall:: + @echo "deinstall in $(CURRENT) done." + +local_install.man:: + @echo "install.man in $(CURRENT) done." + +local_deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." + +Makefiles:: + +Makefiles.SH:: + +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/jmake/NOTES b/jmake/NOTES new file mode 100644 index 0000000..a11618d --- /dev/null +++ b/jmake/NOTES @@ -0,0 +1,189 @@ +The syntax in Jmake.rules is not elegant at all, but: + + - It is easy to parse (like sendmail.cf or troff files). + - The rules are not supposed to change very often. + - It is simple enough to be mastered in five minutes. :-) + +Here is a small description: + +o To deal with various cpp implementations: + +Final @!\ means: end of line, next line starts at the left margin. +Final @@\ means: end of line, next line is to be indented by one tab. + +The conversion occurs during Pass1. + + +o Symbol definitions + +>SYMBOL: defines the symbol (Pass 1). +?SYMBOL:: keeps iff SYMBOL is defined (Pass 2). +%SYMBOL:: keeps iff SYMBOL is not defined (Pass 2). + +The ?SYM can be nested (logical AND), as in: + + ?SYMBOL:%TOKEN:text /* Keeps text if SYMBOL and not TOKEN */ + +To implement a logical OR, see below. + + +o Commands + +Commands can be passed to 'jmake'. They start with a leading '|'. + +Available commands are: + +|suffix : adds to the .SUFFIXES: list in the makefile (Pass 1 & 2). +|rule:: adds to the building rule section (Pass 1 & 2). +|rule: : same as before, with a leading tab. +|skip: skips text until a line starting with '-skip' is found (Pass 2). +|expand : expand lines until '-expand' with (Pass 2). +|once : text up to '-once' appears only the first time (Pass 1). + +Thus, a way to implement a logical OR could be: + + /* Implements SYMBOL or not TOKEN */ + ?SYMBOL:text /* Keeps text if SYMBOL */ + %SYMBOL:|skip + %TOKEN:text /* Keeps text if not TOKEN */ + -skip + +Actually, this is ugly, because the text has to appear twice. +Fortunately, I did not use it. :-) + +The '|' commands cannot be nested. In particular, due to the simple +implementation of '|skip', it is impossible to put '|skip' inside +a skipped part. However, a '|once' section may have '|skip' sections. + +But actually, as you have surely already guessed, the best way to +implement a logical OR is to use De Morgan's Law: + + not (p or q) <=> not p and not q + + /* Implements SYMBOL or not TOKEN (attempt #2) */ + %SYMBOL:?TOKEN:|skip + text /* If SYMBOL or not TOKEN */ + -skip + +Who said they don't care ? ;-) + +o Expansion + +Expansion is done with the 'expand' command. It has been provided to +avoid some cumbersome writings in makefiles when you have to repeat some +silly lines that only differ in file names, for instance. Let's look at +an example first: + + |expand a!foo bar! b!yes no! + !a:: + echo !a, !b + -expand + +Then two rules will be printed, and the values of (a,b) for the first +will be (foo, yes), for the second (bar, no). Substitution is controled +by the '!' character. If the word to be substituted is part of another +one, detach with the ^^ construct as in: !b^^c. It is possible to +use Makefile macros in the , and they will be expanded by +jmake. If this is not what you want, escape the first '$' sign (this is +a Makefile escape, i.e. you must double the '$', not precede it with a +backslash). A // stands for the null substitution value. + +Here is another example which shows how the macro Expand can be used. +It is defined in Jmake.rules as: + + #define Expand(rule, pattern) @!\ + |expand pattern @!\ + rule @!\ + -expand + +So we can write in the Jmakefile: + + |skip + A = foo bar + -skip + + #define Rule @!\ + $(DIR)/!a^^.o: !a^^.o @@\ + $(CC) -c !a^^.c @@\ + $(MV) !a^^.o $(DIR) + + Expand(Rule, a!$(A)!) + +which will generate in Makefile.SH: + + $(DIR)/foo.o: foo.o + $(CC) -c foo.c + $(MV) foo.o $(DIR) + + $(DIR)/bar.o: bar.o + $(CC) -c bar.c + $(MV) bar.o $$(DIR) + +The 'A' declaration has been surrounded by skip, so that it does +not appear in the generated Makefile.SH, but it will be taken into +account by jmake for the substitution in the pattern. + +The number of expansions is determined by the number of possible +values for the _first_ parameter. If other parameters have less +substitution values, they will get void ones. + +It is possible to add a regular expression at the end of '-expand'. +This regular expression will be removed from the final set of expansion +at the end of each line. It is also possible to do substitutions in the +expanded item, by using the syntax (if 'f' is the expanded variable) +!f:

= where

and are two regular expressions (without +spaces). The pattern

will be replaced by pattern (only the +first occurrence will be replaced). + +Finally, you may refer in the expanded section to variables whose value +is computed via another expansion, which makes it easy to define generic +Jmakefiles. + +Example: + + SRC = foo.c bar.c + OBJ = \ + |expand f!$(SRC)! + !f:\.c=\.o \ + -expand \\ + INC = \ + |expand f!$(OBJ)! + !f:\.o=\.h \ + -expand \\ + +which will generate in Makefile.SH: + + SRC = foo.c bar.c + OBJ = \ + foo.o \ + bar.o + INC = \ + foo.h \ + bar.h + +Do not forget to protect special characters in your regular expressions such +as backslash, point, etc... + +o Once + +The once command is tagged with a name. The first time the name appears, +the once construct is ignored and the text up to '-once' will be copied +in the generated Makefile.SH. However, future occurences of the same +name will be ignored (once will behave like skip). + +Example: + + |once this_is_a_name + + -once + +o Initializations + ++: Puts the whole line in the initialization section (Pass 1 & 2). +++SYMBOL : Adds to the SYMBOL macro (Pass 1 and 2). + +o User-defined variables + +CFLAGS: added flags to C compiler +DPFLAGS: cpp flags to be added to mkdep for dependency +LDFLAGS: flags/libraries to be added at linking stage diff --git a/jmake/README b/jmake/README new file mode 100644 index 0000000..636cc8f --- /dev/null +++ b/jmake/README @@ -0,0 +1,70 @@ +This is the root directory for jmake. + +The jmake program is a Makefile generator. It comes from 'imake' one +may find in the X11R4 distribution, but it produces a Makefile.SH +instead of a Makefile. Jmake has a template which knows some metaconfig +symbols and has built-in commands which make it more powerful than imake. + +The jmkmf script may be used to produce the Makefile.SH from a Jmakefile. +Once the bootstrap is done, you can run 'make Makefile.SH' to rebuild the +Makefile.SH in the current directory, or 'make Makefiles.SH' to build the +Makefiles in a recursive manner. + +All the rules used by jmake are listed in an automatically built index. +The jmake's cryptic syntax is documented in file NOTES. You may also +have a look at the sample Jmakefiles that come with this package. +Usually, you do not include them in the release, but I kept them so +that you may have a real example and see how things are organized. + +If you choose to use jmake, then you will have to use metaconfig, in +order to get a meaningful value for all the needed symbol. Thus, each +time you change your Jmakefiles, it may be necessary to update the +Configure script. + +Here is how to use jmake... + +First, you have to write a Jmakefile for each directory where you want +to put a Makefile. Be sure to declare all the sub-directories with the +SetSubdirs rule. Usually, the order of the rules is not significant, +but you should make sure the Makefile begins with an 'all::' target, +so that a default 'make' does not run a clean for instance. + +Then, if this is the first time, you have to bootstrap. Go to the main +directory of your package and run: + + jmkmf + make Makefiles.SH + +which will first produce the main makefile and then recursively build +all the makefiles. + +Once you have bootstrapped once, you can edit a Jmakefile and rebuild +the local makefile with + + make Makefile + +or all the hierachy below with: + + make Makefiles.SH + +If you want to extract all the makefiles, you may run + + sh Makefile.SH + make Makefiles + +in the top-level directory. Finally, if you only want to test the +generated Makefile.SH without disturbing the Makefile, run + + make Makefile.SH + +which will stop before running the produced file through sh. + + +CAUTION: + +On machines whose cpp eats up tabs in macro expansion, the Makefile.SH +produced might not be indented properly inside rules. + +Perl 4.0 PL10 sometimes dumps core, while PL3 does not. Thus, perl 4.0 +PL10 should NOT be used with jmake, at least on a MIPS. + diff --git a/jmake/bindex.SH b/jmake/bindex.SH new file mode 100755 index 0000000..3905f85 --- /dev/null +++ b/jmake/bindex.SH @@ -0,0 +1,185 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting bindex (with variable substitutions)" +$spitshell >bindex <>bindex <<'!NO!SUBS!' + eval 'exec perl -S $0 "$@"' + if $runnning_under_some_shell; + +# $Id$ +# +# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 4.0. +# +# $Log: bindex.SH,v $ +# Revision 3.0.1.1 1993/08/19 06:42:12 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:13 ram +# Baseline for dist 3.0 netwide release. +# + +$file = "files/Jmake.rules"; + +open(INDEX, ">Index") || die "Cannot create Index.\n"; +open(RULES, "$file") || die "Cannot open $file.\n"; + +print INDEX +"[This Index is automatically generated from Jmake.rules file. Do not +edit this file or your changes will be lost. Edit Jmake.rules instead.] + +This file contains a listing of all the macros that can be used in a +Jmakefile. Only a few of these should be used in the Jmakefile (they +are the top-level macros). However, some low-level ones may be useful, +but it is up to you to make that decision. This explains why this file +holds all the available macros for jmake. + +In the following listing, the macros are separated by a line of dashes. +The signature of the macro is given, then a small comment of what it +does precedes the actual definition. + +Lines preceded by '->' show the set of symbols defined when the macro is +used. Initialization lines are shown as-is, i.e. have the form SYM = val +while concatenation is shown by SYM += val (which means val is added to +the value of SYM). + +Conditional lines are preceded by tests like (if SYM). This means the line +is to be kept if and only if the symbol SYM is defined. Other internal +requests are not formatted yet. + +"; +$inrule = 0; # Not inside a rule at the beginning +$incomment = 0; # Not inside a comment +$last_was_text = 0; # Last line was not a rule text +while () { + $inrule || next unless /^\s\*\s(\w+)\s*:/; + if ($inrule) { # We are already in a rule + if ($incomment) { + if (m|^\s*\*/|) { # End of comment + $incomment = 0; + $Comment{$current} .= "\n"; + } else { + s/^\s*\*\s*//; # Remove leading comment sign + $Comment{$current} .= " $_"; + } + next; # Anyway, go to next line + } + if (/^\s*$/) { # Empty line = end of rule + $inrule = 0; + next; + } + # Here, we have to print the body of the rule, after some cleaning + s/(@#|@@|@!)\\$//; # Remove final continuations + s/^(#define.*)\\/$1/; # Remove single '\' on first rule line + s/\|rule:\s*$/\n/; + s/\|rule:\s+/ /; # Remove rule markers + s/\|rule://; + s/%(\w+):\|skip/#ifdef $1/; # Deal with ugly skip syntax + s/\?(\w+):\|skip/#ifndef $1/; # Deal with ugly skip syntax + s/\-skip/#endif/; + s/\?(\w+):/(if $1) /; # Simple '?' test + s/%(\w+):/(not $1) /; # Simple '%' test + s/\|suffix/.SUFFIXES:/; # Make suffix command explicit + s/\t/ /g; # Expand all tabs to 4 chars + s/\s*$/\n/; # Remove any trailing space + s|\^\^\^|/***/|; # Change ^^^ to the more visual /***/ + s|\^\^|/**/|; # Restore ^^ to the more visual /**/ + if (/^$/) { # If empty line + $Index{$current} .= "\n" if $last_was_text; + $last_was_text = 0; + next; + } + if (/^[>+]/) { # Special commands + if (s/^>\s*//) { # Wanted symbol + chop; + $Wants{$current} .= " $_"; + } elsif (/^\+\+\s*(\S+)\s*(.*)/) { # Added symbol + $Added{$current} .= "\t$1 += $2\n"; + } else { + s/^\+\s*(.*)//; + $Init{$current} .= "\t$1\n"; + } + next; + } + if (s/^#define\s+//) { # Definition of the rule + chop; + $Sig{$current} = $_; # Signature of rule + } else { + $Index{$current} .= " $_"; # Rule's body + $last_was_text = 1; + } + } else { # We've just entered a rule + $current = $1; + next if $current =~ /patch\d/; # Skip RCS log messages + $inrule = 1; + $incomment = 1; # We're still in the leading comment + $Seen{$current} = 1; + $last_was_text = 0; + } +} +close RULES; + +# Now sort the rules in alphabetical order + +print INDEX '-' x 72, "\n"; +foreach $rule (sort(keys %Seen)) { + print INDEX "$Sig{$rule}:\n"; + print INDEX $Comment{$rule}; + $line = $Wants{$rule}; + if (length($line)) { + $line = "->$line."; + $line = &format($line); + print INDEX "$line\n"; + } + $line = $Init{$rule}; + print INDEX "$line\n" if length($line); + $line = $Added{$rule}; + print INDEX "$line\n" if length($line); + $line = $Index{$rule}; + print INDEX $line; + print INDEX "\n" if (length($line)); + print INDEX '-' x 72, "\n"; +} + +close INDEX; + +# Format $_ to fit in 80 columns (70 + size of tabs) +# Long lines are split, and the all but the first are indented +# by two leading spaces. The whole thing is then indented by +# one tab. +sub format { + local($tmp); + local($head) = ''; + local($_) = shift(@_); + while (length($_) > 70) { + $tmp = substr($_,0,70); + $tmp =~ s/^(.*) .*/$1/; + $head .= "\t$tmp\n"; + $_ = ' ' . substr($_,length($tmp),9999); + } + $head .= "\t$_\n"; +} +!NO!SUBS! +chmod 755 bindex +$eunicefix bindex diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules new file mode 100644 index 0000000..cf3e9d6 --- /dev/null +++ b/jmake/files/Jmake.rules @@ -0,0 +1,1801 @@ +;######################################################################## +;# Jmake rules for building libraries, programs, scripts, and data files +;# $Id: Jmake.rules,v 3.0.1.7 2004/08/22 08:28:58 ram Exp ram $ + +/* + * MACHINE-INDEPENDENT RULES -- DO NOT MODIFY + */ + +/* $Id: Jmake.rules,v 3.0.1.7 2004/08/22 08:28:58 ram Exp ram $ + * + * Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi + * + * You may redistribute only under the terms of the Artistic Licence, + * as specified in the README file that comes with the distribution. + * You may reuse parts of this distribution only within the terms of + * that same Artistic Licence; a copy of which may be found at the root + * of the source tree for dist 4.0. + * + * $Log: Jmake.rules,v $ + * Revision 3.0.1.7 2004/08/22 08:28:58 ram + * patch71: random cleanup + * + * Revision 3.0.1.6 1997/02/28 14:56:01 ram + * patch61: now handles USRINC for dependencies + * patch61: smarter about dependencies computation + * + * Revision 3.0.1.5 1995/09/25 09:07:19 ram + * patch59: smarter sed command to strip /usr/include dependencies + * + * Revision 3.0.1.4 1995/07/25 13:33:59 ram + * patch56: install of script man pages can now cope with missing files + * patch56: the clobber target now removes the .config directory as well + * + * Revision 3.0.1.3 1995/03/21 08:35:28 ram + * patch52: suppressed extra argument to NormalProgramTarget call + * + * Revision 3.0.1.2 1995/01/11 14:49:55 ram + * patch45: new macros ShellScriptTargetExt and SimpleShellScriptTargetExt + * patch45: directory installation is now made via INSTALLDIR (Configure) + * + * Revision 3.0.1.1 1994/10/29 15:46:30 ram + * patch36: added RemoteDependency rule + * + * Revision 3.0 1993/08/18 12:04:14 ram + * Baseline for dist 3.0 netwide release. + * + */ + +/* Please, edit only with tabstops = 4 (":set ts=4" under vi) */ + +/* + * AddedByConfigure: + * Gives name of the files generated by Configure that can safely + * be removed when a "make clobber" is issued. Not that it is useless + * to name config.h or config.sh because these are already taken care + * of by jmake. + */ +#define AddedByConfigure(files) @!\ +local_clobber:: @@\ + $(RM) files + +/* + * AddSuffix: + * Adds a sufix to the .SUFFIXES: list. + */ +#define AddSuffix(ext) @!\ +|suffix ext + + +/* + * AllTarget: + * Generate rules to build necessary things during make all. + */ +#define AllTarget(depends) @!\ +all:: depends @!\ + @!\ +local_realclean:: @@\ + $(RM) depends + +/* + * RemoveTargetProgram: + * This is used in some other macros in order to remove the target + * before starting its building (saves disk space). There should be + * no '@!' at the end of the '#define' line, because this macro is + * used *inside* building rules. + */ +#define RemoveTargetProgram(program) \ + $(RM) program @@\ + if test -f program^^^$(_EXE); then \ @@\ + $(MV) program^^^$(_EXE) program^^~^^^$(_EXE); fi + +/* + * NormalProgramTarget: + * Generate rules to compile and link the indicated program; since + * it does not use any default object files, it may be used for + * multiple programs in the same Jmakefile. + */ +#define NormalProgramTarget(program,sources,objects) @!\ +++OBJECTS objects @!\ +++SOURCES sources @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: objects @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ objects $(JLDFLAGS) $(LIBS) @!\ + + +/* + * SingleProgramTarget: + * Obsolete version of NormalProgramTarget that doesn't have + * deplibs. + */ +#define SingleProgramTarget(program,objects,libs) \ +NormalProgramTarget(program,objects,libs) + +/* + * SimpleProgramTarget: + * Generate rules for compiling and linking programs that only have + * one C source file. It should only be used in Jmakefiles that + * describe a single program. + */ +#define SimpleProgramTarget(program) @!\ +NormalProgramTarget(program,program.c,program.o) + + + +/* + * ComplexProgramTarget: + * Generate rules for compiling and linking the program specified by + * $(OBJS) and $(SRCS), installing the program and its man page, and + * generating dependencies. It should only be used in Jmakefiles + * that describe a single program. + */ +#define ComplexProgramTarget(program) @!\ +++OBJECTS $(OBJS) @!\ +++SOURCES $(SRCS) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) @!\ +DependTarget() @!\ +LintTarget() + + +/* + * ComplexProgramTarget_1: + * Generate rules for compiling and linking the program specified by + * $(OBJS1) and $(SRCS1), installing the program and its man page, + * and generating dependencies for it and any programs described by + * $(SRCS2) and $(SRCS3). It should be used to build the primary + * program in Jmakefiles that describe multiple programs. + */ +#define ComplexProgramTarget_1(program) @!\ +++OBJECTS $(OBJS1) @!\ +++SOURCES $(SRCS1) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS1) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS1) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) @!\ + @!\ +DependTarget() @!\ +LintTarget() + + +/* + * ComplexProgramTarget_2: + * Generate rules for compiling and linking the program specified by + * $(OBJS2) and $(SRCS2) and installing the program and man page. + * It should be used to build the second program in Jmakefiles + * describing more than one program. + */ +#define ComplexProgramTarget_2(program) @!\ +++OBJECTS $(OBJS2) @!\ +++SOURCES $(SRCS2) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS2) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS2) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) + + +/* + * ComplexProgramTarget_3: + * Generate rules for compiling and linking the program specified by + * $(OBJS3) and $(SRCS3) and installing the program and man page. It + * should be used to build the third program in Jmakefiles describing + * more than one program. + */ +#define ComplexProgramTarget_3(program) @!\ +++OBJECTS $(OBJS3) @!\ +++SOURCES $(SRCS3) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS3) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS3) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) + + +/* + * ComplexShellManualTarget: + * Builds manual pages that are to be extracted from .SH files into + * .$manext files. + */ +#define ComplexShellManualTarget(manpages) @!\ +++MANPAGE manpages @!\ +|once _ShellManualRule_ @!\ +|rule:.SH.$manext: @!\ +|rule: /bin/sh $< @!\ +|rule: @!\ +-once @!\ +AddSuffix(.SH) @!\ +AddSuffix(.$manext) @!\ +AllTarget(manpages) @!\ + @!\ +local_install.man:: @@\ + _MakeInstallDirIgnore($(MANSRC)) \ @@\ + for file in manpages; do \ @@\ + (set -x; $(INSTALL) -c -m 444 $$file \ @@\ + $(INSTALL_PREFIX)$(MANSRC)) || exit 1; \ @@\ + done @!\ + @!\ +local_deinstall.man:: @@\ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for file in manpages; do \ @@\ + (set -x; $(RM) $(INSTALL_PREFIX)$(MANSRC)/$$file); \ @@\ + done + + +/* + * Initialize: + * Puts the line symbol = value in the initialization section of + * Makefile.SH (the one that is subject to parameter substitutions). + */ +#define Initialize(symbol,value) @!\ ++symbol = value + + +/* + * InstallLibrary: + * Generate rules to install the indicated library. + */ +#define InstallLibrary(libname,dest) @!\ +local_install:: lib^^libname.a @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 644 lib^^libname.a $(INSTALL_PREFIX)^^^dest @@\ + $(RANLIB) dest/lib^^libname.a @@\ + chmod 444 dest/lib^^libnane.a @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/lib^^libname.a + + +/* + * InstallSharedLibrary: + * Generate rules to install the shared library. + */ +#define InstallSharedLibrary(libname,rev,dest) @!\ +local_install:: lib^^libname.so.rev @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 444 lib^^libname.so.rev $(INSTALL_PREFIX)^^^dest @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/lib^^libname.so.rev + + +/* + * InstallSharedLibraryData: + * Generate rules to install the shared library data + */ +#define InstallSharedLibraryData(libname,rev,dest) @!\ +local_install:: lib^^libname.sa.rev @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 444 lib^^libname.sa.rev $(INSTALL_PREFIX)^^^dest @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/lib^^libname.sa.rev + + +/* + * InstallLibraryAlias: + * Generate rules to create a link from one library name to another + * for the purposes of aliasing. + */ +#define InstallLibraryAlias(libname,alias,dest) @!\ +local_install:: lib^^libname.a @@\ + $(RM) lib^^alias.a @@\ + -(cd dest; $(LN) lib^^libname.a lib^^alias.a) @!\ + @!\ +local_deinstall:: @@\ + $(RM) dest/lib^^alias.a + + +/* + * InstallLintLibrary: + * Generate rules to install the indicated lint library. + */ +#define InstallLintLibrary(libname,dest) @!\ +install.ln:: llib-l^^libname.ln @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 444 llib-l^^libname.ln $(INSTALL_PREFIX)^^^dest @!\ + @!\ +deinstall.ln:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/llib-l^^libname.ln + + +/* + * InstallManPageLong: + * Generate rules to install the indicated manual page, giving it an + * alternate name. This is used for installing man pages whose base + * name without the .man suffix would normally be longer than 8 + * characters (the limit for using source code control systems on + * files systems with short file names). + */ +#define InstallManPageLong(file,destdir,dest) @!\ +local_install.man:: file.man @@\ + _MakeInstallDirIgnore(destdir) \ @@\ + $(INSTALL) -c -m 444 file.man $(INSTALL_PREFIX)^^^destdir/dest.$(L) @!\ + @!\ +local_deinstall.man:: @@\ + $(RM) $(INSTALL_PREFIX)^^^destdir/dest.$(L) @!\ + + +/* + * InstallManPage: + * Generate rules to install the indicated manual page. + */ +#define InstallManPage(file,dest) @!\ +InstallManPageLong(file,dest,file) + + +/* + * InstallNonExec: + * Generate rules to install a data file using any special + * install flags. + */ +#define InstallNonExec(file,dest) @!\ +local_install:: file @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 444 file $(INSTALL_PREFIX)^^^dest @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/file + + +/* + * InstallProgramWithFlags: + * Generate rules to install an executable program using given + * install flags. + */ +#define InstallProgramWithFlags(program,dest,flags) @!\ +local_install:: program @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -s -m 555 flags program^^^$(_EXE) $(INSTALL_PREFIX)^^^dest @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/program^^^$(_EXE) + + +/* + * InstallProgram: + * Generate rules to install an executable program using any special + * install flags set in $(INSTALLFLAGS). + */ +#define InstallProgram(program,dest) @!\ +InstallProgramWithFlags(program,dest,^^) + + +/* + * InstallScriptWithFlags: + * Generate rules to install an executable script using given + * install flags. + */ +#define InstallScriptWithFlags(script,dest,flags) @!\ +local_install:: script @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 555 flags script $(INSTALL_PREFIX)^^^dest @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/script + + +/* + * InstallScript: + * Generate rules to install an executable script using any special + * install flags set in $(INSTALLFLAGS). + */ +#define InstallScript(script,dest) @!\ +InstallScriptWithFlags(script,dest,^^) + + +/* + * InstallScripts: + * Generate rules to install all the scripts listed in the generated + * $(SCRIPTS) and $(LSCRIPTS) macros. + */ +#define InstallScripts() @!\ +|once _InstallScripts_ @!\ +local_install:: $(SCRIPTS) $(LSCRIPTS) @@\ + _MakeInstallDirIgnore($(SCRIPTDIR)) \ @@\ + for file in $(SCRIPTS) $(LSCRIPTS); do \ @@\ + (set -x; \ @@\ + $(INSTALL) -c -m 555 $$file $(INSTALL_PREFIX)$(SCRIPTDIR)) || \ @@\ + exit 1; \ @@\ + done @!\ + @!\ +local_deinstall:: @@\ + @for file in $(SCRIPTS) $(LSCRIPTS); do \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + (set -x; $(RM) $(INSTALL_PREFIX)$(SCRIPTDIR)/$$file); \ @@\ + done @!\ +-once + +/* + * InstallManScripts: + * Generate rule to install/deinstall manual pages for scripts listed + * in the automatically generated $(SCRIPTS) macro. + */ +#define InstallManScripts() @!\ +|once _InstallManScripts_ @!\ +?NOMAN:|skip @!\ +local_install.man:: @@\ + _MakeInstallDirIgnore($(MANSRC)) \ @@\ + for file in $(SCRIPTS); do \ @@\ + if test -f $$file.man; then \ @@\ + (set -x; \ @@\ + $(INSTALL) -c -m 444 $$file.man \ @@\ + $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)) || \ @@\ + exit 1; \ @@\ + fi; \ @@\ + done @!\ + @!\ +local_deinstall.man:: @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for file in $(SCRIPTS); do \ @@\ + (set -x; $(RM) $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)); \ @@\ + done @!\ + @!\ +-skip @!\ +-once + + + +/* + * LinkFileList: + * Link a list of list of files from one place to another + */ +#define LinkFileList(step,list,dir,sub) @!\ +step:: list @@\ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + echo " cd" dir; cd dir; for i in list; do (set -x; $(LN) sub/$$i .); done + + +/* + * InstallMultipleDestFlags: + * Generate rules to install multiple files at once during a particular + * step in the build using a specific set of install flags. + */ +#define InstallMultipleDestFlags(step,list,dest,flags) @!\ +step:: list @@\ + _MakeInstallDirIgnore(dest) \ @@\ + for i in list; do \ @@\ + (set -x; $(INSTALL) -c flags \ @@\ + $$i $(INSTALL_PREFIX)^^^dest) || exit 1;\ @@\ + done + +/* + * DeinstallMultipleDest: + * Generate rules to deinstall multiple files at once during a particular + * step in the build. + */ +#define DeinstallMultipleDest(step,list,dest) @!\ +step:: @@\ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for i in list; do \ @@\ + (set -x; $(RM) $(INSTALL_PREFIX)^^^dest/$$i); \ @@\ + done + +/* + * InstallMultiple: + * Generate rules to install multiple files at once during the install + * step of the build using any install flags set in $(INSTALLFLAGS) + * and deinstall them. + */ +#define InstallMultiple(list,dest) @!\ +InstallMultipleDestFlags(local_install,list,dest,$(INSTALLFLAGS)) @!\ +DeinstallMultipleDest(local_deinstall,list,dest) + + +/* + * InstallMultipleFlags: + * Generate rules to install multiple files at once during the + * install step of the build using the given install flags. + */ +#define InstallMultipleFlags(list,dest,flags) @!\ +InstallMultipleDestFlags(local_install,list,dest,flags) @!\ +DeinstallMultipleDest(local_deinstall,list,dest) + + +/* + * InstallMultipleMan: + * Generate rules to install a variety of manual pages + * during the install.man step of the build. + */ +#define InstallMultipleMan(list,dest) @!\ +InstallMultipleDestFlags(local_install.man,list,dest,$(INSTALLFLAGS)) @!\ +DeinstallMultipleDest(local_deinstall.man,list,dest) + + +/* + * DependDependency: + * Generate rules to build the makedepend program. + */ +#define DependDependency() @!\ +depend:: TOPDIR/mkdep @!\ + @!\ +TOPDIR/mkdep: @!\ +?TOP: @echo "You have to run Configure first."; exit 1 @!\ +%TOP: @echo "You have to run Configure in $(TOP) first."; exit 1 + + +/* + * DependTarget: + * Generate rules to compute dependencies for all files listed + * in $(SOURCES) (automatically generated macro). + */ +#define DependTarget() @!\ ++USRINC = $usrinc @!\ +|once _DependTarget_ @!\ +DependDependency() @!\ + @!\ +depend:: @@\ + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ @@\ + $(MKDEP) $(SOURCES) | \ @@\ + $(SED) -e 's:/usr/lib[^ ]*::g; s:$(USRINC)[^ ]*::g; ' \ @@\ + -e '/: / b print' -e '$$ b print' -e 'H; d; n; : print' \ @@\ + -e 'x; s/\\$$//; s/\\\n//g; s/ ^^ */ /g; s/ :/:/;' -e '/: *$$/d' \ @@\ + ) > Makefile.new @@\ + cp Makefile Makefile.bak @@\ + cp Makefile.new Makefile @@\ + $(RM) Makefile.new @!\ + @!\ +-once + + +/* + * CleanTarget: + * Generate rules to remove any garbage files. + */ +#define CleanTarget() @!\ +?SUBDIRS:clean: sub_clean local_clean @!\ +%SUBDIRS:clean: local_clean @!\ +?SUBDIRS:realclean: sub_realclean local_realclean @!\ +%SUBDIRS:realclean: local_realclean @!\ +?SUBDIRS:clobber: sub_clobber local_clobber @!\ +%SUBDIRS:clobber: local_clobber @!\ + @!\ +local_clean:: @@\ + if test -f core; then $(RM) core; fi @@\ + $(RM) *~ *.o @!\ + @!\ +local_realclean:: local_clean @!\ +?TOP: $(RM) -r UU @!\ + @!\ +local_clobber:: local_realclean @!\ +%TOP: $(RM) Makefile config.sh @!\ +?TOP: $(RM) config.sh config.h @!\ +?TOP: $(RM) -r .config @!\ +?TOP: $(RM) Makefile @!\ + + +/* + * InstallTarget: + * Generate rules to recursively install files + */ +#define InstallTarget() @!\ +?SUBDIRS:install: local_install sub_install @!\ +%SUBDIRS:install: local_install @!\ +?SUBDIRS:install.man: maybe_install.man sub_install.man @!\ +%SUBDIRS:install.man: maybe_install.man @!\ +?SUBDIRS:deinstall: sub_deinstall local_deinstall @!\ +%SUBDIRS:deinstall: local_deinstall @!\ +?SUBDIRS:deinstall.man: sub_deinstall.man maybe_deinstall.man @!\ +%SUBDIRS:deinstall.man: maybe_deinstall.man @!\ + @!\ +?MANSRC:install.man-yes: local_install.man @!\ +install.man-no: @!\ +?MANSRC:deinstall.man-yes: local_deinstall.man @!\ +deinstall.man-no: @!\ + + +/* + * TagsTarget: + * Generate rules to compute tags files for C source code. + */ +#define TagsTarget() @!\ +tags:: @@\ + $(CTAGS) -w *.[ch] @@\ + $(CTAGS) -xw *.[ch] > tags @!\ + @!\ +local_clobber:: @@\ + $(RM) tags + + + +/* + * BuildMakefileSH: + * Generate rules to build a Makefile.SH from an Jmakefile and any + * special jmake flags. This is generally done automatically by the + * template or by any special Jmakefiles. + * This function will simply touch Makefile.SH if no $(TOP)/.package + * exists, assuming the Jmakefile is not in a production environment. + */ +#define BuildMakefileSH(jmakeflags) @!\ +Makefile.SH: Jmakefile @@\ + -@if test -f $(TOP)/.package; then \ @@\ + if test -f Makefile.SH; then \ @@\ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ @@\ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ @@\ + fi; \ @@\ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" jmakeflags; \ @@\ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) jmakeflags; \ @@\ + else touch $@; fi + + +/* + * BuildMakefile: + * Generate rules to build a Makefile from a Makefile.SH. + */ +#define BuildMakefile() @!\ +Makefile: Makefile.SH @@\ + /bin/sh Makefile.SH + + +/* + * MakefileTarget: + * Generate rules to build a normal Makefile. + */ +#define MakefileTarget() @!\ +BuildMakefileSH(^^) @!\ +BuildMakefile() + + +/* + * NormalObjectRule: + * Generate make rule to build usual object files. + */ +#define NormalObjectRule() @!\ +|once _ObjectRule_ @!\ +|rule:.c.o: @!\ +|rule: $(CC) -c $(JCFLAGS) $< @!\ +|rule: @!\ +-once + +/* + * NormalLibraryObjectRule: + * Generate make rules to build "normal" objects. + */ +#define NormalLibraryObjectRule() @!\ +|once _ObjectRule_ @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ @!\ +|rule: $(CC) -c $(JCFLAGS) $< @!\ +|rule: @!\ +-once + +/* + * ProfiledLibraryObjectRule: + * Generate make rules to build both profiled and "normal" objects. + */ +#define ProfiledLibraryObjectRule() @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ profiled/$@ @!\ +|rule: $(CC) -pg -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o profiled/$*.o @!\ +|rule: $(CC) -c $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ + $(RM) profiled/?*.o; fi + + +/* + * DebuggedLibraryObjectRule: + * Generate make rules to build both debuggable and "normal" + * objects. + */ +#define DebuggedLibraryObjectRule() @!\ +all:: @@\ + @if [ ! -d debugger ]; then mkdir debugger; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ debugger/$@ @!\ +|rule: $(CC) -g -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o debugger/$*.o @!\ +|rule: $(CC) -c $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ + $(RM) debugger/?*.o; fi + + +/* + * DebuggedAndProfiledLibraryOjbectRule: + * Generate make rules to build debuggable, profiled, and "normal" + * objects. + */ +#define DebuggedAndProfiledLibraryObjectRule() @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ profiled/$@ debugger/$@ @!\ +|rule: $(CC) -pg -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o profiled/$*.o @!\ +|rule: $(CC) -g -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o debugger/$*.o @!\ +|rule: $(CC) -c $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ + $(RM) profiled/?*.o; fi @@\ + -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ + $(RM) debugger/?*.o; fi + + +/* + * SharedLibraryObjectRule: + * Generate make rules to build shared and "normal" object files. + */ +#define SharedLibraryObjectRule() @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ shared/$@ @!\ +|rule: $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o shared/$*.o @!\ +|rule: $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ @@\ + $(RM) shared/?*.o; fi + +/* + * SharedAndDebuggedLibraryObjectRule: + * Generate make rules to build shared, debuggable, and "normal" + * object files. + */ +#define SharedAndDebuggedLibraryObjectRule() @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ shared/$@ debugger/$@ @!\ +|rule: $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o shared/$*.o @!\ +|rule: $(CC) -g -c $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o debugger/$*.o @!\ +|rule: $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ @@\ + $(RM) shared/?*.o; fi @@\ + -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ + $(RM) debugger/?*.o; fi + +/* + * SpecialSharedAndDebuggedObjectRule: + * Generate rules to compile a file with special flags and to make + * shared and debuggable versions. + */ +#define SpecialSharedAndDebuggedObjectRule(objs,depends,options) @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ shared/$@ debugger/$@ @@\ + $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c @@\ + $(MV) $*.o shared/$*.o @@\ + $(CC) -g -c $(SHLIBDEF) $(JCFLAGS) options $*.c @@\ + $(MV) $*.o debugger/$*.o @@\ + $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c + +/* + * SpecialSharedObjectRule: + * Generate rules to compile a file with special flags and to make + * shared and debuggable versions. + */ +#define SpecialSharedObjectRule(objs,depends,options) @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ shared/$@ @@\ + $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c @@\ + $(MV) $*.o shared/$*.o @@\ + $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c + + +/* + * SpecialObjectRule: + * Generate rules to compile a file with special flags. + */ +#define SpecialObjectRule(objs,depends,options) @!\ +objs: depends @@\ + $(RM) $@ @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * SpecialProfiledObjectRule: + * Generate rules to compile a file with special flags and to make a + * profiled version. + */ +#define SpecialProfiledObjectRule(objs,depends,options) @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ profiled/$@ @@\ + $(CC) -pg -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o profiled/$*.o @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * SpecialDebuggedObjectRule: + * Generate rules to compile a file with special flags and to make a + * debuggable version. + */ +#define SpecialDebuggedObjectRule(objs,depends,options) @!\ +all:: @@\ + @if [ ! -d debugger ]; then mkdir debugger; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ debugger/$@ @@\ + $(CC) -g -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o debugger/$*.o @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * SpecialDebuggedAndProfiledObjectRule: + * Generate rules to compile a file with special flags and to make + * debuggable and profiled versions. + */ +#define SpecialDebuggedAndProfiledObjectRule(objs,depends,options) @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ profiled/$@ debugger/$@ @@\ + $(CC) -pg -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o profiled/$*.o @@\ + $(CC) -g -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o debugger/$*.o @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * NormalLibraryTarget: + * Generate rules to create a library. The 'srclist' and 'objlist' + * parameters are added to SOURCES and OBJECTS macros. The 'srclist' + * is not otherwise used by this rule, but is necessary for make depend. + */ +#define NormalLibraryTarget(libname,srclist,objlist) @!\ +++OBJECTS objlist @!\ +++SOURCES srclist @!\ +NormalLibraryObjectRule() @!\ +AllTarget(lib^^libname.a) @!\ + @!\ +lib^^libname.a: objlist @@\ + $(RM) $@ @@\ + $(AR) $@ objlist @@\ + $(RANLIB) $@ + + +/* + * NormalSharedLibraryTarget: + * Generate rules to create a shared library; build it into a + * different name so that the we don't hose people by having the + * library gone for long periods. + */ +#define NormalSharedLibraryTarget(libname,rev,solist) @!\ +AllTarget(lib^^libname.so.rev) @!\ + @!\ +lib^^libname.so.rev: solist @@\ + $(RM) $@~ @@\ + (cd shared; $(LD) -o ../$@~ -assert pure-text solist) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ + +/* + * NormalSharedLibraryDataTarget: + * Generate rules to create shlib data file; build it into a + * different name so that the we don't hose people by having the + * library gone for long periods. + */ +#define NormalSharedLibraryDataTarget(libname,rev,salist) @!\ +AllTarget(lib^^libname.sa.rev) @!\ + @!\ +lib^^libname.sa.rev: salist @@\ + $(RM) $@ @@\ + $(AR) $@ salist @@\ + $(RANLIB) $@ + + +/* + * NormalLibraryTarget2: + * Generate rules to create a library in two steps. This is used to + * create libraries with large numbers of files. + */ +#define NormalLibraryTarget2(libname,srclist,objlist1,objlist2) @!\ +++SOURCES srclist @!\ +++OBJECTS objlist1 @!\ +++OBJECTS objlist2 @!\ +NormalLibraryObjectRule() @!\ +AllTarget(lib^^libname.a) @!\ + @!\ +lib^^libname.a: objlist1 objlist2 @@\ + $(RM) $@ @@\ + $(AR) $@ objlist1 @@\ + $(AR) $@ objlist2 @@\ + $(RANLIB) $@ + + +/* + * ProfiledLibraryTarget: + * Generate rules to create a profiled library. + */ +#define ProfiledLibraryTarget(libname,srclist,objlist) @!\ +++SOURCES srclist @!\ +++OBJECTS objlist @!\ +AllTarget(lib^^libname^^_p.a) @!\ + @!\ +lib^^libname^^_p.a: objlist @@\ + $(RM) $@ @@\ + cd profiled; $(AR) ../$@ objlist @@\ + $(RANLIB) $@ + + +/* + * DebuggedLibraryTarget: + * Generate rules to create a debuggable library. + */ +#define DebuggedLibraryTarget(libname,srclist,objlist) @!\ +++SOURCES srclist @!\ +++OBJECTS objlist @!\ +AllTarget(lib^^libname^^_d.a) @!\ + @!\ +lib^^libname^^_d.a: objlist @@\ + $(RM) $@ @@\ + cd debugger; $(AR) ../$@ objlist @@\ + $(RANLIB) $@ + + +/* + * AliasedLibraryTarget: + * Generate rules to link one library to another. + */ +#define AliasedLibraryTarget(libname,alias) @!\ +AllTarget(lib^^alias.a) @!\ + @!\ +lib^^alias.a: lib^^libname.a @@\ + $(RM) $@ @@\ + $(LN) lib^^libname.a $@ + + +/* + * PrelinkedRelocatableTarget: + * Generate rules to produce a relocatable object file instead of a + * library. + */ +#define PrelinkedRelocatableTarget(objname,objlist,libs) @!\ +AllTarget(objname.o) @!\ + @!\ +objname.o: objlist @@\ + $(RM) $@ @@\ + $(LD) $(JLDFLAGS) -r objlist -o $@ libs + + +/* + * NormalObjectTarget: + * Generate rules to produce a single object file.o from a file.c. + */ +#define NormalObjectTarget(file) @!\ +++SOURCES file^^.c @!\ +AllTarget(file^^.o) @!\ +NormalObjectRule() + +/* + * NormalRelocatableTarget: + * Generate rules to produce a relocatable object file instead of a + * library. + */ +#define NormalRelocatableTarget(objname,objlist) @!\ +AllTarget(objname.o) @!\ + @!\ +objname.o: objlist @@\ + $(RM) $@ @@\ + $(LD) $(JLDFLAGS) -r objlist -o $@ + + +/* + * ProfiledRelocatableTarget: + * Generate rules to produce a profiled relocatable object file + * instead of a library. + */ +#define ProfiledRelocatableTarget(objname,objlist) @!\ +AllTarget(objname^^_p.o) @!\ + @!\ +objname^^_p.o: objlist @@\ + $(RM) $@ @@\ + $(LD) -X -r objlist -o $@ + + +/* + * DebuggedRelocatableTarget: + * Generate rules to produce a debuggable relocatable object file + * instead of a library. + */ +#define DebuggedRelocatableTarget(objname,objlist) @!\ +AllTarget(objname^^_d.o) @!\ + @!\ +objname^^_d.o: objlist @@\ + $(RM) $@ @@\ + $(LD) -X -r objlist -o $@ + +/* + * LintLibraryTarget: + * Generate rules to create a lint library. Note that the lint + * library is always forced to be newer than the library itself. + */ +#define LintLibraryTarget(libname,srclist) @!\ +lintlib:: llib-l^^libname.ln @!\ + @!\ +llib-l^^libname.ln: srclist @@\ + $(RM) $@ @@\ + $(LINT) $(LINTLIBFLAG)^^libname $(LINTFLAGS) srclist + + +/* + * NormalLintTarget: + * Generate rules to lint a set of sources. + */ +#define NormalLintTarget(srclist) @!\ +lint: @@\ + $(LINT) $(LINTFLAGS) srclist $(LINTLIBS) + + +/* + * LintTarget: + * Generate rules to lint $(SOURCES) (automatically generated) + */ +#define LintTarget() @!\ +|once _LintTarget_ @!\ +NormalLintTarget($(SOURCES)) @!\ +-once + + +/* + * LinkSourceFile: + * Snag source file from some other directory + */ +#define LinkSourceFile(src,dir) @!\ +src: dir/src @@\ + $(RM) $@ @@\ + $(LN) $? $@ @!\ + + +/* + * MakeSubincludesForBuild: + * Make includes in sub directories. + */ +#define MakeSubincludesForBuild(step,dir,srclist) @!\ +step:: dir srclist @@\ + @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\ + set -x; cd dir; $(RM) $$list) @@\ + @for i in srclist; do \ @@\ + (set -x; cd dir; $(LN) ../$$i .) || exit 1; \ @@\ + done @!\ + @!\ +MakeDirectories(dir,dir) @!\ + @!\ +local_realclean:: @@\ + @-(if [ -d dir ]; then \ @@\ + list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\ + set -x; cd dir; $(RM) $$list; fi) + + +/* + * CommonSubdirsRule: + * Rule for making $(TARGET) in every subdirectory, with $(VERB) as + * verbose message and $(FLAGS) as additional flags. + */ +#define CommonSubdirsRule(dirs) @!\ +subdirs: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \ @@\ + $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)) || exit 1; \ @@\ + done + + +/* + * NamedTargetSubdirsRule: + * Recursively make a series of steps in the specified directories. + */ +#define NamedTargetSubdirsRule(dirs,name,verb,flags) @!\ +name:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + (cd $$i ; echo verb "in $(DIR)$$i..."; \ @@\ + $(MAKE) $(MFLAGS) flags name) || exit 1; \ @@\ + done + + +/* + * NamedTargetSubdirs: + * Recursively make a series of steps. + */ +#define NamedTargetSubdirs(name,verb,flags) @!\ +name:: @@\ + @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags + + +/* + * NamedSubTargetSubdirs: + * Recursively make a series of steps, like NamedTargetSubdirs. + * However, the supplied "name" has "sub_" prefixed to it. + */ +#define NamedSubTargetSubdirs(name,verb,flags) @!\ +sub_^^^name:: @@\ + @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags + +/* + * NamedDepthTargetSubdirs: + * Recursively make a series of steps. We first enter the + * subdirectories, then perform the local entries. + * The supplied "name" has "sub_" prefixed to it. + */ +#define NamedDepthTargetSubdirs(name,verb,flags) @!\ +sub_^^^name:: @@\ + @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags @@\ + @echo "Back to $(CURRENT) for "name^^... + + +/* + * MakeSubdirs: + * Generate rules to do makes in the given subdirectories. + */ +#define MakeSubdirs() \ +NamedTargetSubdirs(all,"Making all",^^) + + +/* + * DependDirs: + * Generate rules to recursively compute dependencies as part of the + * make depend step. + */ +#define DependDirs(dirs) \ +NamedTargetSubdirsRule(dirs,depend,"Depending",^^) + + +/* + * DependSubdirs: + * Generate rules to recursively compute dependencies as part of the + * make depend step. + */ +#define DependSubdirs() \ +DependDirs($(SUBDIRS)) + + +/* + * InstallSubdirs: + * Generate rules to recursively install and deinstall programs and + * files. + */ +#define InstallSubdirs() \ +NamedSubTargetSubdirs(install,"Installing",^^) @!\ +NamedDepthTargetSubdirs(deinstall,"Deinstalling",^^) + + +/* + * InstallManSubdirs: + * Generate rules to recursively install and deinstall manual pages. + */ +#define InstallManSubdirs() \ +NamedSubTargetSubdirs(install.man,"Installing man pages",^^) @!\ +NamedDepthTargetSubdirs(deinstall.man,"Deinstalling man pages",^^) + + +/* + * IncludesSubdirs: + * Generate rules to recursively put include files in build + */ +#define IncludesSubdirs() \ +NamedTargetSubdirs(includes,including,^^) + + +/* + * CleanSubdirs: + * Generate rules to recursively clean out garbage files. + */ +#define CleanSubdirs() \ +NamedDepthTargetSubdirs(clean,"Cleaning",^^) @!\ +NamedDepthTargetSubdirs(realclean,"Real cleaning",^^) @!\ +NamedDepthTargetSubdirs(clobber,"Clobbering",^^) + + +/* + * TagSubdirs: + * Generate rules to recursively create tags files. + */ +#define TagSubdirs(dirs) \ +NamedTargetSubdirsRule(dirs,tag,"Tagging",^^) + +/* + * MakeLintSubdirs: + * Generate rules to recursively lint directories as part of the + * named step. + */ +#define MakeLintSubdirs(dirs,target) \ +NamedTargetSubdirsRule(dirs,target,"Linting",^^) + + +/* + * LintDirs: + * Generate rules to recursively lint directories as part of the + * make lint step. + */ +#define LintDirs(dirs) \ +MakeLintSubdirs(dirs,lint) + + +/* + * LintSubdirs: + * Generate rules to recursively lint directories as part of the + * make lint step. + */ +#define LintSubdirs() \ +LintDirs($(SUBDIRS)) + + +/* + * MakeDirs: + * Creates a set of directories, even if some directories in the path + * do not already exist. There should be no '@!' at the end of the + * '#define' line, because this macro is used *inside* building rules. + */ +#define MakeDirs(dirs) \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for dir in dirs; do \ @@\ + (set -x; test -d $$dir || $(INSTALLDIR) $$dir) || \ @@\ + exit 1; \ @@\ + done + +/* + * _MakeInstallDirs: + * Creates a set of intall directories, even if some directories in the path + * do not already exist. There should be no '@!' at the end of the + * '#define' line, because this macro is used *inside* building rules. + */ +#define _MakeInstallDirs(dirs) \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for dir in dirs; do \ @@\ + _MakeInstallDir($$dir) \ @@\ + done + +/* + * _MakeInstallDir: + * Internal macro to create a missing install directory. + */ +#define _MakeInstallDir(dir) \ + (set -x; test -d $(INSTALL_PREFIX)^^^dir || \ @@\ + $(INSTALLDIR) $(INSTALL_PREFIX)^^^dir); + +/* + * _MakeInstallDirIgnore: + * Same as _MakeInstallDir but handles "make -i" as well. + */ +#define _MakeInstallDirIgnore(dir) \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + _MakeInstallDir(dir) + +/* + * _RmInstallDirs: + * Removes a set of intall directories. + * There should be no '@!' at the end of the '#define' line, because this + * macro is used *inside* building rules. + */ +#define _RmInstallDirs(dirs) \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for dir in dirs; do \ @@\ + (set -x; test -d $$dir && $(RM) -r $(INSTALL_PREFIX)$$dir); \ @@\ + done + +/* + * MakeDirectories: + * Generate rules to create a hierarchy of directories. + */ +#define MakeDirectories(step,dirs) @!\ +step:: @!\ + MakeDirs(dirs) + + +/* + * MakeInstallDirectories: + * Generate a rule to create a set of directories at installation + * time (removed by deinstall). + */ +#define MakeInstallDirectories(dirs) @!\ +local_install:: @@\ + _MakeInstallDirs(dirs) @!\ + @!\ +local_deinstall:: @@\ + _RmInstallDirs(dirs) + + +/* + * MakeLintLibSubdirs: + * Generate rules to recursively create lint libraries. + */ +#define MakeLintLibSubdirs(dirs) @!\ +MakeLintSubdirs(dirs,lintlib) + + +/* + * MakeMakeSubdirs: + * Generate rules to recursively recreate target as part of the + * specified step in the build. This assumes Makefile.SH has + * already been built (which is the case for a delivery), but does + * not rely on the existence of a Makefile. + */ +#define MakeMakeSubdirs(target) @!\ +target:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in $(SUBDIRS);\ @@\ + do \ @@\ + echo "Making "target" in $(DIR)$$i..."; \ @@\ + (cd $$i || exit 1; \ @@\ + if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \ @@\ + $(MAKE) $(MFLAGS) target) || exit 1;\ @@\ + done + + +/* + * MakeMakefilesSH: + * Generate rules to recursively recreate target as part of the + * specified step in the build. If $(TOP) is set to an absolute + * path, don't prepend the ../ prefix. This makes running things + * outside of the source tree to be much easier. + */ +#define MakeMakefilesSH() @!\ +Makefiles.SH:: Makefile.SH @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in $(SUBDIRS);\ @@\ + do \ @@\ + case "$(DIR)$$i/" in \ @@\ + ^^*^^/^^*^^/^^*^^/^^*^^/) newtop=../../../..;; \ @@\ + ^^*^^/^^*^^/^^*^^/) newtop=../../..;; \ @@\ + ^^*^^/^^*^^/) newtop=../..;; \ @@\ + *^^/) newtop=..;; \ @@\ + esac; \ @@\ + case "$(TOP)" in \ @@\ + /^^*) newtop="$(TOP)" ;; \ @@\ + esac; \ @@\ + echo "Making Makefiles.SH in $(DIR)$$i..."; \ @@\ + (cd $$i || exit 1; \ @@\ + if test -f Jmakefile; then \ @@\ + $(MAKE) $(MFLAGS) -f ../Makefile \ @@\ + Makefile TOP=$$newtop CURRENT=$(DIR)$$i && \ @@\ + $(MAKE) $(MFLAGS) Makefiles.SH; \ @@\ + fi; \ @@\ + ) || exit 1; \ @@\ + done + + +/* + * MakefileSubdirs: + * Generate rules to create Makefiles. + */ +#define MakefileSubdirs() @!\ +MakeMakeSubdirs(Makefiles) @!\ +MakeMakefilesSH() + + +/* + * CppScriptTarget: + * Generate rules to create a shell script by running the input + * through cpp. + */ +#define CppScriptTarget(dst,src,defs,deplist) @!\ +dst:: src deplist @@\ + $(RM) $@ @@\ + $(CPP) defs $@ @@\ + chmod a+x $@ + + +/* + * MakeScriptFromCpp: + * Generate rules to create a script from a file with a + * .cpp suffix. + */ +#define MakeScriptFromCpp(name,defs) @!\ +CppScriptTarget(name,name.cpp,defs,^^) + + +/* + * ShellScriptTargetExt: + * Generate rules to create and install a set of scripts from + * ext files (.sh and .SH are the most common examples). Man pages + * derived from the name of the scripts are also installed unless + * NoManPages() is specified. + */ +#define ShellScriptTargetExt(scripts,ext) @!\ +++SCRIPTS scripts @!\ +SimpleShellScriptTargetExt(scripts,ext) @!\ +InstallScripts() @!\ +InstallManScripts() + + +/* + * ShellScriptTarget: + * Generate rules to create and install a set of scripts from + * .SH files. Man pages derived from the name of the scripts are + * also installed unless NoManPages() is specified. + */ +#define ShellScriptTarget(scripts) @!\ +ShellScriptTargetExt(scripts,.SH) + + +/* + * SimpleShellScriptTargetExt: + * Generate rules to create a set of scripts from ext files where + * ext is usually something like .sh or .SH, or whatever file + * extension you like.. + */ +#define SimpleShellScriptTargetExt(scripts,ext) @!\ +AllTarget(scripts) @!\ + @!\ +|expand s!scripts! @!\ +!s: !s^^ext @@\ + /bin/sh !s^^ext @!\ + @!\ +-expand + + +/* + * SimpleShellScriptTarget: + * Generate rules to create a set of scripts from .SH files. + */ +#define SimpleShellScriptTarget(scripts) @!\ +SimpleShellScriptTargetExt(scripts,.SH) + + +/* + * ShellScriptLongTarget: + * Generate rules to create a set of scripts from .SH files where + * the name of the generated file is different from the basename of + * the .SH file (when, for instance, the total length with the .SH + * extension would not leave enough space for RCS ,v extension). + */ +#define ShellScriptLongTarget(basename,scriptname) @!\ +++LSCRIPTS scriptname @!\ +AllTarget(scriptname) @!\ + @!\ +scriptname: basename^^.SH @@\ + /bin/sh basename^^.SH @!\ + @!\ +InstallScripts() @!\ +?NOMAN:|skip @!\ +InstallManPageLong(basename,$(MANSRC),scriptname) @!\ +-skip + + +/* + * ForceTarget: + * The force target will force reconstruction of all the other + * targets which include .FORCE in their own dependencies. + */ +#define ForceTarget() @!\ +|once _force_ @!\ +.FORCE: @!\ + @!\ +-once + + +/* + * RemoteTargetDependency: + * A local target may rely on a remote dependency (e.g. a library) + * made in a separate directory. This rule explicits the dependency + * and forces a make of that dependency in the remote directory. + */ +#define RemoteTargetDependency(target,directory,dependency) @!\ +RemoteDependency(directory,dependency) @!\ +target: directory/^^^dependency @!\ + + +/* + * RemoteDependency: + * Specify rules for making a remote dependency. + */ +#define RemoteDependency(directory,dependency) @!\ +ForceTarget() @!\ +|once =directory/^^^dependency= @!\ +directory/^^^dependency: .FORCE @@\ + @echo "Checking "^^^dependency" in "^^^directory"..." @@\ + cd ^^^directory; $(MAKE) ^^^dependency @@\ + @echo "Continuing in $(CURRENT)..." @!\ + @!\ +-once + +/* + * SetSubdirs: + * Actually forces the definition of SUBDIRS, and lets the user + * specify what the sub-directories are. This will be added to the + * customization part. + */ +#define SetSubdirs(subdirs) @!\ +>SUBDIRS @!\ ++SUBDIRS = subdirs + + +/* + * NoManPages: + * Actually forces the definition of NOMAN, which tells the jmake + * program to not generate rules for installing manual pages. + */ +#define NoManPages() @!\ +>NOMAN + + +/* + * Expand: + * This powerful macro expands the `rule' given a `pattern'. It + * relies on a built-in command in jmake. The expansion is + * documented in the short notes file that comes with jmake and + * gives some insights on the internal syntax. + */ +#define Expand(rule, pattern) @!\ +|expand pattern @!\ +rule @!\ +-expand + + +/* + * Lex and yacc stuff. + */ + +/* + * YaccRule: + * This is the rule which is used to build a .c file from a .y file. + */ +#define YaccRule() @!\ +AddSuffix(.y) @!\ +|once _YaccRule_ @!\ +|rule:.y.c: @!\ +|rule: $(YACC) $(JYFLAGS) $< @!\ +|rule: $(MV) y.tab.c $@ @!\ +|rule: @!\ +-once + +/* + * SimpleYaccTarget: + * Declare a yacc base.y file to be used in the building of the + * specified target program. The source file must be given without + * its final .y extension. The name of the .c and .o will be + * derived from the source file basename provided. + */ +#define SimpleYaccTarget(program,base) @!\ +++SOURCES base.y @!\ +++OBJECTS base.o @!\ +YaccRule() @!\ +program: base.c @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * ComplexYaccTarget: + * Declare a yacc base.y file to be used in the building of the + * specified target program. The source file must be given without + * its final .y extension. The name of the .c and .o will be + * derived from the source file basename provided. + * The difference with SimpleYaccTarget is the identifying process + * where all the 'yy' are replaced by the specified prefix. + */ +#define ComplexYaccTarget(program,base,prefix) @!\ +++SOURCES base.y @!\ +++OBJECTS base.o @!\ +program: base.c @!\ + @!\ +base.c: base.y @@\ + $(YACC) $(JYFLAGS) base.y @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.c > base.c @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h @@\ + $(RM) y.tab.c y.tab.h @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * SimpleYaccInclude: + * Declare that program will need an include file produced by + * the output of yacc on base.y, which typically produces a file + * named y.tab.h, which will be renamed as base.h. + * The only problem is that the dependencies towards base.h have + * to be manually given in the Jmakefile. + */ +#define SimpleYaccInclude(base) @!\ +base.h: base.c @@\ + @if test -f y.tab.h; then \ @@\ + echo " $(MV) y.tab.h $@"; \ @@\ + $(MV) y.tab.h $@; \ @@\ + fi @!\ + @!\ +local_realclean:: @@\ + $(RM) base.h + +/* + * ComplexYaccInclude: + * Declare that program will need an include file produced by + * the output of yacc on base.y, which typically produces a file + * named y.tab.h, which will be renamed as base.h. + * The difference with SimpleYaccInclude is the identifying process + * of the y.tab.h file where all 'yy' are renamed to prefix. + * The only problem is that the dependencies towards base.h have + * to be manually given in the Jmakefile. + */ +#define ComplexYaccInclude(base,prefix) @!\ +base.h: base.c @@\ + @if test -f y.tab.h; then \ @@\ + echo " $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h"; \ @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h; \ @@\ + echo " $(RM) y.tab.h"; \ @@\ + $(RM) y.tab.h; \ @@\ + elif test -f base.h; then \ @@\ + echo " $(CP) base.h base.ht"; \ @@\ + $(CP) base.h base.ht; \ @@\ + echo " $(SED) -e 's/yy\(.\)/prefix\1/g' < base.ht > base.h"; \ @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < base.ht > base.h; \ @@\ + echo " $(RM) base.ht"; \ @@\ + $(RM) base.ht; \ @@\ + fi @!\ + @!\ +local_realclean:: @@\ + $(RM) base.h + + +/* + * NormalYaccTarget: + * Declare a yacc base.y file which should produce a base.c and + * base.h file as derived from the output of yacc, to be used by + * the specified program. + */ +#define NormalYaccTarget(program,base) @!\ +SimpleYaccTarget(program,base) @!\ +SimpleYaccInclude(base) + + +/* + * IdentifiedYaccTarget: + * Declare a yacc base.y file which should produce a base.c and + * base.h file as derived from the output of yacc, to be used by + * the specified program. The specified prefix is used to remplace + * all the 'yy' in the generated file, for use when more than a + * single parser is needed in one executable. + */ +#define IdentifiedYaccTarget(program,base,prefix) @!\ +ComplexYaccTarget(program,base,prefix) @!\ +ComplexYaccInclude(base,prefix) + + +/* + * SimpleLexTarget: + * This declares a lex base.l file which is to be ran through + * lex to produce a base.c file. + */ +#define SimpleLexTarget(program,base) @!\ +++SOURCES base.l @!\ +++OBJECTS base.o @!\ +|once _LexRule_ @!\ +|rule:.l.c: @!\ +|rule: $(LEX) $(JLFLAGS) $< @!\ +|rule: $(MV) lex.yy.c $@ @!\ +|rule: @!\ +-once @!\ +AddSuffix(.l) @!\ +program: base.c @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * IdentifiedLexTarget: + * This declares a lex base.l file which is to be ran through + * lex to produce a base.c file. The prefix is used to replace + * the 'yy', so that the lexical analyzer may be identified. + */ +#define IdentifiedLexTarget(program,base,prefix) @!\ +++SOURCES base.l @!\ +++OBJECTS base.o @!\ +program: base.c @!\ + @!\ +base.c: base.l @@\ + $(LEX) $(JLFLAGS) base.l @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < lex.yy.c > base.c @@\ + $(RM) lex.yy.c @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * NormalLexDependTarget: + * Declare that program will need an include file produced by + * the output of lex on base.l, which typically produces a file + * named lex.yy.c which will be renamed as base.c. Besides, the + * lexical analyzer needs the file parser.h produced by running + * parser.y through yacc and renaming y.tab.h as parser.h. + */ +#define NormalLexDependTarget(program,base,parser) @!\ +base.o: parser.h @!\ + @!\ +SimpleLexTarget(program,base) + + +/* + * IdentifiedLexDependTarget: + * Declare that program will need an include file produced by + * the output of lex on base.l, which typically produces a file + * named lex.yy.c which will be renamed as base.c. Besides, the + * lexical analyzer needs the file parser.h produced by running + * parser.y through yacc and renaming y.tab.h as parser.h. + * The lexical analyzer is identified with the supplied prefix, + * which replaces the regular 'yy' prefix in the symbol names. + */ +#define IdentifiedLexDependTarget(program,base,parser,prefix) @!\ +base.o: parser.h @!\ + @!\ +IdentifiedLexTarget(program,base,prefix) + + +/* + * NormalParserTarget: + * Specify that program is using the lex/yacc combination to + * produce a parser. The lexic and parser parameters are the + * base name of the .l and .y file, respectively. + */ +#define NormalParserTarget(program,lexic,parser) @!\ +NormalLexDependTarget(program,lexic,parser) @!\ +NormalYaccTarget(program,parser) + + +/* + * IdentifiedParserTarget: + * Specify that program is using the lex/yacc combination to + * produce a parser. The lexic and parser parameters are the + * base name of the .l and .y file, respectively. The parser + * produced is identified via its prefix, which replaces all + * the normally supplied 'yy' prefix, hence making it possible + * to have multiple parsers in a single executable. + */ +#define IdentifiedParserTarget(program,lexic,parser,prefix) @!\ +IdentifiedLexDependTarget(program,lexic,parser,prefix) @!\ +IdentifiedYaccTarget(program,parser,prefix) + + diff --git a/jmake/files/Jmake.tmpl b/jmake/files/Jmake.tmpl new file mode 100644 index 0000000..052ad5e --- /dev/null +++ b/jmake/files/Jmake.tmpl @@ -0,0 +1,253 @@ +/* + * Generic jmake template + * + * $Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp ram $ + * + * Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi + * + * You may redistribute only under the terms of the Artistic Licence, + * as specified in the README file that comes with the distribution. + * You may reuse parts of this distribution only within the terms of + * that same Artistic Licence; a copy of which may be found at the root + * of the source tree for dist 4.0. + * + * $Log: Jmake.tmpl,v $ + * Revision 3.0.1.3 1997/02/28 14:56:16 ram + * patch61: lex path can now be configured + * + * Revision 3.0.1.2 1995/01/11 14:50:21 ram + * patch45: now pre-computes INSTALL and INSTALLDIR variables + * + * Revision 3.0.1.1 1993/08/20 07:36:36 ram + * patch3: config.sh searching was not aborting properly + * + * Revision 3.0 1993/08/18 12:04:16 ram + * Baseline for dist 3.0 netwide release. + * + */ + +: Makefile.SH generated from Jmake.tmpl and Jmakefile +: $Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp ram $ + +/************************************************************************* + * * + * DO NOT MODIFY BELOW THIS LINE * + * * + *************************************************************************/ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/#*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +|expand cur!CURDIR! +CURRENT=!cur:^\./= +-expand +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" +/* + * Variable pre-computation. + */ +?INSTALL:INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +?INSTALLDIR:INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` +/* + * Makefile generation. + */ +$spitshell >Makefile <>Makefile <<'!NO!SUBS!' +#include + +%MKDEP:|skip /* Skip if no depend target */ +;######################################################################## +;# Force 'make depend' to be performed first -- do not edit + +.FORCE_DEPEND:: + +all:: .FORCE_DEPEND + +-skip /* Depend target */ +;######################################################################## +;# Start of Jmakefile +#include + +;######################################################################## +;# Common rules for all Makefiles -- do not edit +/* + * These need to be here so that rules in Jmakefile occur first; the blank + * all is to make sure that an empty Jmakefile doesn't default to make clean. + */ +emptyrule:: + +CleanTarget() +InstallTarget() + +/* + * The installation of manual pages is optional. When they say "none" in + * Configure, then they don't want any manual page and $installmansrc will + * be empty. + * + * To avoid protecting all the jmake rules for an empty destination, we use + * this clever hack: there is an "install.man-no" and an "install.man-yes" + * target defined, where the first does nothing and the second triggers + * the local install. The same goes for deinstall. + * + * If the `MANSRC' symbol is not wanted, then there is no manual page + * and we can force the -no version of the targets. + */ +%MANSRC:|skip /* Skip if no manual targets */ +!NO!SUBS! +case "$installmansrc" in +'') man=no;; +*) man=yes;; +esac +$spitshell >>Makefile <>Makefile <<'!NO!SUBS!' +-skip +?MANSRC:|skip /* Skip if it has manual targets */ +maybe_install.man: install.man-no +maybe_deinstall.man: deinstall.man-no +-skip + +MakefileTarget() +TagsTarget() + +%SUBDIRS:|skip /* Skip if no sub-directories */ +;######################################################################## +;# Rules for building in sub-directories -- do not edit + +CommonSubdirsRule($(SUBDIRS)) +InstallSubdirs() +InstallManSubdirs() +CleanSubdirs() +TagSubdirs($(SUBDIRS)) +MakefileSubdirs() +MakeSubdirs() + +/* + * Empty rules in case they don't define anything to be installed + * in this directory. + */ +local_install:: +local_deinstall:: +local_install.man:: +local_deinstall.man:: + +-skip /* Sub-directories */ +?SUBDIRS:|skip /* Skip if sub-directories */ +;######################################################################## +;# Empty rules for directories with no sub-directories -- do not edit + +local_install:: + @echo "install in $(CURRENT) done." + +local_deinstall:: + @echo "deinstall in $(CURRENT) done." + +local_install.man:: + @echo "install.man in $(CURRENT) done." + +local_deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." + +/* + * Action for 'Makefiles' would be required, if a .SUFFIXES: .SH rule + * were added, because in that case, a "/bin/sh Makefiles.SH" would + * be issued and raise an error. + */ +Makefiles:: + +Makefiles.SH:: + +-skip /* No sub-directories */ +%MKDEP:|skip /* Skip if no depend target */ +;######################################################################## +;# Dependencies generated by make depend +;# DO NOT DELETE THIS LINE -- make depend relies on it + +;# Put nothing here or make depend will gobble it up +.FORCE_DEPEND:: +?TOP: @echo "You haven't run a 'make depend' yet!"; exit 1 +%TOP: @echo "You must run 'make depend' in $(TOP) first."; exit 1 +-skip /* Depend target */ +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/jmake/fixcpp.SH b/jmake/fixcpp.SH new file mode 100755 index 0000000..24dd274 --- /dev/null +++ b/jmake/fixcpp.SH @@ -0,0 +1,183 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting jmake/fixcpp (with variable substitutions)" +$spitshell >fixcpp <>fixcpp <<'!NO!SUBS!' + +while ($ARGV[0] =~ /^-/) { + $_ = shift; + last if /--/; + $cpp_opt .= "$_ "; + next unless s/-I//; + push(@lookpath, $_); +} + +($file) = @ARGV; +$counter = 0; # Counter for temporary files + +$SIG{'INT'} = 'PLUMBER'; # Install cleaner in case of an interrupt... + +$result = &process($file); # Process file, result in a temporary +&cpp($result); # Pass resulting file with escaped \ to cpp +unlink $result; +exit 0; + +# Cleanup any temporary files... +sub PLUMBER { + warn "Could not cleanup all temporaries.\n" if @tmps != unlink(@tmps); + exit 1; +} + +# Compute a suitable temporary file name +sub mktmp { + $counter++; + local($tmp) = "/tmp/jmk.$counter.$$"; + push(@tmps, $tmp); # Keep track of them for &PLUMBER... + $tmp; +} + +# Process a given file, returning the name of the temporary file into which +# the result is left over. +# This routine is recursively called to process nested include directives. +sub process { + local($file) = @_; + local(*FILE, *TMP); + open(FILE, $file) || die "Can't read $file: $!\n"; + local($tmpfile) = &mktmp; + open(TMP, ">$tmpfile") || die "Can't create $tmpfile: $!\n"; + local($here, $include); + local($_); + while () { + if (s/^#\s*include\s*//) { # Ah, we found a #include something... + chop; + if (/"(\S+)"/) { + ($include, $here) = ($1, 1); + } elsif (/<(\S+)\>/) { + ($include, $here) = ($1, 0); + } else { + warn "Ignoring unkown include directive $_.\n"; + next; + } + local($incfile) = &lookup($include, $here); + unless (defined $incfile) { + warn "Can't locate include file $include.\n"; + next; + } + $include = &process($incfile); # Recursively process this file + &append($include, 'TMP'); # Append result to current tmp file + unlink $include; + } else { + &escape; + print TMP; + } + } + close FILE; + close TMP; + $tmpfile; # Return name of file where results has been left over +} + +# Perform necessary escaping work on current line. +sub escape { + # Don't escape trailing backslashes in macro definition or cpp + # won't see them as macro continuation any longer, and also within + # macro definitions, all those @@ or @! continuations... + s/\\$/\\ \015/ unless /\@[!@]\\$/ || /^#define/; +} + +# Append file to given (opened) file descriptor +sub append { + local($file, $fd) = @_; + local(*FILE); + open(FILE, $file) || die "Can't re-open $file: $!\n"; + local($_); + while () { + &escape; + print $fd $_; + } + close FILE; +} + +# Lookup file, returning its located name or undef if not found. +sub lookup { + local($file, $here) = @_; + unless ($here) { + foreach $dir (@lookpath) { + if (-r "$dir/$file") { # Use -r instead of -f for symlinks + $file = "$dir/$file"; + last; + } + } + } + return undef unless -r $file; + $file; +} + +# This is the final cpp processing. The output from cpp is filtered to un-escape +# all the trailing backslashes. +sub cpp { + local($file) = @_; + open(CPP, "$cpp $cpp_opt $file |") || die "Can't fork: $!\n"; + while () { + s/\\ \015$/\\/; # Un-escape trailing \ + print STDOUT; + } + close CPP; +} + +!NO!SUBS! +chmod 755 fixcpp +$eunicefix fixcpp diff --git a/jmake/jmake.SH b/jmake/jmake.SH new file mode 100755 index 0000000..3f676b2 --- /dev/null +++ b/jmake/jmake.SH @@ -0,0 +1,526 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting jmake/jmake (with variable substitutions)" +$spitshell >jmake <>jmake <<'!NO!SUBS!' + +($me = $0) =~ s|.*/(.*)|$1|; +$dir = &tilda_expand($dir); # ~name expansion +$file = $dir . '/Jmake.tmpl'; + +$cpp_opt = "-I. "; # For Jmakefile, which is local +while ($ARGV[0] =~ /^-/) { + $_ = shift; + last if /--/; + $cpp_opt .= "$_ "; +} +$cpp_opt .= "-I$dir"; + +# Pass 0 is looking at the template for "?CP:CP =" lines that are to be +# emitted if the CP variable is needed. Later on, when we see $(CP) being +# used, we'll be able to set the $symbol{CP} entry to 1 to have the CP +# variable initialized by the template. + +open(TMPL, $file) || die "$me: can't open $file: $!\n"; +while () { + next unless /^\?([\w_]+):\1\s+=/; + $wanted{$1}++; +} +close TMPL; + +# Thank you HP-UX for having a cpp that blindly strips trailing backslashes +# in the text. Run through cpp by using the fixcpp script... + +open(CPP, "$dir/fixcpp $cpp_opt $file |"); +while () { + # Record defined symbols in Jmakefile. We won't catch symbols + # in conditional commands, but that's ok, I hope. + if ($in_symbol) { + $val = $_; + $in_symbol = 0 if !($val =~ s/\\\s*$//); # Last line + if ($val = /^\|expand/) { # Found an expand command + $in_symbol = 0; # Stop gathering value + $val .= "void::x"; # Stop any incomplete escape sequence + } + chop($val); + $Makesym{$current_symbol} .= $val; + } elsif (/^\s*(\w+)\s*=(.*)/ && !$in_symbol) { + # Found a makefile's macro declaration + $val = $2; + $current_symbol = $1; + if ($val =~ s/\\\s*$//) { # Remove final '\' + $in_symbol = 1; # This is a continuation line + } + $Makesym{$current_symbol} = $val; + push(@Order, $current_symbol); # Keep track of order + } + # Protect RCS keyword Id or Header from normal substitution + s/\$(Id|Header|Log)/\$X-$1/; + # Restore possibly escaped C comments + s|/#\*|/*|g; + s|\*#/|*/|g; + # Remove all ^^^ (null space character) up to next non-space character + s|\^\^\^\s*||g; + # Remove all ^^ (null space character) + s|\^\^||g; + # Restore escaped ^^ and ^^^ sequences + s|\^\\\^\\\^|^^^|g; + s|\^\\\^|^^|g; + next if /^#\s+\d+/; # Skip cpp commments + + s/^;#/#/; + s/@#\s?/\n/g; # Kept for backward compatibility + s/@!\s?/\n/g; + s/@@\s?/\n\t/g; + + $* = 1; + # A '\r' is added to all lines, in order to let 'split' keep them + # As lines ending with '\' won't fit in the next regular + # expression (why ?), we have to treat that special case separately + s/\n$/\r\n/g; + s/\\\s*$/\\\r/g; # Remove spaces after final '\' and add '\r' + $* = 0; + @macro = split(/\n/); + for ($i = 0; $i <= $#macro; $i++) { + chop($_ = $macro[$i]); # Remove final '\r' + s/\s+$//g; # Remove possible useless spaces + if (/^TOP\s*=\s*(\S+)/) { # Get the top from generated file + $top = $1; + } + find_wanted($_); # Look for known $(VAR) usage + if (s/^\s*>//) { # '>' means "symbol wanted" + warn "$me: the '>$_' construct is deprecated for known symbols\n" + if $wanted{$_} && !$warned_wanted_symbol_deprecated++; + $symbol{$_} = 1; + } elsif (s/^\s*\+//) { # '+' means "initialization section" + if (s/^\+(\w+)//) { # '++' means add to variable list + $added{$1} .= $_; + } else { # A single '+' means "add as is". + push(@init, $_); + } + } elsif (s/^\|//) { # Command for us + if (/suffix\s+(\S+)/) { # Add suffix + push(@suffix, $1) unless $seen{$1}; + $seen{$1} = 1; + } elsif (s/^rule://) { # Add building rule + s/^\s(\s*\S+)/\t$1/; # Make sure leading tab is there + push(@rule, $_); + } elsif (/^skip/) { # Unconditional skip... funny! + push(@makefile, "|$_"); # Skip handled in pass 2 + } elsif (/^expand/) { + push(@makefile, "|$_"); # Expand handled in pass 2 + } elsif (/^once\s+(.*)/) { # Once handled in pass 1 + if ($Once{$1}++) { # Symbol already seen -- skip + for (; $i <= $#macro; $i++) { + last if $macro[$i] =~/^-once/; + } + warn("$me: -once not found for $1") + unless $macro[$i] =~/^-once/; + } + } elsif (/^shell/) { # Escaping to shell + push(@makefile, "|$_"); # will be handled in pass 2 + } elsif (/^case/) { # Conditional generation + push(@makefile, "|$_"); # will be handled in pass 2 + } elsif (/^subst/) { # Section with var substitution + push(@makefile, "|$_"); # will be handled in pass 2 + } else { + print "$me: Warning: unknown command $_\n"; + } + } else { + next if /^-once/; # Control statement removed + push(@makefile, $_); + } + } +} +close CPP; + +@key = keys(%added); +$last_was_blank = 1; # To avoid blank line at the top of the file +$symbol{'INIT'} = 1 if ($#init >= 0 || $#key >=0); # Initializations +$symbol{'SUFFIX'} = 1 if ($#suffix >= 0 || $#rule >=0); # Rules or suffixes +$symbol{'TOP'} = 1 if $top eq '.'; # If imake invoked for the top + +$shellmode = 0; # Set to true within "shell" section +$casemode = 0; # Counts nesting levels within "case" section +$substmode = 0; # True when within section with variable substitution + +$SPIT_START = "\$spitshell >>Makefile <<'!NO!SUBS!'\n"; +$SPIT_END = "!NO!SUBS!\n"; +$GROK_START = "\$spitshell >>Makefile <Makefile.SH"); +# We have to use for instead of foreach to handle 'skip' easily +line: for ($i = 0; $i <= $#makefile; $i++) { + $_ = $makefile[$i]; + next if /^-skip|-expand/; # They might have made a mistake + + # Strip consecutive blank lines in generated file + + if (/^\s*$/) { + next if ($last_was_blank); + $last_was_blank = 1; + } else { + $last_was_blank = 0; + } + + # In shell mode, we're transparent, untill we reach a "-shell" + # We don't call print_makefile() as we don't want to record + # those non-makefile lines in the @Generated array. + + if ($shellmode) { + if (/^-shell/) { # Ending shell mode, back to Makefile + print MAKEFILE $substmode ? $GROK_START : $SPIT_START; + $shellmode = 0; + } elsif (/^\|shell/) { + die "$me: can't nest 'shell' sections.\n"; + } else { + print MAKEFILE "$_\n"; + } + next; + } elsif (/^\|shell/) { + print MAKEFILE $substmode ? $GROK_END : $SPIT_END; + $shellmode = 1; # Next lines emitted verbatim as shell + next; + } + + # In subst mode, the section until "-subst" is emitted regularily, + # excepted that it will be in a grok section, so its $var will be + # substituted by the shell. + + if ($substmode) { + if (/^-subst/) { # Ending subst mode, back to regular + print MAKEFILE $GROK_END; + print MAKEFILE $SPIT_START; + $substmode = 0; + next; + } elsif (/^\|subst/) { + die "$me: can't nest 'subst' sections.\n"; + } + # Continue with line + } elsif (/^\|subst/) { + print MAKEFILE $SPIT_END; # End spit section in Makefile.SH + print MAKEFILE $GROK_START; + $substmode = 1; # Next lines subject to $ interpretation + next; + } + + # In a "case" section, the Makefile will be conditionally generated + # based on the value of the supplied variable, as evaluated by the shell. + # We can nest "case" sections without problems. + + if (/^-case/) { # Ending current case section + if ($casemode == 0) { + warn "$me: ignoring spurious '-case'\n"; + next; + } + print MAKEFILE $substmode ? $GROK_END : $SPIT_END; + my $indent = "\t" x ($casemode - 1); + print MAKEFILE "${indent}\t;;\n"; + print MAKEFILE "${indent}esac\n"; + print MAKEFILE "${indent}", $substmode ? $GROK_START : $SPIT_START; + $casemode--; + next; + } + + if (/^\|case/) { + my ($var, $value) = /^\|case\s+(\w+)\s+in\s+(.*)/; + die "$me: unparseable directive '$_'\n" if $var eq ''; + $casemode++; + print MAKEFILE $substmode ? $GROK_END : $SPIT_END; + my $indent = "\t" x ($casemode - 1); + print MAKEFILE "${indent}case \"\$$var\" in\n"; + print MAKEFILE "${indent}$value)\n"; + print MAKEFILE "${indent}\t", $substmode ? $GROK_START : $SPIT_START; + next; + } + + # Process regular line to be generated in Makefile.SH + + s//[jmake $version PL$patchlevel]/; + + # Lines starting with ?SYMBOL: (resp. %SYMBOL:) are to be processed + # only if SYMBOL is defined (resp. undefined). + + # Apply in sequence + while (/^\s*\?|\s*%/) { + if (s/^\s*\?(\w+)://) { # Wanted symbol ? + next line unless $symbol{$1}; + } elsif (s/^\s*%(\w+)://) { # Unwanted symbol ? + next line if $symbol{$1}; + } else { + print "$me: Warning: missing ':' in $_\n"; + last; + } + } + + # We wish to make sure there is a leading tab if the line starts with + # a space to prevent problems later on. However, variable definitions + # might want to be aligned on the '=' (imake style). Not all make + # may be able to cope with those though, so they are left justified + # again. + + s/^\s/\t/ unless /^\s+\w+\s+=/; # Make sure leading tab is there + s/^\s+(\w+\s+=)/$1/; # Left justify variable definition + s/^;#/#/; # Comments in Jmakefile + + if (s/^\|//) { # Command for us + if (/^skip/) { # Skip until -skip + for (; $i <= $#makefile; $i++) { + last if $makefile[$i] =~ /^-skip/; + } + } elsif (s/^expand//) { + &init_expand($_); # Initializes data structures + $i++; # Skip expand line + undef @Expand; # Storage for expanded lines + $pattern = ''; # Assume no pattern + for (; $i <= $#makefile; $i++) { + $_ = $makefile[$i]; + if (s/^-expand//) { # Reached end of expansion + if (s/^\s*(.*)/$1/) { # Expand followed by a pattern + $pattern = $_; # Get pattern to be removed + } + last; + } + s/^\s/\t/; # Make sure leading tab is there + push(@Expand, $_); # Line to be expanded + } + &expand($pattern); # Expand all lines in buffer + } else { + die "$me: unknown command $_\n"; + } + } elsif (/^INIT/) { # Initialization section + # All the initializations are put in the variable substitution + # section of the Makefile.SH. Therefore, we have to protect all + # the '$' signs that are not followed by an alphanumeric character. + foreach (@init) { + # Dumps core sometimes with perl 4.0 PL10 + # &protect_dollars(*_); + $_ = &protect_dollars($_); + &print_makefile($_); + } + foreach (@key) { # @key set earlier to keys(%added) + $_ .= " = " . $added{$_}; + # Dumps core sometimes with perl 4.0 PL10 + # &protect_dollars(*_); + $_ = &protect_dollars($_); + &print_makefile($_); + } + } elsif (/^SUFFIX/) { # Suffixes/Rules section + # Rules and suffixes are put in the variable substitution + # section of the Makefile.SH. Therefore, we have to protect all + # the '$' signs that are not followed by an alphanumeric character. + if ($#suffix >= 0) { + print MAKEFILE ".SUFFIXES:"; + foreach (@suffix) { + # Dumps core sometimes with perl 4.0 PL10 + # &protect_dollars(*_); + $_ = &protect_dollars($_); + print MAKEFILE " $_"; + } + print MAKEFILE "\n\n"; + } + foreach (@rule) { + # Dumps core sometimes with perl 4.0 PL10 + # &protect_dollars(*_); + $_ = &protect_dollars($_); + print MAKEFILE "$_\n"; + } + } else { + &print_makefile($_); + } +} +close MAKEFILE; + +sub protect_dollars { + # Dumps core sometimes with perl 4.0 PL10 + # local(*_) = shift(@_); + s/\\\$/\\=/g; # Protect already escaped '$' + s/(\$\W)/\\$1/g; # Escape unprotected '$' + s/\\=/\\\$/g; # Restore escaped '$' + $_; # Because perl dumps core... :-( +} + +# Initializes data structures for expansion. If we detect Makefile +# macro in the 'expand' line (the argument), then we write a small +# makefile that will do the substitution for us -- I'm lazy today :-) +sub init_expand { + local($_) = shift(@_); + undef %Vars; # Reset array of variables + $Vars_len = 0; # Number of "symbols" in first expanded + if (/\$\(\w+\)/) { # If at least one macro + local($make) = "/tmp/mkjm$$"; + open(MAKE, ">$make") || die "$me: can't create $make: $!\n"; + &gen_variables(); # Generates already computed variables + foreach $var (@Order) { # Print each in order we found them + print MAKE "$var = $Makesym{$var}\n" if !$Gvars{$var}; + } + # We prepend OUTPUT: in front of the line that interests us, because + # some makes can print extra information, especially GNU make with + # its entering/leaving blurb when invoked from another makefile. + print MAKE "all:\n\t\@echo 'OUTPUT: $_'\n"; + close MAKE; + chop($_ = `make -f $make all | grep ^OUTPUT:`); + unlink($make); + } + s/^OUTPUT: //; + while (s/^\s*(\w+)!([^!]*)!//) { + $Vars{$1} = $2; + # Record only length for _first_ expanded symbol + $Vars_len = split(/\s\s*/, $2) unless $Vars_len; + } +} + +# Expand lines in the @Expand array. The argument is a pattern which is to +# be removed from the last chunk of expanded lines. +# For each symbol s, !s is replaced by the next item, and !s:p=q does the +# same after having replaced the pattern 'p' by pattern 'q' in the item. +# Spaces are NOT allowed in 'p' or 'q'. Substitution is done once (no /g). +sub expand { + local($pattern) = shift; # To-be-removed pattern for last chunk + local($_); + local($sub); + local($i); + local(@expands); + for ($i = 0; $i < $Vars_len; $i++) { + foreach $line (@Expand) { + $_ = $line; # Don't modify elements in array + foreach $sym (keys %Vars) { + @expands = split(/\s\s*/, $Vars{$sym}); + $sub = $expands[$i]; + $sub =~ s/\/\///g; # // is a void value + while (s/!${sym}:([^\s]*)=([^\s]*)/,x##x,/) { + # Replacing item is altered by some pattern + local($p) = $1; + local($q) = $2; + local($subq) = $sub; + eval "\$subq =~ s=${p}=${q}="; + s/,x##x,/${subq}/; + } + s/!${sym}/${sub}/g; + } + # Protect substitution in an 'eval' in case of error + eval "s/${pattern}\$//" if $pattern && $i == ($Vars_len - 1); + &print_makefile($_); + } + } +} + +# Prints its argument in MAKEFILE and records it also in Generated +sub print_makefile { + local($_) = shift(@_); # Line to be printed + print MAKEFILE "$_\n"; + push(@Generated, "$_\n"); +} + +# Generates in MAKE file all the generated variable we have so far for +# final Makefile. This is mainly intended to allow expansion of variables +# which are already defined with an expand. +sub gen_variables { + undef %Gvars; # Reset already generated variables + local ($in_symbol) = 0; # True when in variable (Makefile's macro) + foreach (@Generated) { + if ($in_symbol) { + if (/^\s*(\w+)\s*=(.*)/) { # Missed the end of previous macro + $in_symbol = 0; + $Gvars{$1} = 1; # Definition of variable seen + $in_symbol = 1 if (/\\\s*$/); # There is a final '\' + print MAKE "void::\n"; # Cut incomplete esc sequence + } else { + $in_symbol = 0 if !(/\\\s*$/); # Last line + } + print MAKE; + } elsif (/^\s*(\w+)\s*=(.*)/ && !$in_symbol) { + # Found a makefile's macro declaration + $Gvars{$1} = 1; # Definition of variable seen + $in_symbol = 1 if (/\\\s*$/); # There is a final '\' + print MAKE; + } + } + print MAKE "void::\n"; # Cut incomplete escape sequence +} + +# Parse line to extract all $(VAR) usage and trigger the symbol if VAR +# is among the wanted set, as if they had manually said ">VAR" like in +# the old days. +sub find_wanted { + my ($l) = @_; + while ($l =~ s/\$\(([\w_]+)\)//) { + $symbol{$1}++ if $wanted{$1}; + } +} + +!NO!SUBS! +$grep -v '^;#' ../pl/tilde.pl >>jmake +chmod 755 jmake +$eunicefix jmake diff --git a/jmake/jmake.man b/jmake/jmake.man new file mode 100644 index 0000000..2b0997f --- /dev/null +++ b/jmake/jmake.man @@ -0,0 +1,491 @@ +''' $Id: jmake.man,v 3.0.1.3 2004/08/22 09:01:55 ram Exp ram $ +''' +''' Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 4.0. +''' +''' $Log: jmake.man,v $ +''' Revision 3.0.1.3 2004/08/22 09:01:55 ram +''' patch71: renamed |test as |case as the construct has its syntax +''' patch71: added |subst section to allow variable substitutions +''' +''' Revision 3.0.1.2 2004/08/21 23:19:52 ram +''' patch71: added '|shell' section to emit verbatim code in Makefile.SH +''' patch71: new '|test' to conditionally generate Makefile sections +''' +''' Revision 3.0.1.1 1995/05/12 11:57:58 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0 1993/08/18 12:04:18 ram +''' Baseline for dist 3.0 netwide release. +''' +.TH JMAKE 1 ram +.SH NAME +jmake \- a generic makefile builder +.SH SYNOPSIS +.B jmake +[ +.I cpp options +] +.SH DESCRIPTION +.I Jmake +builds a makefile out of a rather high level description held in a +.I Jmakefile +file. The generated file is a +.I Makefile.SH +rather than a simple makefile, which means it is ready to be used in +conjonction with +.I metaconfig. +In particular, parameters such as "where to install executables" will +be automatically determined by +.I Configure +and only the needed parameters will be taken into account. +.PP +To use +.I jmake +you have to write a +.I Jmakefile +first, which describes the way things are to be built. Your +.I Jmakefile +will be included inside a generic template through the C pre-processor. +This means you may use the usual C /**/ comments, but not the shell # comments. +The C comments will not appear in the generated +.I Makefile.SH +but lines starting with ;# will finally appear as shell comments. If you +have to write the string /* in the generated +.I Makefile.SH +then you have to escape it (otherwise +.I jmake +will think of it as the start of a C comment). Simply put a # in front +of the *, as in /#*. +.PP +You have a set of macros at your disposal, and all these macros are +listed in the Index file, along with the piece of code they will +expand to. Usually, a +.I Jmakefile +is fairly small and thus easier to maintain than a huge +.I Makefile. +Some internal powerful commands allow you to write +portable makefiles easily, without having to spend many efforts, because +someone else already did the job for you :-). +.PP +When you want to generate your makefile, you usually do not run +.I jmake +but use the +.I jmkmf +script which is a wrapper and will invoke +.I jmake +with the correct options. +.PP +All the knowledge of +.I jmake +is held in two files: the template +.I Jmake.tmpl +and the macro definition file +.I Jmake.rules. +The first file includes the second, along with the +.I Jmakefile. +It is sometimes necessary to know how things works to be able to correctly +use all the features provided. For instance, you may have to write your +own rules for a specific project. Although you cannot overwrite the +predefined rules, you can extent the +.I Jmake.rules +file or simply add your macros in your +.I Jmakefile. +You may also use +.I #include +statements when you want to share these macros and do not want to duplicate +the code. +.PP +The syntax in Jmake.rules is not elegant at all, but: +.sp +.PD 0 +.IP - +It is easy to parse (like sendmail.cf or troff files). +.IP - +The rules are not supposed to change very often. +.IP - +It is simple enough to be mastered in five minutes. :-) +.sp +Here is a small description: +.sp +.IP 1) +To deal with various \fIcpp\fR implementations: +.sp +.RS +.IP \(bu +Final @!\\ means: end of line, next line starts at the left margin. +.IP \(bu +Final @@\\ means: end of line, next line is to be indented by one tab. +.sp +.PP +There should always be one of @!\\ or @@\\ at the end of each line. +The only exception is for macros that are to be used as part of a +rule body (e.g. \fIRemoveTargetProgram\fR). In that case, the first +line (which holds the \fI#define\fR) should end with a single backslash. +.RE +.sp +.IP 2) +Symbol definitions: +.sp +.RS +.IP \(bu +>SYMBOL: defines the symbol. +.IP \(bu +?SYMBOL:: keeps iff SYMBOL is defined. +.IP \(bu +%SYMBOL:: keeps iff SYMBOL is not defined. +.sp +.PP +The ?SYM can be nested (logical AND), as in: +.sp +.in +5 +?SYMBOL:%TOKEN:text +.in -5 +.sp +which will keep text if SYMBOL is defined and TOKEN undefined. +To implement a logical OR, see below. +.RE +.sp +.IP 3) +Commands: +.sp +.RS +Commands can be passed to \fIjmake\fR. They start with a leading '|'. +Available commands are: +.sp +.IP \(bu +|suffix : adds to the .SUFFIXES: list in the makefile. +.sp +.IP \(bu +|rule:: adds to the building rule section. +.sp +.IP \(bu +|rule: : same as before, with a leading tab. +.sp +.IP \(bu +|skip: skips text until a line starting with '-skip' is found. +.sp +.IP \(bu +|subst: begins section where lines will be subject to variable substitution, +until '-subst' is found. This means that when the Makefile.SH is run, all +instances of $var within the \fIsubst\fR section will be substituted by the +shell. +.sp +.IP \(bu +|shell: emits section until matching '-shell' as-is in the generated +Makefile.SH. This can be useful to prepare \fI|case\fR sections. It is +not allowed to nest \fIshell\fR sections. +.sp +.IP \(bu +|case: this command must be followed by a shell variable name (without +its leading '$' sign) and a case-style pattern, for instance the string +"var in f*". It will generate the corresponding "case" test in the +Makefile.SH on the "$var" value and only if this test is true will the +section until the matching '-case' be generated in the Makefile when +Makefile.SH is run. It is possible to nest \fIcase\fR sections freely. +.sp +.IP \(bu +|expand : expand lines until '-expand' with . A +complete example is shown below. +.sp +.IP \(bu +|once : text up to '-once' appears only the first time. +.sp +.PP +The '|' commands cannot be nested, unless otherwise noted. +In particular, due to the simple +implementation of \fI|skip\fR, it is impossible to put \fI|skip\fR inside +a skipped part. However, a \fI|once\fR section may have \fI|skip\fR sections. +It is allowed to nest \fI|case\fR sections at will. +.sp +.PP +Here is a way to implement a logical OR: +.sp +.in +5 +.nf +/* Implements SYMBOL or not TOKEN */ +?SYMBOL:text /* Keeps text if SYMBOL */ +%SYMBOL:|skip + %TOKEN:text /* Keeps text if not TOKEN */ +-skip +.fi +.in -5 +.sp +Actually, this is ugly, because the text has to appear twice. +Fortunately, I did not use it. :-) +.sp +But actually, as you have surely already guessed, the best way to +implement a logical OR is to use De Morgan's Law: +.sp +.in +5 +.nf +not (p or q) <=> not p and not q + +/* Implements SYMBOL or not TOKEN (attempt #2) */ +%SYMBOL:?TOKEN:|skip +text /* If SYMBOL or not TOKEN */ +-skip +.sp +.in -5 +.fi +Who said they didn't care ? ;-) +.sp +.PP +Expansion is done with the \fIexpand\fR command. It has been provided to +avoid some cumbersome writings in makefiles when you have to repeat some +silly lines that only differ in file names, for instance. Let's look at +an example first: +.sp +.in +5 +.nf +|expand a!foo bar! b!yes no! +!a:: + echo !a, !b +-expand +.fi +.in -5 +.sp +.PP +Then two rules will be printed, and the values of (a,b) for the first +will be (foo, yes), for the second (bar, no). Substitution is controled +by the '!' character. If the word to be substituted is part of another +one, detach with the ^^ construct as in: !b^^c. It is possible to +use Makefile macros in the , and they will be expanded by +jmake. If this is not what you want, escape the first '$' sign (this is +a Makefile escape, i.e. you must double the '$', not precede it with a +backslash). A // stands for the null substitution value. +.PP +The ^^^ construct behaves like ^^, i.e. it is stripped out, but it also +removes any following white space after the ^^^. If you prepend something +to a macro argument, and that macro argument was written with spaces before +it, then this will let you concatenate something right before that argument's +final value. +.sp +.PP +Here is another example which shows how the macro Expand can be used. +It is defined in \fIJmake.rules\fR as: +.sp +.in +5 +.nf +#define Expand(rule, pattern) @!\\ +|expand pattern @!\\ +rule @!\\ +-expand +.sp +.in -5 +.fi +So we can write in the \fIJmakefile\fR: +.sp +.in +5 +.nf +|skip +A = foo bar +-skip + +#define Rule @!\\ +$(DIR)/!a^^.o: !a^^.o @@\\ + $(CC) -c !a^^.c @@\\ + $(MV) !a^^.o $(DIR) + +Expand(Rule, a!$(A)!) +.sp +.in -5 +.fi +which will generate in \fIMakefile.SH\fR: +.sp +.in +5 +.nf +$(DIR)/foo.o: foo.o + $(CC) -c foo.c + $(MV) foo.o $(DIR) + +$(DIR)/bar.o: bar.o + $(CC) -c bar.c + $(MV) bar.o $$(DIR) +.sp +.in -5 +.fi +.sp +.PP +The 'A' declaration has been surrounded by \fIskip\fR, so that it does +not appear in the generated Makefile.SH, but it will be taken into +account by \fIjmake\fR for the substitution in the pattern. +.sp +.PP +The number of expansions is determined by the number of possible +values for the \fBfirst\fR parameter. If other parameters have less +substitution values, they will get void ones. +.sp +.PP +It is possible to add a regular expression at the end of '-expand'. This +regular expression will be removed from the final set of expansion at the +end of each line. It is also possible to do substitutions in the expanded +item, by using the syntax (if 'f' is the expanded variable) +!f:\fI

\fR=\fI\fR +where \fI

\fR and \fI\fR are two regular expressions (without spaces). +The pattern \fI

\fR will be replaced by the pattern \fI\fR (only the first +occurrence will be replaced). +.sp +.PP +Finally, you may refer in the expanded section to variables whose value is +computed via another expansion, which makes it easy to define generic +\fIJmakefiles\fR. +.sp +Example: +.sp +.in +5 +.nf +SRC = foo.c bar.c +OBJ = \\ +|expand f!$(SRC)! + !f:\\.c=\\.o \\ +-expand \\\\ +INC = \\ +|expand f!$(OBJ)! + !f:\\.o=\\.h \\ +-expand \\\\ +.fi +.in -5 +.sp +which will generate in \fIMakefile.SH\fR: +.sp +.in +5 +.nf +SRC = foo.c bar.c +OBJ = \\ + foo.o \\ + bar.o +INC = \\ + foo.h \\ + bar.h +.in -5 +.fi +.sp +Do not forget to protect special characters in your regular expressions such +as backslash, point, etc... +.sp +.PP +The \fIonce\fR command is tagged with a name. The first time the name +appears, the once construct is ignored and the text up to '-once' will +be copied in the generated Makefile.SH. However, future occurences of +the same name will be ignored (\fIonce\fR will behave like \fIskip\fR). +.sp +Example: +.sp +.in +5 +.nf +|once this_is_a_name + +-once +.sp +.in -5 +.fi +.sp +.PP +The \fIshell\fR command can be used to generate a shell fragment +in the Makefile.SH. For instance, the following section in the Jmakefile: +.sp +.in +5 +.nf +|shell +case "$d_usegtk1" in +define) glib=1; gtk=1;; +esac +-shell +.sp +.in -5 +.fi +will cause the generation of the enclosed fragment in the Makefile.SH to +compute the values of the \fIglib\fR and \fIgtk\fR variables based on the +configuration variable \fId_usegtk1\fR set by running Configure. +.sp +.PP +In turn, this can be used in subsequent \fIcase\fR sections to activate +parts of the Makefile only when building for GTK1 using glib-1.x: +.sp +.in +5 +.nf +|case glib in 1 +display: + echo "Building for glib-1.x" +-case +.sp +.in -5 +.fi +This section will generate something like this in the Makefile.SH: +.sp +.in +5 +.nf +!NO!SUBS! +case "$glib" in +1) + $spitshell >>Makefile <<'!NO!SUBS!' +display: + echo "Building for glib-1.x" +!NO!SUBS! + ;; +esac +$spitshell >>Makefile <<'!NO!SUBS!' +.sp +.in -5 +.fi +And when running Makefile.SH, the "display" rule above will only appear +when building for glib-1.x. The form of the final \fIMakefile\fR can +therefore depend on the configuration options chosen when \fIConfigure\fR +was run. +.RE +.sp +.IP 4) +Initializations: +.sp +.RS +.IP \(bu ++: Puts the whole line in the initialization section. +.IP \(bu +++SYMBOL : Adds to the SYMBOL macro. +.RE +.sp +.IP 5) +User-defined variables: +.sp +The user may define CFLAGS, LDFLAGS or DPFLAGS as additional flags to be used +in C compilation, linking phase or depend target. It is thus possible to add +some extra flags such as -I or libraries for Makefiles in specific +sub-directories. +.sp +.PD +.SH AUTHOR +Raphael Manfredi +.SH FILES +.PD 0 +.TP 20 +Jmakefile +High level description of Makefile.SH +.TP +Jmake.rules +File holding the macro definitions +.TP +Jmake.tmpl +Template used to mould Makefile.SH +.PD +.SH BUGS +On systems whose +.I cpp +reduces multiple tabs and spaces to a single space, +.I jmake +attempts to put back any necessary tabs (which +.I make +expects in front of rules) but does not properly formats the +body of the rule itself. +.PP +There is a bootstraping problem when creating the first Makefile.SH, because +you cannot run it through a shell until there is a decent Configure +script, but you can't run \fImetaconfig\fR before there is a Makefile.SH +or some needed symbols will not be defined. +.SH "SEE ALSO" +jmkmf(1), metaconfig(1). diff --git a/jmake/jmkmf.SH b/jmake/jmkmf.SH new file mode 100755 index 0000000..64edf18 --- /dev/null +++ b/jmake/jmkmf.SH @@ -0,0 +1,106 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting jmake/jmkmf (with variable substitutions)" +$spitshell >jmkmf <>jmkmf <<'!NO!SUBS!' +# @(#) Generates a Makefile from a Jmakefile + +# $Id$ +# +# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 4.0. +# +# $Log: jmkmf.SH,v $ +# Revision 3.0.1.2 2004/08/21 23:18:13 ram +# patch71: automatically figures the top dir and the current dir +# patch71: don't run Makefile.SH if the jmake call failed +# +# Revision 3.0.1.1 1993/08/19 06:42:14 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:19 ram +# Baseline for dist 3.0 netwide release. +# + +usage="usage: $0 [top_of_sources_pathname [current_directory]]" + +curdir= + +case $# in + 0) + if test -f .package; then topdir=.; + elif test -f ../.package; then topdir=..; + elif test -f ../../.package; then topdir=../..; + elif test -f ../../../.package; then topdir=../../..; + elif test -f ../../../../.package; then topdir=../../../..; + else + echo "$0: WARNING: can't determine top package directory" >&2 + fi + ;; + 1) topdir=$1 ;; + 2) topdir=$1 curdir=$2 ;; + *) echo "$usage" 1>&2; exit 1 ;; +esac + +case "$topdir" in + -*) echo "$usage" 1>&2; exit 1 ;; +esac + +case "$curdir" in +'') + here=`pwd` + top=`cd $topdir; pwd` + curdir=`perl -e \ + 'print substr($ARGV[0], length($ARGV[1])+1), "\n";' $here $top` + case "$curdir" in + '') curdir=.;; + esac + ;; +esac + +if test -f Jmakefile; then + : ok +else + echo "$0: no Jmakefile found in current directory" >&2 + exit 1 +fi + +if test -f Makefile.SH; then + echo mv Makefile.SH Makefile.SH~ + mv Makefile.SH Makefile.SH~ +fi + +args="-DTOPDIR=$topdir -DCURDIR=$curdir" + +echo jmake $args +if jmake $args; then + echo sh Makefile.SH + sh Makefile.SH +else + echo "jmake failed, aborting" >&2 + exit 1 +fi +!NO!SUBS! +chmod 755 jmkmf +$eunicefix jmkmf diff --git a/jmake/jmkmf.man b/jmake/jmkmf.man new file mode 100644 index 0000000..93af1f4 --- /dev/null +++ b/jmake/jmkmf.man @@ -0,0 +1,80 @@ +''' $Id: jmkmf.man,v 3.0.1.1 1995/05/12 11:58:03 ram Exp ram $ +''' +''' Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 4.0. +''' +''' $Log: jmkmf.man,v $ +''' Revision 3.0.1.1 1995/05/12 11:58:03 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0 1993/08/18 12:04:20 ram +''' Baseline for dist 3.0 netwide release. +''' +.TH JMKMF 1 ram +.SH NAME +jmkmf \- runs jmake with the correct options +.SH SYNOPSIS +.B jmkmf +[ +.I top-level dir +[ +.I current dir +] +] +.SH DESCRIPTION +.I Jmkmf +is a wrapper which calls +.I jmake +with the correct options, defining the symbols +.SM TOPDIR +(location of the top-level directory) and +.SM CURDIR +(current directory). The generated +.I Makefile.SH +is then ran through +.I /bin/sh +to produce a +.I Makefile. +.PP +.I Jmkmf +is useful when you generate a makefile for the first time. +.PP +When ran without arguments, +.I jmkmf +will scan the directories upwards, looking for a .package file marking +the top of your sources. It will then derive the top-level directory +and the name of the current directory by itself. +.PP +Once you have a +.I Makefile.SH +generated by +.I jmake, +and have run Configure already, you can use +.I make Makefile.SH +to build the Makefile.SH again and +.I make Makefile +to run the Makefile.SH through +.I /bin/sh. +To use the recursive commands, you have to append an 's' at the +end of the name as in +.I make Makefiles.SH +and +.I make Makefiles. +.SH AUTHOR +Raphael Manfredi +.SH FILES +.PD 0 +.TP 20 +Jmakefile +High level description of makefile +.TP +.package +The file marking the top of your package tree +.PD +.SH "SEE ALSO" +jmake(1), packinit(1). -- cgit v1.2.3 From 65d0d69d2eaf1288f980ab404077792db6c5cdb8 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Fri, 25 Aug 2006 21:39:07 +0000 Subject: Added keyword substitution property. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@3 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/Jmakefile | 2 +- jmake/jmake.man | 2 +- jmake/jmkmf.man | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'jmake') diff --git a/jmake/Jmakefile b/jmake/Jmakefile index 81b9dc4..ae82b24 100644 --- a/jmake/Jmakefile +++ b/jmake/Jmakefile @@ -2,7 +2,7 @@ * Jmakefile for jmake */ -;# $Id: Jmakefile,v 3.0.1.2 1995/03/21 08:34:16 ram Exp ram $ +;# $Id$ ;# ;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ;# diff --git a/jmake/jmake.man b/jmake/jmake.man index 2b0997f..5c837e4 100644 --- a/jmake/jmake.man +++ b/jmake/jmake.man @@ -1,4 +1,4 @@ -''' $Id: jmake.man,v 3.0.1.3 2004/08/22 09:01:55 ram Exp ram $ +''' $Id$ ''' ''' Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ''' diff --git a/jmake/jmkmf.man b/jmake/jmkmf.man index 93af1f4..bea60d1 100644 --- a/jmake/jmkmf.man +++ b/jmake/jmkmf.man @@ -1,4 +1,4 @@ -''' $Id: jmkmf.man,v 3.0.1.1 1995/05/12 11:58:03 ram Exp ram $ +''' $Id$ ''' ''' Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ''' -- cgit v1.2.3 From bbc56a6a25883d8f2842ef64574cd150e10ca40f Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Fri, 25 Aug 2006 22:09:39 +0000 Subject: Fixed Jmakefile: there's no need to request manual inclusion of symbols. The MakeDirectories() target was using @! instead of proper @@ terminator to introduce the commands. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@5 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/files/Jmake.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'jmake') diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules index cf3e9d6..e8be807 100644 --- a/jmake/files/Jmake.rules +++ b/jmake/files/Jmake.rules @@ -1328,7 +1328,7 @@ LintDirs($(SUBDIRS)) * Generate rules to create a hierarchy of directories. */ #define MakeDirectories(step,dirs) @!\ -step:: @!\ +step:: @@\ MakeDirs(dirs) -- cgit v1.2.3 From 9ab27126b3aa38a1f550c460ea4a07850c649b12 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Fri, 25 Aug 2006 22:24:13 +0000 Subject: InstallTarget() now uses :: targets. Default empty rule for all makefiles is now called "all" instead of "emptyrule" because if there is nothing to be done, GNU make prints the target name and "emptyrule" is not pretty. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@7 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/files/Jmake.rules | 16 ++++++++-------- jmake/files/Jmake.tmpl | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'jmake') diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules index e8be807..636c561 100644 --- a/jmake/files/Jmake.rules +++ b/jmake/files/Jmake.rules @@ -592,14 +592,14 @@ local_clobber:: local_realclean @!\ * Generate rules to recursively install files */ #define InstallTarget() @!\ -?SUBDIRS:install: local_install sub_install @!\ -%SUBDIRS:install: local_install @!\ -?SUBDIRS:install.man: maybe_install.man sub_install.man @!\ -%SUBDIRS:install.man: maybe_install.man @!\ -?SUBDIRS:deinstall: sub_deinstall local_deinstall @!\ -%SUBDIRS:deinstall: local_deinstall @!\ -?SUBDIRS:deinstall.man: sub_deinstall.man maybe_deinstall.man @!\ -%SUBDIRS:deinstall.man: maybe_deinstall.man @!\ +?SUBDIRS:install:: local_install sub_install @!\ +%SUBDIRS:install:: local_install @!\ +?SUBDIRS:install.man:: maybe_install.man sub_install.man @!\ +%SUBDIRS:install.man:: maybe_install.man @!\ +?SUBDIRS:deinstall:: sub_deinstall local_deinstall @!\ +%SUBDIRS:deinstall:: local_deinstall @!\ +?SUBDIRS:deinstall.man:: sub_deinstall.man maybe_deinstall.man @!\ +%SUBDIRS:deinstall.man:: maybe_deinstall.man @!\ @!\ ?MANSRC:install.man-yes: local_install.man @!\ install.man-no: @!\ diff --git a/jmake/files/Jmake.tmpl b/jmake/files/Jmake.tmpl index 052ad5e..61f848f 100644 --- a/jmake/files/Jmake.tmpl +++ b/jmake/files/Jmake.tmpl @@ -151,7 +151,7 @@ all:: .FORCE_DEPEND * These need to be here so that rules in Jmakefile occur first; the blank * all is to make sure that an empty Jmakefile doesn't default to make clean. */ -emptyrule:: +all:: CleanTarget() InstallTarget() -- cgit v1.2.3 From a6851682b2d59dc331c43405401efea4e53bbd8b Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Fri, 25 Aug 2006 22:27:18 +0000 Subject: Added keyword expansion. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@8 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/files/Jmake.rules | 4 ++-- jmake/files/Jmake.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'jmake') diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules index 636c561..e303fb1 100644 --- a/jmake/files/Jmake.rules +++ b/jmake/files/Jmake.rules @@ -1,12 +1,12 @@ ;######################################################################## ;# Jmake rules for building libraries, programs, scripts, and data files -;# $Id: Jmake.rules,v 3.0.1.7 2004/08/22 08:28:58 ram Exp ram $ +;# $Id$ /* * MACHINE-INDEPENDENT RULES -- DO NOT MODIFY */ -/* $Id: Jmake.rules,v 3.0.1.7 2004/08/22 08:28:58 ram Exp ram $ +/* $Id$ * * Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi * diff --git a/jmake/files/Jmake.tmpl b/jmake/files/Jmake.tmpl index 61f848f..80549b5 100644 --- a/jmake/files/Jmake.tmpl +++ b/jmake/files/Jmake.tmpl @@ -1,7 +1,7 @@ /* * Generic jmake template * - * $Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp ram $ + * $Id$ * * Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi * @@ -27,7 +27,7 @@ */ : Makefile.SH generated from Jmake.tmpl and Jmakefile -: $Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp ram $ +: $Id$ /************************************************************************* * * -- cgit v1.2.3 From 8f97ec1bee96946278ff76ee310af87056ca4240 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Fri, 25 Aug 2006 22:33:07 +0000 Subject: Regenerated all Makefile.SH files. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@10 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/Makefile.SH | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'jmake') diff --git a/jmake/Makefile.SH b/jmake/Makefile.SH index e562274..6a651e3 100755 --- a/jmake/Makefile.SH +++ b/jmake/Makefile.SH @@ -1,5 +1,5 @@ -: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL70] -: $X-Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp ram $ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.5 PL0] +: $X-Id: Jmake.tmpl 8 2006-08-25 22:27:18Z rmanfredi $ case $CONFIG in '') @@ -41,6 +41,7 @@ INSTALLDIR = $INSTALLDIR # Parameters set by Configure -- edit config.sh if changes are needed CTAGS = ctags +JCPPFLAGS = $cppflags L = $manext MANSRC = $installmansrc MV = $mv @@ -58,15 +59,15 @@ SCRIPTS = jmake jmkmf $spitshell >>Makefile <<'!NO!SUBS!' ######################################################################## # Jmake rules for building libraries, programs, scripts, and data files -# $X-Id: Jmake.rules,v 3.0.1.7 2004/08/22 08:28:58 ram Exp ram $ +# $X-Id: Jmake.rules 8 2006-08-25 22:27:18Z rmanfredi $ ######################################################################## # Start of Jmakefile -# $X-Id: Jmakefile,v 3.0.1.2 1995/03/21 08:34:16 ram Exp ram $ +# $X-Id: Jmakefile 3 2006-08-25 21:39:07Z rmanfredi $ # # Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi -# +# # You may redistribute only under the terms of the Artistic Licence, # as specified in the README file that comes with the distribution. # You may reuse parts of this distribution only within the terms of @@ -106,12 +107,13 @@ jmkmf: jmkmf.SH local_install:: $(SCRIPTS) $(LSCRIPTS) - case '${MFLAGS}' in *[i]*) set +e;; esac; \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ (set -x; test -d $(INSTALL_PREFIX)$(SCRIPTDIR) || \ $(INSTALLDIR) $(INSTALL_PREFIX)$(SCRIPTDIR)); \ for file in $(SCRIPTS) $(LSCRIPTS); do \ (set -x; \ - $(INSTALL) -c -m 555 $$file $(INSTALL_PREFIX)$(SCRIPTDIR)); \ + $(INSTALL) -c -m 555 $$file $(INSTALL_PREFIX)$(SCRIPTDIR)) || \ + exit 1; \ done local_deinstall:: @@ -121,14 +123,15 @@ local_deinstall:: done local_install.man:: - case '${MFLAGS}' in *[i]*) set +e;; esac; \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ (set -x; test -d $(INSTALL_PREFIX)$(MANSRC) || \ $(INSTALLDIR) $(INSTALL_PREFIX)$(MANSRC)); \ for file in $(SCRIPTS); do \ if test -f $$file.man; then \ (set -x; \ $(INSTALL) -c -m 444 $$file.man \ - $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)); \ + $(INSTALL_PREFIX)$(MANSRC)/$$file.$(L)) || \ + exit 1; \ fi; \ done @@ -151,22 +154,20 @@ fixcpp: fixcpp.SH local_install:: - @case '${MFLAGS}' in *[i]*) set +e;; esac; \ for dir in $(PRIVLIB) $(PRIVLIB)/files; do \ - (set -x; test -d $(INSTALL_PREFIX)$$dir || \ + (set -x; test -d $(INSTALL_PREFIX)$$dir || \ $(INSTALLDIR) $(INSTALL_PREFIX)$$dir); \ done local_deinstall:: - @case '${MFLAGS}' in *[i]*) set +e;; esac; \ for dir in $(PRIVLIB) $(PRIVLIB)/files; do \ (set -x; test -d $$dir && $(RM) -r $(INSTALL_PREFIX)$$dir); \ done local_install:: Index - case '${MFLAGS}' in *[i]*) set +e;; esac; \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB) || \ $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)); \ $(INSTALL) -c -m 444 Index $(INSTALL_PREFIX)$(PRIVLIB) @@ -175,7 +176,7 @@ local_deinstall:: $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/Index local_install:: bindex - case '${MFLAGS}' in *[i]*) set +e;; esac; \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB) || \ $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)); \ $(INSTALL) -c -m 555 bindex $(INSTALL_PREFIX)$(PRIVLIB) @@ -184,7 +185,7 @@ local_deinstall:: $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/bindex local_install:: fixcpp - case '${MFLAGS}' in *[i]*) set +e;; esac; \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB)/files || \ $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)/files); \ $(INSTALL) -c -m 555 fixcpp $(INSTALL_PREFIX)$(PRIVLIB)/files @@ -193,11 +194,12 @@ local_deinstall:: $(RM) $(INSTALL_PREFIX)$(PRIVLIB)/files/fixcpp local_install:: files/Jmake* - case '${MFLAGS}' in *[i]*) set +e;; esac; \ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ (set -x; test -d $(INSTALL_PREFIX)$(PRIVLIB)/files || \ $(INSTALLDIR) $(INSTALL_PREFIX)$(PRIVLIB)/files); \ for i in files/Jmake*; do \ - (set -x; $(INSTALL) -c -m 444 $$i $(INSTALL_PREFIX)$(PRIVLIB)/files); \ + (set -x; $(INSTALL) -c -m 444 \ + $$i $(INSTALL_PREFIX)$(PRIVLIB)/files) || exit 1;\ done local_deinstall:: @@ -220,24 +222,25 @@ depend:: ######################################################################## # Common rules for all Makefiles -- do not edit -emptyrule:: +all:: clean: local_clean realclean: local_realclean clobber: local_clobber local_clean:: - $(RM) core *~ *.o + if test -f core; then $(RM) core; fi + $(RM) *~ *.o local_realclean:: local_clean local_clobber:: local_realclean $(RM) Makefile config.sh -install: local_install -install.man: maybe_install.man -deinstall: local_deinstall -deinstall.man: maybe_deinstall.man +install:: local_install +install.man:: maybe_install.man +deinstall:: local_deinstall +deinstall.man:: maybe_deinstall.man install.man-yes: local_install.man install.man-no: -- cgit v1.2.3 From 0a8527c4644133b9f1d34f24dbf83b2074d82dd0 Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Wed, 27 Dec 2006 10:35:09 +0000 Subject: Added InstallProgramNoStrip() to request installation of a program without stripping the debugging symbols. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@18 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/files/Jmake.rules | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'jmake') diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules index e303fb1..21ef3fe 100644 --- a/jmake/files/Jmake.rules +++ b/jmake/files/Jmake.rules @@ -375,6 +375,20 @@ local_deinstall:: @@\ $(RM) $(INSTALL_PREFIX)^^^dest/program^^^$(_EXE) +/* + * InstallProgramNoStripWithFlags: + * Generate rules to install an executable program using given + * install flags. + */ +#define InstallProgramNoStripWithFlags(program,dest,flags) @!\ +local_install:: program @@\ + _MakeInstallDirIgnore(dest) \ @@\ + $(INSTALL) -c -m 555 flags program^^^$(_EXE) $(INSTALL_PREFIX)^^^dest @!\ + @!\ +local_deinstall:: @@\ + $(RM) $(INSTALL_PREFIX)^^^dest/program^^^$(_EXE) + + /* * InstallProgram: * Generate rules to install an executable program using any special @@ -384,6 +398,16 @@ local_deinstall:: @@\ InstallProgramWithFlags(program,dest,^^) +/* + * InstallProgramNoStrip: + * Generate rules to install an executable program using any special + * install flags set in $(INSTALLFLAGS), but without stripping the + * executable from debugging symbols. + */ +#define InstallProgramNoStrip(program,dest) @!\ +InstallProgramNoStripWithFlags(program,dest,^^) + + /* * InstallScriptWithFlags: * Generate rules to install an executable script using given -- cgit v1.2.3 From 3917f89474931cf825dd53e6bf00665992b9049b Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Mon, 13 Aug 2007 12:14:08 +0000 Subject: Linux does not like ^M as line endings: cpp 4.1.x complains. Try with ^A, hoping it will continue to work on HP-UX. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@19 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/fixcpp.SH | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'jmake') diff --git a/jmake/fixcpp.SH b/jmake/fixcpp.SH index 24dd274..4bbc69b 100755 --- a/jmake/fixcpp.SH +++ b/jmake/fixcpp.SH @@ -43,7 +43,7 @@ $startperl # This program is meant to be called from jmake. All it does is pre-process # the file it is given as argument, focusing on #include directives and # resolving them as cpp would (but without the #line stuff since we don't -# really care about it), escaping all the trailing \ into '\ ^M'. The resulting +# really care about it), escaping all the trailing \ into '\ ^A'. The resulting # temporary file is then handed off to the real cpp for macro processing, and # the output is printed on stdout, after restoration of any original trailing \. # Again, thanks HP-UX for making this so challenging and exciting... :-) @@ -135,7 +135,7 @@ sub escape { # Don't escape trailing backslashes in macro definition or cpp # won't see them as macro continuation any longer, and also within # macro definitions, all those @@ or @! continuations... - s/\\$/\\ \015/ unless /\@[!@]\\$/ || /^#define/; + s/\\$/\\ \001/ unless /\@[!@]\\$/ || /^#define/; } # Append file to given (opened) file descriptor @@ -172,7 +172,7 @@ sub cpp { local($file) = @_; open(CPP, "$cpp $cpp_opt $file |") || die "Can't fork: $!\n"; while () { - s/\\ \015$/\\/; # Un-escape trailing \ + s/\\ \001$/\\/; # Un-escape trailing \ print STDOUT; } close CPP; -- cgit v1.2.3 From 1e7ef113b85f4e4e10ffaa2c3f362645a7c7eecf Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Fri, 4 Jan 2008 23:14:00 +0000 Subject: Applied diff from H.Merijn Brand to keep it working with perl 5.10, which no longer supports the old $* perl4 variable to request multiline matching. git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@20 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/jmake.SH | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'jmake') diff --git a/jmake/jmake.SH b/jmake/jmake.SH index 3f676b2..bdb5de7 100755 --- a/jmake/jmake.SH +++ b/jmake/jmake.SH @@ -143,13 +143,11 @@ while () { s/@!\s?/\n/g; s/@@\s?/\n\t/g; - $* = 1; # A '\r' is added to all lines, in order to let 'split' keep them # As lines ending with '\' won't fit in the next regular # expression (why ?), we have to treat that special case separately - s/\n$/\r\n/g; - s/\\\s*$/\\\r/g; # Remove spaces after final '\' and add '\r' - $* = 0; + s/\n$/\r\n/gm; + s/\\\s*$/\\\r/gm; # Remove spaces after final '\' and add '\r' @macro = split(/\n/); for ($i = 0; $i <= $#macro; $i++) { chop($_ = $macro[$i]); # Remove final '\r' -- cgit v1.2.3 From 6ed168ff814db8f9bcaad6f2e218fb2bbacbdb1c Mon Sep 17 00:00:00 2001 From: rmanfredi Date: Wed, 28 May 2008 11:19:25 +0000 Subject: SVN revision number is now automatically generated in "revision.h". The old patchlevel information is no longer used, and is deprecated in unit files, replaced by . git-svn-id: https://dist.svn.sourceforge.net/svnroot/dist/trunk/dist@25 190e5f8e-a817-0410-acf6-e9863daed9af --- jmake/fixcpp.SH | 1 + jmake/jmake.SH | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'jmake') diff --git a/jmake/fixcpp.SH b/jmake/fixcpp.SH index 4bbc69b..f3e8db5 100755 --- a/jmake/fixcpp.SH +++ b/jmake/fixcpp.SH @@ -55,6 +55,7 @@ $startperl \$cpp = '$cpp_trad'; \$version = '$VERSION'; \$patchlevel = '$PATCHLEVEL'; +\$revision = '$REVISION'; !GROK!THIS! $spitshell >>fixcpp <<'!NO!SUBS!' diff --git a/jmake/jmake.SH b/jmake/jmake.SH index bdb5de7..b6d1277 100755 --- a/jmake/jmake.SH +++ b/jmake/jmake.SH @@ -71,6 +71,7 @@ $startperl \$cpp = '$cpp'; \$version = '$VERSION'; \$patchlevel = '$PATCHLEVEL'; +\$revision = '$REVISION'; !GROK!THIS! $spitshell >>jmake <<'!NO!SUBS!' @@ -305,7 +306,7 @@ line: for ($i = 0; $i <= $#makefile; $i++) { # Process regular line to be generated in Makefile.SH - s//[jmake $version PL$patchlevel]/; + s//[jmake $version-$revision]/; # Lines starting with ?SYMBOL: (resp. %SYMBOL:) are to be processed # only if SYMBOL is defined (resp. undefined). -- cgit v1.2.3