Skip to content

Commit

Permalink
Merge branch 'dev' into smattering-of-minor-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
McDutchie committed Jan 31, 2024
2 parents b13471f + d9331f1 commit c2bcda9
Show file tree
Hide file tree
Showing 10 changed files with 1,253 additions and 1,225 deletions.
11 changes: 7 additions & 4 deletions src/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ note * Mamfiles are processed by mamake (src/cmd/INIT/mamake.c); we added
note * indentation to improve readability. The language is documented in
note * src/cmd/INIT/README-mamake.md.
note *
make test
make test virtual
make test_announce virtual
exec - : testing KornShell $KSH_VERSION :
done test_announce
make install
make all
make all virtual
exec - ${MAMAKE} -r '*/*' ${MAMAKEARGS}
done all virtual
done all
done install virtual
done test virtual
done test
133 changes: 59 additions & 74 deletions src/cmd/INIT/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,114 +17,98 @@ setv LDFLAGS
note *
note * initialization for all packages
note *
make install
make install virtual
make iffe
prev iffe.sh
exec - ${STDCP} iffe.sh iffe
exec - test -w iffe -a -x iffe || ${STDCHMOD} u+w,+x iffe
done iffe generated
done iffe
make mktest
prev mktest.sh
exec - ${STDCP} mktest.sh mktest
exec - test -w mktest -a -x mktest || ${STDCHMOD} u+w,+x mktest
done mktest generated
done mktest
make package
prev package.sh
exec - ${STDCP} package.sh package
exec - test -w package -a -x package || ${STDCHMOD} u+w,+x package
done package generated
done package
make regress
prev regress.sh
exec - ${STDCP} regress.sh regress
exec - test -w regress -a -x regress || ${STDCHMOD} u+w,+x regress
done regress generated
done regress
make crossexec
prev crossexec.sh
exec - ${STDCP} crossexec.sh crossexec
exec - test -w crossexec -a -x crossexec || ${STDCHMOD} u+w,+x crossexec
done crossexec generated
make mamake
make mamake.o
make mamake.c
prev shlib-compat.h implicit dontcare virtual
prev ast.h implicit dontcare virtual
done mamake.c
exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -c mamake.c
done mamake.o generated
exec - ${CC} ${CCLDFLAGS} ${mam_cc_FLAGS} ${CCFLAGS} ${LDFLAGS} -o mamake mamake.o
done mamake generated
done crossexec
make mkreq
prev mkreq.sh
exec - ${STDCP} mkreq.sh mkreq
exec - test -w mkreq -a -x mkreq || ${STDCHMOD} u+w,+x mkreq
done mkreq generated
done mkreq
make mkreq-maplib
prev mkreq-maplib.sh
exec - ${STDCP} mkreq-maplib.sh mkreq-maplib
exec - test -w mkreq-maplib -a -x mkreq-maplib || ${STDCHMOD} u+w,+x mkreq-maplib
done mkreq-maplib generated
done mkreq-maplib
make mprobe
prev mprobe.sh
exec - ${STDCP} mprobe.sh mprobe
exec - test -w mprobe -a -x mprobe || ${STDCHMOD} u+w,+x mprobe
done mprobe generated
done mprobe
make probe
make probe.sh
prev C+probe
prev make.probe
exec - ${STDCAT} C+probe make.probe > probe.sh
done probe.sh generated
done probe.sh
exec - ${STDCP} probe.sh probe
exec - test -w probe -a -x probe || ${STDCHMOD} u+w,+x probe
done probe generated
done probe
make ${INSTALLROOT}/bin
exec - mkdir -p ${INSTALLROOT}/bin
done ${INSTALLROOT}/bin generated
done ${INSTALLROOT}/bin
make ${INSTALLROOT}/bin/iffe
prev iffe
exec - ${STDCP} -f iffe ${INSTALLROOT}/bin/iffe
done ${INSTALLROOT}/bin/iffe generated
done ${INSTALLROOT}/bin/iffe
make ${INSTALLROOT}/bin/mkreq
prev mkreq
exec - ${STDCP} -f mkreq ${INSTALLROOT}/bin/mkreq
done ${INSTALLROOT}/bin/mkreq generated
done ${INSTALLROOT}/bin/mkreq
make ${INSTALLROOT}/bin/mktest
prev mktest
exec - ${STDCP} -f mktest ${INSTALLROOT}/bin/mktest
done ${INSTALLROOT}/bin/mktest generated
done ${INSTALLROOT}/bin/mktest
make ${INSTALLROOT}/bin/package
prev package
exec - ${STDCP} -f package ${INSTALLROOT}/bin/package
done ${INSTALLROOT}/bin/package generated
done ${INSTALLROOT}/bin/package
make ${INSTALLROOT}/bin/regress
prev regress
exec - ${STDCP} -f regress ${INSTALLROOT}/bin/regress
done ${INSTALLROOT}/bin/regress generated
done ${INSTALLROOT}/bin/regress
make ${PACKAGEROOT}/bin
exec - mkdir -p ${PACKAGEROOT}/bin
done ${PACKAGEROOT}/bin generated
done ${PACKAGEROOT}/bin
make ${PACKAGEROOT}/bin/package
prev package
exec - ${STDCP} -f package ${PACKAGEROOT}/bin/package
done ${PACKAGEROOT}/bin/package generated
done ${PACKAGEROOT}/bin/package
make ${INSTALLROOT}/bin/crossexec
prev crossexec
exec - ${STDCP} -f crossexec ${INSTALLROOT}/bin/crossexec
done ${INSTALLROOT}/bin/crossexec generated
make ${INSTALLROOT}/bin/mamake
prev mamake
note * macOS throws code signature error if 'cp' overwrites Mach-O binary; must remove first
exec - ${STDRM} -f ${INSTALLROOT}/bin/mamake &&
exec - ${STDCP} mamake ${INSTALLROOT}/bin/mamake
done ${INSTALLROOT}/bin/mamake generated
done ${INSTALLROOT}/bin/crossexec
make ${INSTALLROOT}/bin/proto
note *
note * proto(1) has been removed, but install a backward compatibility stub
note * that allows old Mamfiles containing proto commands to keep working.
note *
prev proto.sh
exec - ${STDCP} proto.sh ${INSTALLROOT}/bin/proto && ${STDCHMOD} u+w,+x ${INSTALLROOT}/bin/proto
done ${INSTALLROOT}/bin/proto generated
done ${INSTALLROOT}/bin/proto
note *
note * ksh93 function search on PATH
note * ksh93 builtin command library -lcmd
Expand Down Expand Up @@ -261,44 +245,44 @@ make install
exec - echo "$h$N$p$N$f$N$l$u" > ${INSTALLROOT}/bin/.paths ;;
exec - esac
exec - fi
done ${INSTALLROOT}/bin/.paths generated
done ${INSTALLROOT}/bin/.paths
note *
note * probe initialization
note *
make ${INSTALLROOT}/lib/probe/C
exec - mkdir -p ${INSTALLROOT}/lib/probe/C
done ${INSTALLROOT}/lib/probe/C generated
done ${INSTALLROOT}/lib/probe/C
make ${INSTALLROOT}/lib/probe/C/probe
prev C+probe
exec - ${STDCP} -f C+probe ${INSTALLROOT}/lib/probe/C/probe
done ${INSTALLROOT}/lib/probe/C/probe generated
done ${INSTALLROOT}/lib/probe/C/probe
make ${INSTALLROOT}/lib/probe/C/make
exec - mkdir -p ${INSTALLROOT}/lib/probe/C/make
done ${INSTALLROOT}/lib/probe/C/make generated
done ${INSTALLROOT}/lib/probe/C/make
make ${INSTALLROOT}/lib/probe/C/pp
exec - mkdir -p ${INSTALLROOT}/lib/probe/C/pp
done ${INSTALLROOT}/lib/probe/C/pp generated
done ${INSTALLROOT}/lib/probe/C/pp
make ${INSTALLROOT}/lib/probe/C/mam
exec - mkdir -p ${INSTALLROOT}/lib/probe/C/mam
done ${INSTALLROOT}/lib/probe/C/mam generated
done ${INSTALLROOT}/lib/probe/C/mam
make ${INSTALLROOT}/lib/probe/C/mam/probe
prev mprobe
exec - ${STDCP} -f mprobe ${INSTALLROOT}/lib/probe/C/mam/probe
done ${INSTALLROOT}/lib/probe/C/mam/probe generated
done ${INSTALLROOT}/lib/probe/C/mam/probe
make ${INSTALLROOT}/lib/probe/C/mam/mprobe
prev mprobe
exec - ${STDCP} -f mprobe ${INSTALLROOT}/lib/probe/C/mam/mprobe
done ${INSTALLROOT}/lib/probe/C/mam/mprobe generated
done ${INSTALLROOT}/lib/probe/C/mam/mprobe
make ${INSTALLROOT}/lib/probe/C/make/probe
prev probe
exec - ${STDCP} -f probe ${INSTALLROOT}/lib/probe/C/make/probe
done ${INSTALLROOT}/lib/probe/C/make/probe generated
done ${INSTALLROOT}/lib/probe/C/make/probe
make ${INSTALLROOT}/include/ast
exec - mkdir -p ${INSTALLROOT}/include/ast
done ${INSTALLROOT}/include/ast generated
done ${INSTALLROOT}/include/ast
make ${INSTALLROOT}/lib/lib
exec - mkdir -p ${INSTALLROOT}/lib/lib
done ${INSTALLROOT}/lib/lib generated
done ${INSTALLROOT}/lib/lib
note *
note * check if -ldl is required
note *
Expand All @@ -313,9 +297,9 @@ make install
prev dl.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : dl : dl.c : dl
done dl.req generated
done dl.req
exec - ${STDCP} -f dl.req ${INSTALLROOT}/lib/lib/dl
done ${INSTALLROOT}/lib/lib/dl generated
done ${INSTALLROOT}/lib/lib/dl
note *
note * requiring these is a botch
note *
Expand All @@ -324,18 +308,18 @@ make install
prev iconv.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : iconv : iconv.c : iconv
done iconv.req generated
done iconv.req
exec - ${STDCP} -f iconv.req ${INSTALLROOT}/lib/lib/iconv
done ${INSTALLROOT}/lib/lib/iconv generated
done ${INSTALLROOT}/lib/lib/iconv
make ${INSTALLROOT}/lib/lib/w
make w.req
prev w.c
prev w2.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : w : w.c w2.c : w
done w.req generated
done w.req
exec - ${STDCP} -f w.req ${INSTALLROOT}/lib/lib/w
done ${INSTALLROOT}/lib/lib/w generated
done ${INSTALLROOT}/lib/lib/w
note *
note * miscellaneous -l* checks
note *
Expand All @@ -344,9 +328,9 @@ make install
prev intl.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : intl : intl.c : intl
done intl.req generated
done intl.req
exec - ${STDCP} -f intl.req ${INSTALLROOT}/lib/lib/intl
done ${INSTALLROOT}/lib/lib/intl generated
done ${INSTALLROOT}/lib/lib/intl
make ${INSTALLROOT}/lib/lib/m
make m.req
prev m.c
Expand All @@ -357,17 +341,17 @@ make install
prev m6.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : m : m.c m2.c m3.c m4.c m5.c m6.c : m
done m.req generated
done m.req
exec - ${STDCP} -f m.req ${INSTALLROOT}/lib/lib/m
done ${INSTALLROOT}/lib/lib/m generated
done ${INSTALLROOT}/lib/lib/m
make ${INSTALLROOT}/lib/lib/nsl
make nsl.req
prev nsl.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : nsl : nsl.c : nsl
done nsl.req generated
done nsl.req
exec - ${STDCP} -f nsl.req ${INSTALLROOT}/lib/lib/nsl
done ${INSTALLROOT}/lib/lib/nsl generated
done ${INSTALLROOT}/lib/lib/nsl
note *
note * what was sco smoking
note * almost all of gethost* are in -lnsl except gethostbyname which
Expand All @@ -380,9 +364,9 @@ make install
prev nsl.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : socket : socket.c nsl.c : socket
done socket.req generated
done socket.req
exec - ${STDCP} -f socket.req ${INSTALLROOT}/lib/lib/socket
done ${INSTALLROOT}/lib/lib/socket generated
done ${INSTALLROOT}/lib/lib/socket
note *
note * more substance abuse
note * gdbm's ndbm "compatibility" doesn't supply <ndbm.h>, instead supplies
Expand All @@ -403,22 +387,23 @@ make install
prev gdbm2.c
prev mkreq-maplib
exec - mkreq-maplib ${CC} : dbm : db.c gdbm.c gdbm1.c gdbm2.c : db gdbm_compat gdbm ndbm dbm
done dbm.req generated
done dbm.req
exec - ${STDCP} -f dbm.req ${INSTALLROOT}/lib/lib/dbm
done ${INSTALLROOT}/lib/lib/dbm generated
done install virtual
make test
make test.iffe
done ${INSTALLROOT}/lib/lib/dbm
done install
make test dontcare virtual
make test.iffe virtual
prev iffe.tst
exec - exec "$SHELL" "$INSTALLROOT/bin/regress" iffe.tst iffe
done test.iffe virtual
make test.mamake
exec - regress iffe.tst iffe
done test.iffe
make test.mamake virtual
make mamake.tst
prev mamake.rt
exec - if test mamake.rt -nt mamake.tst
exec - then "$SHELL" "$INSTALLROOT/bin/mktest" --style=regress mamake.rt > mamake.tst
exec - fi
done mamake.tst generated
exec - exec "$SHELL" "$INSTALLROOT/bin/regress" mamake.tst mamake
done test.mamake virtual
done test dontcare virtual
done mamake.tst
exec - : testing mamake as built by package.sh :
exec - regress mamake.tst mamake
done test.mamake
done test
21 changes: 16 additions & 5 deletions src/cmd/INIT/README-mamake.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ It was not worth fixing because it is about as complex as ksh itself --
whereas `mamake` is simple and portable, and offers all the same flexibility.

