diff options
author | Manoj Srivastava <srivasta@golden-gryphon.com> | 2014-04-27 17:54:01 -0700 |
---|---|---|
committer | Manoj Srivastava <srivasta@golden-gryphon.com> | 2014-04-27 17:54:01 -0700 |
commit | 8f5e5726134ce5b4bd436b16f367796d851df553 (patch) | |
tree | 0ce2ad130721dcf917d7f81fb8495bf0a189d266 /jmake | |
parent | 02bf7be6fc0f798790ef5b2160bc89a77b909428 (diff) |
Imported Upstream version 3.5-36
Diffstat (limited to 'jmake')
-rw-r--r-- | jmake/Jmakefile | 8 | ||||
-rwxr-xr-x | jmake/Makefile.SH | 26 | ||||
-rwxr-xr-x | jmake/bindex.SH | 4 | ||||
-rw-r--r-- | jmake/files/Jmake.rules | 111 | ||||
-rw-r--r-- | jmake/files/Jmake.tmpl | 19 | ||||
-rwxr-xr-x | jmake/fixcpp.SH | 5 | ||||
-rwxr-xr-x | jmake/jmake.SH | 26 | ||||
-rw-r--r-- | jmake/jmake.man | 39 |
8 files changed, 187 insertions, 51 deletions
diff --git a/jmake/Jmakefile b/jmake/Jmakefile index ba65d08..3394fb1 100644 --- a/jmake/Jmakefile +++ b/jmake/Jmakefile @@ -2,7 +2,7 @@ * Jmakefile for jmake */ -;# $Id: Jmakefile 3 2006-08-25 21:39:07Z rmanfredi $ +;# $Id: Jmakefile 173 2014-04-05 08:10:18Z rmanfredi $ ;# ;# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ;# @@ -25,7 +25,7 @@ AllTarget(Index) -Index: bindex +Index: bindex files/Jmake.rules chmod +x bindex ./bindex @@ -40,7 +40,8 @@ InstallMultipleFlags(files/Jmake*,$(PRIVLIB)/files,-m 444) BINSH = jmake.SH fixcpp.SH -depend:: +depend:: local_depend +local_depend:: ($(SED) '/^# DO NOT DELETE/q' Makefile && \ grep '^\$$grep' $(BINSH) | \ $(SED) -e "s/^.*' \([^ ]*\) >>\([^ ]*\)/\2: \1/" \ @@ -49,3 +50,4 @@ depend:: cp Makefile.new Makefile $(RM) Makefile.new +fixcpp jmake: $(TOP)/revision.h diff --git a/jmake/Makefile.SH b/jmake/Makefile.SH index 6a651e3..76a7182 100755 --- a/jmake/Makefile.SH +++ b/jmake/Makefile.SH @@ -1,5 +1,5 @@ -: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.5 PL0] -: $X-Id: Jmake.tmpl 8 2006-08-25 22:27:18Z rmanfredi $ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.5-172] +: $X-Id: Jmake.tmpl 156 2012-12-19 16:44:39Z rmanfredi $ case $CONFIG in '') @@ -59,12 +59,12 @@ SCRIPTS = jmake jmkmf $spitshell >>Makefile <<'!NO!SUBS!' ######################################################################## # Jmake rules for building libraries, programs, scripts, and data files -# $X-Id: Jmake.rules 8 2006-08-25 22:27:18Z rmanfredi $ +# $X-Id: Jmake.rules 106 2011-11-25 20:36:12Z rmanfredi $ ######################################################################## # Start of Jmakefile -# $X-Id: Jmakefile 3 2006-08-25 21:39:07Z rmanfredi $ +# $X-Id: Jmakefile 173 2014-04-05 08:10:18Z rmanfredi $ # # Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi # @@ -90,7 +90,7 @@ all:: Index local_realclean:: $(RM) Index -Index: bindex +Index: bindex files/Jmake.rules chmod +x bindex ./bindex @@ -210,7 +210,8 @@ local_deinstall:: BINSH = jmake.SH fixcpp.SH -depend:: +depend:: local_depend +local_depend:: ($(SED) '/^# DO NOT DELETE/q' Makefile && \ grep '^\$$grep' $(BINSH) | \ $(SED) -e "s/^.*' \([^ ]*\) >>\([^ ]*\)/\2: \1/" \ @@ -219,6 +220,8 @@ depend:: cp Makefile.new Makefile $(RM) Makefile.new +fixcpp jmake: $(TOP)/revision.h + ######################################################################## # Common rules for all Makefiles -- do not edit @@ -238,6 +241,8 @@ local_clobber:: local_realclean $(RM) Makefile config.sh install:: local_install + @exit 0 + install.man:: maybe_install.man deinstall:: local_deinstall deinstall.man:: maybe_deinstall.man @@ -278,6 +283,8 @@ tags:: local_clobber:: $(RM) tags +depend:: + ######################################################################## # Empty rules for directories with no sub-directories -- do not edit @@ -297,6 +304,13 @@ Makefiles:: Makefiles.SH:: +######################################################################## +# 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:: + @echo "You must run 'make depend' in $(TOP) first."; exit 1 !NO!SUBS! chmod 644 Makefile $eunicefix Makefile diff --git a/jmake/bindex.SH b/jmake/bindex.SH index 6b8d4b4..ca73f5e 100755 --- a/jmake/bindex.SH +++ b/jmake/bindex.SH @@ -19,10 +19,10 @@ $spitshell >bindex <<!GROK!THIS! $startperl !GROK!THIS! $spitshell >>bindex <<'!NO!SUBS!' - eval 'exec perl -S $0 "$@"' + eval 'exec perl -S $0 ${1+"$@"}' if $runnning_under_some_shell; -# $Id: bindex.SH 1 2006-08-24 12:32:52Z rmanfredi $ +# $Id: bindex.SH 31 2010-03-06 20:15:24Z rmanfredi $ # # Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi # diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules index aa31421..8877f17 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 18 2006-12-27 10:35:09Z rmanfredi $ +;# $Id: Jmake.rules 174 2014-04-05 08:19:48Z rmanfredi $ /* * MACHINE-INDEPENDENT RULES -- DO NOT MODIFY */ -/* $Id: Jmake.rules 18 2006-12-27 10:35:09Z rmanfredi $ +/* $Id: Jmake.rules 174 2014-04-05 08:19:48Z rmanfredi $ * * Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi * @@ -78,6 +78,18 @@ local_realclean:: @@\ $(RM) depends /* + * AllTargetProgram: + * Generate rules to build necessary things during make all. + * This target is specific to executable. Use AllTarget() for + * other type of files. + */ +#define AllTargetProgram(program) @!\ +all:: program @!\ + @!\ +local_realclean:: @@\ + $(RM) program^^$(_EXE) + +/* * RemoveTargetProgram: * This is used in some other macros in order to remove the target * before starting its building (saves disk space). There should be @@ -85,10 +97,11 @@ local_realclean:: @@\ * used *inside* building rules. */ #define RemoveTargetProgram(program) \ - $(RM) program @@\ + -$(RM) program^^$(_EXE) @@\ if test -f program^^^$(_EXE); then \ @@\ $(MV) program^^^$(_EXE) program^^~^^^$(_EXE); fi + /* * NormalProgramTarget: * Generate rules to compile and link the indicated program; since @@ -99,20 +112,31 @@ local_realclean:: @@\ ++OBJECTS objects @!\ ++SOURCES sources @!\ NormalObjectRule() @!\ -AllTarget(program) @!\ +AllTargetProgram(program) @!\ @!\ program: objects @@\ RemoveTargetProgram($@) @@\ - $(CC) -o $@ objects $(JLDFLAGS) $(LIBS) @!\ + $(CC) -o $@$(_EXE) objects $(JLDFLAGS) $(LIBS) @!\ /* - * SingleProgramTarget: - * Obsolete version of NormalProgramTarget that doesn't have - * deplibs. + * NormalProgramLibTarget: + * 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. + * The ``libs'' argument is used to depend on locally built libraries, + * in te same Jmakefile. */ -#define SingleProgramTarget(program,objects,libs) \ -NormalProgramTarget(program,objects,libs) +#define NormalProgramLibTarget(program,sources,objects,libs) @!\ +++OBJECTS objects @!\ +++SOURCES sources @!\ +NormalObjectRule() @!\ +AllTargetProgram(program) @!\ + @!\ +program: objects libs @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@$(_EXE) objects $(JLDFLAGS) libs $(LIBS) @!\ + /* * SimpleProgramTarget: @@ -124,7 +148,6 @@ NormalProgramTarget(program,objects,libs) NormalProgramTarget(program,program.c,program.o) - /* * ComplexProgramTarget: * Generate rules for compiling and linking the program specified by @@ -136,11 +159,11 @@ NormalProgramTarget(program,program.c,program.o) ++OBJECTS $(OBJS) @!\ ++SOURCES $(SRCS) @!\ NormalObjectRule() @!\ -AllTarget(program) @!\ +AllTargetProgram(program) @!\ @!\ program: $(OBJS) @@\ RemoveTargetProgram($@) @@\ - $(CC) -o $@ $(OBJS) $(JLDFLAGS) $(LIBS) @!\ + $(CC) -o $@$(_EXE) $(OBJS) $(JLDFLAGS) $(LIBS) @!\ @!\ InstallProgram(program,$(BINDIR)) @!\ InstallManPage(program,$(MANSRC)) @!\ @@ -160,11 +183,11 @@ LintTarget() ++OBJECTS $(OBJS1) @!\ ++SOURCES $(SRCS1) @!\ NormalObjectRule() @!\ -AllTarget(program) @!\ +AllTargetProgram(program) @!\ @!\ program: $(OBJS1) @@\ RemoveTargetProgram($@) @@\ - $(CC) -o $@ $(OBJS1) $(JLDFLAGS) $(LIBS) @!\ + $(CC) -o $@$(_EXE) $(OBJS1) $(JLDFLAGS) $(LIBS) @!\ @!\ InstallProgram(program,$(BINDIR)) @!\ InstallManPage(program,$(MANSRC)) @!\ @@ -184,11 +207,11 @@ LintTarget() ++OBJECTS $(OBJS2) @!\ ++SOURCES $(SRCS2) @!\ NormalObjectRule() @!\ -AllTarget(program) @!\ +AllTargetProgram(program) @!\ @!\ program: $(OBJS2) @@\ RemoveTargetProgram($@) @@\ - $(CC) -o $@ $(OBJS2) $(JLDFLAGS) $(LIBS) @!\ + $(CC) -o $@$(_EXE) $(OBJS2) $(JLDFLAGS) $(LIBS) @!\ @!\ InstallProgram(program,$(BINDIR)) @!\ InstallManPage(program,$(MANSRC)) @@ -205,11 +228,11 @@ InstallManPage(program,$(MANSRC)) ++OBJECTS $(OBJS3) @!\ ++SOURCES $(SRCS3) @!\ NormalObjectRule() @!\ -AllTarget(program) @!\ +AllTargetProgram(program) @!\ @!\ program: $(OBJS3) @@\ RemoveTargetProgram($@) @@\ - $(CC) -o $@ $(OBJS3) $(JLDFLAGS) $(LIBS) @!\ + $(CC) -o $@$(_EXE) $(OBJS3) $(JLDFLAGS) $(LIBS) @!\ @!\ InstallProgram(program,$(BINDIR)) @!\ InstallManPage(program,$(MANSRC)) @@ -554,7 +577,7 @@ DeinstallMultipleDest(local_deinstall.man,list,dest) * Generate rules to build the makedepend program. */ #define DependDependency() @!\ -depend:: TOPDIR/mkdep @!\ +local_depend:: TOPDIR/mkdep @!\ @!\ TOPDIR/mkdep: @!\ ?TOP: @echo "You have to run Configure first."; exit 1 @!\ @@ -571,7 +594,8 @@ TOPDIR/mkdep: @!\ |once _DependTarget_ @!\ DependDependency() @!\ @!\ -depend:: @@\ +depend:: local_depend @!\ +local_depend:: @@\ ($(SED) '/^# DO NOT DELETE/q' Makefile && \ @@\ $(MKDEP) $(SOURCES) | \ @@\ $(SED) -e 's:/usr/lib[^ ]*::g; s:$(USRINC)[^ ]*::g; ' \ @@\ @@ -617,7 +641,9 @@ local_clobber:: local_realclean @!\ */ #define InstallTarget() @!\ ?SUBDIRS:install:: local_install sub_install @!\ -%SUBDIRS:install:: local_install @!\ +%SUBDIRS:install:: local_install @@\ + @exit 0 @!\ + @!\ ?SUBDIRS:install.man:: maybe_install.man sub_install.man @!\ %SUBDIRS:install.man:: maybe_install.man @!\ ?SUBDIRS:deinstall:: sub_deinstall local_deinstall @!\ @@ -1114,8 +1140,28 @@ NormalLintTarget($(SOURCES)) @!\ */ #define LinkSourceFile(src,dir) @!\ src: dir/src @@\ - $(RM) $@ @@\ + $(RM) -f $@ @@\ + $(LN) $? $@ @!\ + @!\ +local_depend:: src @@\ + @!\ +local_realclean:: @@\ + $(RM) -f src @!\ + + +/* + * LinkSourceFileAlias: + * Snag source file from some other directory with a different local name. + */ +#define LinkSourceFileAlias(src,dir,alias) @!\ +alias: dir/src @@\ + $(RM) -f $@ @@\ $(LN) $? $@ @!\ + @!\ +local_depend:: alias @@\ + @!\ +local_realclean:: @@\ + $(RM) -f alias @!\ /* @@ -1168,6 +1214,22 @@ name:: @@\ /* + * NamedTargetSubdirsAsRule: + * Recursively make a series of steps in the specified directories, + * where the name of the local rule is different from the recursive + * actions. + */ +#define NamedTargetSubdirsAsRule(dirs,localname,name,verb,flags) @!\ +localname:: @@\ + @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. */ @@ -1211,7 +1273,8 @@ NamedTargetSubdirs(all,"Making all",^^) * make depend step. */ #define DependDirs(dirs) \ -NamedTargetSubdirsRule(dirs,depend,"Depending",^^) +depend:: sub_depend @!\ +NamedTargetSubdirsAsRule(dirs,sub_depend,depend,"Depending",^^) /* diff --git a/jmake/files/Jmake.tmpl b/jmake/files/Jmake.tmpl index 0663793..a06d405 100644 --- a/jmake/files/Jmake.tmpl +++ b/jmake/files/Jmake.tmpl @@ -1,7 +1,7 @@ /* * Generic jmake template * - * $Id: Jmake.tmpl 30 2009-10-28 07:45:28Z rmanfredi $ + * $Id: Jmake.tmpl 156 2012-12-19 16:44:39Z rmanfredi $ * * Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi * @@ -27,7 +27,7 @@ */ : Makefile.SH generated from Jmake.tmpl and Jmakefile <TAG> -: $Id: Jmake.tmpl 30 2009-10-28 07:45:28Z rmanfredi $ +: $Id: Jmake.tmpl 156 2012-12-19 16:44:39Z rmanfredi $ /************************************************************************* * * @@ -81,6 +81,7 @@ DIR = $DIR ;# Parameters set by Configure -- edit config.sh if changes are needed ?AR:AR = ar rc /* FIXME */ +?ARCHLIB:ARCHLIB = $installarchlib ?BINDIR:BINDIR = $installbin ?CC:CC = $cc ?CHMOD:CHMOD = $chmod @@ -89,9 +90,9 @@ DIR = $DIR ?CTAGS:CTAGS = ctags /* FIXME */ ?_EXE:_EXE = $_exe ?INSTALLPREFIX:INSTALLPREFIX = $prefix -?JCFLAGS:JCFLAGS = \$(CFLAGS) $optimize $ccflags $large +?JCFLAGS:JCFLAGS = \$(CFLAGS) $optimize $pthread $ccflags $large ?JCPPFLAGS:JCPPFLAGS = $cppflags -?JLDFLAGS:JLDFLAGS = \$(LDFLAGS) $optimize $ldflags +?JLDFLAGS:JLDFLAGS = \$(LDFLAGS) $optimize $pthread $ldflags ?JLFLAGS:JLFLAGS = \$(LFLAGS) ?JYFLAGS:JYFLAGS = \$(YFLAGS) $yaccflags ?L:L = $manext @@ -104,6 +105,7 @@ DIR = $DIR ?MAKE:$make_set_make ?MKDEP:MKDEP = $mkdep \$(DPFLAGS) \$(JCPPFLAGS) -- ?MV:MV = $mv +?NM:NM = $nm ?PRIVLIB:PRIVLIB = $installprivlib ?RANLIB:RANLIB = $ranlib ?RM:RM = $rm -f @@ -193,6 +195,11 @@ maybe_deinstall.man: deinstall.man-no MakefileTarget() TagsTarget() +/* + * Empty rules in case there is no depend target. + */ +depend:: + %SUBDIRS:|skip /* Skip if no sub-directories */ ;######################################################################## ;# Rules for building in sub-directories -- do not edit @@ -240,8 +247,8 @@ Makefiles:: Makefiles.SH:: --skip /* No sub-directories */ -%MKDEP:|skip /* Skip if no depend target */ +-skip /* No sub-directories */ +%local_depend%:|skip /* Skip if no local depend target */ ;######################################################################## ;# Dependencies generated by make depend ;# DO NOT DELETE THIS LINE -- make depend relies on it diff --git a/jmake/fixcpp.SH b/jmake/fixcpp.SH index b994670..092a4ca 100755 --- a/jmake/fixcpp.SH +++ b/jmake/fixcpp.SH @@ -11,16 +11,17 @@ case $CONFIG in . $TOP/config.sh ;; esac +REVISION=`grep REVISION $TOP/revision.h | head -n1 | cut -d' ' -f4` case "$0" in */*) cd `expr X$0 : 'X\(.*\)/'` ;; esac echo "Extracting jmake/fixcpp (with variable substitutions)" $spitshell >fixcpp <<!GROK!THIS! $startperl - eval 'exec perl -S \$0 "\$@"' + eval 'exec perl -S \$0 \${1+"\$@"}' if \$runnning_under_some_shell; -# $Id: fixcpp.SH 25 2008-05-28 11:19:25Z rmanfredi $ +# $Id: fixcpp.SH 42 2010-11-28 18:15:13Z rmanfredi $ # # Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi # diff --git a/jmake/jmake.SH b/jmake/jmake.SH index 9b06899..392952f 100755 --- a/jmake/jmake.SH +++ b/jmake/jmake.SH @@ -11,16 +11,17 @@ case $CONFIG in . $TOP/config.sh ;; esac +REVISION=`grep REVISION $TOP/revision.h | head -n1 | cut -d' ' -f4` case "$0" in */*) cd `expr X$0 : 'X\(.*\)/'` ;; esac echo "Extracting jmake/jmake (with variable substitutions)" $spitshell >jmake <<!GROK!THIS! $startperl - eval 'exec perl -S \$0 "\$@"' + eval 'exec perl -S \$0 \${1+"\$@"}' if \$runnning_under_some_shell; -# $Id: jmake.SH 25 2008-05-28 11:19:25Z rmanfredi $ +# $Id: jmake.SH 47 2010-11-28 22:23:13Z rmanfredi $ # # Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi # @@ -218,6 +219,8 @@ $SPIT_END = "!NO!SUBS!\n"; $GROK_START = "\$spitshell >>Makefile <<!GROK!THIS!\n"; $GROK_END = "!GROK!THIS!\n"; +%target = (); # Will record seen targets (actually generated) + open(MAKEFILE, ">Makefile.SH"); # We have to use for instead of foreach to handle 'skip' easily line: for ($i = 0; $i <= $#makefile; $i++) { @@ -308,6 +311,20 @@ line: for ($i = 0; $i <= $#makefile; $i++) { s/<TAG>/[jmake $version-$revision]/; + # Lines starting with ?target?: (resp. %target%:) are to be processd + # only when target is used (resp. unused) in the generated makefile. + + # Apply in sequence + while (/^\s*\?|\s*%/) { + if (s/^\s*\?([\w-.]+)\?://) { # Wanted target ? + next line unless $target{$1}; + } elsif (s/^\s*%([\w-.]+)%://) { # Unwanted target ? + next line if $target{$1}; + } else { + last; + } + } + # Lines starting with ?SYMBOL: (resp. %SYMBOL:) are to be processed # only if SYMBOL is defined (resp. undefined). @@ -396,6 +413,11 @@ line: for ($i = 0; $i <= $#makefile; $i++) { print MAKEFILE "$_\n"; } } else { + # Keep track of the targets we generate for ?target? and %target% type + # of tests in the templates, which can generate specific code when + # a target is indeed present. + $target{$1}++ if /^([\w.-]+):/; + &print_makefile($_); } } diff --git a/jmake/jmake.man b/jmake/jmake.man index 2125c0c..afd5e65 100644 --- a/jmake/jmake.man +++ b/jmake/jmake.man @@ -1,4 +1,4 @@ -''' $Id: jmake.man 3 2006-08-25 21:39:07Z rmanfredi $ +''' $Id: jmake.man 47 2010-11-28 22:23:13Z rmanfredi $ ''' ''' Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ''' @@ -152,6 +152,33 @@ To implement a logical OR, see below. .RE .sp .IP 3) +Makefile target tests: +.sp +.RS +.IP \(bu +?\fItarget\fR?:<text>: keeps <test> iff \fItarget\fR is defined. +.IP \(bu +%\fItarget\fR%:<text>: keeps <test> iff \fItarget\fR is not defined. +.sp +A makefile \fItarget\fR is defined as a standalone target, for instance +the +.B depend.local +target, which would be defined as: +.sp +.in +5 +.nf +depend.local: +.sp +.in -5 +.fi +Also note that it is only valid for targets defined +.I so far +in the generated makefile. It is not a predicate that can be used +to test for targets that will eventually be defined later on in the +generation. +.RE +.sp +.IP 4) Commands: .sp .RS @@ -217,9 +244,9 @@ Here is a way to implement a logical OR: .in -5 .sp Actually, this is ugly, because the text has to appear twice. -Fortunately, I did not use it. :-) +Fortunately, I did not use that construct. :-) .sp -But actually, as you have surely already guessed, the best way to +Indeed, as you have surely already guessed, the best way to implement a logical OR is to use De Morgan's Law: .sp .in +5 @@ -233,7 +260,7 @@ text /* If SYMBOL or not TOKEN */ .sp .in -5 .fi -Who said they didn't care ? ;-) +Who said they didn't care about logic? ;-) .sp .PP Expansion is done with the \fIexpand\fR command. It has been provided to @@ -440,7 +467,7 @@ therefore depend on the configuration options chosen when \fIConfigure\fR was run. .RE .sp -.IP 4) +.IP 5) Initializations: .sp .RS @@ -450,7 +477,7 @@ Initializations: ++SYMBOL <value>: Adds <value> to the SYMBOL macro. .RE .sp -.IP 5) +.IP 6) User-defined variables: .sp The user may define CFLAGS, LDFLAGS or DPFLAGS as additional flags to be used |