Compared to the 2012-08-01 AT&T distribution,
ksh 93u+m made a few minor changes to `mamake` that make it easier to maintain Mamfiles by hand:
ksh 93u+m made a few changes to `mamake` that make it easier to maintain Mamfiles by hand:
* If the `MAMAKE_STRICT` variable is set before any other mamake command is executed,
some backward incompatible changes are activated to facilitate maintainability.
* All Mamfiles have been indented for legibility. (See `bin/Mamfile_indent` in the distribution.)
* Indentation and word separators may use any whitespace (e.g. tabs), not only spaces.
* Unrecognized commands and rule attributes throw an error instead of being silently ignored.
* Fixed some crashing bugs and memory leaks.
* The `silent` and `ignore` command prefixes for shell actions are processed internally
for backward compatibility, unless the `MAMAKE_STRICT` variable is set.
* The `prev` command may now be used without a prior `make`...`done` to declare a simple
prerequisite, provided the `MAMAKE_STRICT` variable is set.
* The `notrace` attribute was added to disable xtrace for a rule's shell action.
* If `MAMAKE_STRICT` is set, appending attributes to the `done` command
produces a deprecation warning; please append them to `make` instead.

In addition, the following two simple shell scripts are now provided to aid
in maintaining and modernising Mamfiles:
Expand Down Expand Up @@ -60,7 +67,7 @@ For historical reasons, `info` and `meta` are also ignored.
### Rules ###

`make` *rule* [ *attribute* ... ]
`done` *rule* [ *attribute* ... ]
`done` *rule*

A `make`...`done` block defines the target rule named *rule* using the other commands described here.
Unless the `virtual` attribute is used, *rule* names the pathname of the file generated or referenced by the rule.
Expand All @@ -81,15 +88,18 @@ dependencies of its own, it may even be empty; this has the effect of merely
declaring a dependency on a prerequisite file, such as a source code file that
comes with the distribution or a file generated by a previously run Mamfile.

One or more of the following *attribute*s may be specified
by appending them to the `make` or `done` command:
One or more *attribute*s may be specified by appending them to the `make` command.
(They may also be appended to the `done` command; the effect is the same either way.
This is deprecated and produces a warning if the `MAMAKE_STRICT` variable is defined.)
**Attributes apply to the current rule only and do not propagate down to nested rules.**
The following *attribute*s are available:
* `archive`: Ignored.
Historically used to mark the generation of an `ar`(1) archive.
* `dontcare`: Marks files that do not need to exist.
If the file exists then its last-modified timestamp is checked and propagated,
otherwise it is silently ignored.
* `generated`: Marks rules that produce output files generated by a shell action.
The `exec` command implicitly assigns this attribute, but it is customary to specify it regardless.
The `exec` command implicitly assigns this attribute.
* `ignore`: The timestamp associated with *rule* is ignored in dependency resolution.
* `implicit`: Marks the current rule as an implicit prerequisite of the enclosing parent rule.
An implicit prerequisite can make the parent rule out of date without triggering the parent action.
Expand All @@ -99,6 +109,7 @@ by appending them to the `make` or `done` command:
so that touching `foo.h` does not make `foo.c` out of date while making `foo.o` out of date.
* `joint`: Ignored.
Historically used to mark one of a group of rules that are built by a single shell action.
* `notrace`: Disables echoing (xtrace) of shell action commands.
* `virtual`: Marks a rule that is not associated with any file.
The commands within are executed every time the Mamfile is processed.
By convention, a virtual rule named `all` makes everything,
Expand Down
Loading

0 comments on commit c2bcda9

Please sign in to comment.