mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Build system: make SHOPT_* editable again; allow indenting Mamfiles
The build system is adapted to make SHOPT_* compile-time options
editable without nmake. We can now easily change ksh's compile-time
options by editing src/cmd/ksh93/SHOPT.sh. The bin/package script
is adapted to turn these into compile flags. This resolves the most
important drawback of not using nmake.
Also, mamake now has support for indented Mam (Make Abstract
Machine) code. Only one type of block (make...done) is supported in
Mamfiles, so they are easy to indent automatically. A script to
(re)do this is included.
Since nmake is not going to be restored (it has too many problems
that no one is interested in fixing), this at least makes mamake
significantly easier to work with.
The Makefiles are deleted. They may still be handy for reference to
understand the Mamfiles, but they haven't actually matched the
Mamfiles for a while -- and you can still look in the git history.
Deleting them requires some adaptations to bin/package and mamake.c
because, even though they do not use those files, they still looked
for them to decide whether to build code in a directory.
Finally, this commit incorporates some #pragmas for clang to
suppress annoying warnings about the coding style used in this
historic code base. (gcc does not complain so much.)
src/cmd/ksh93/SHOPT.sh:
- Added.
bin/package, src/cmd/INIT/package.sh:
- cd into our own directory in case we were run from another dir.
- $makefiles: only look for Mamfiles.
- Add ksh compile-options via KSH_SHOPTFLAGS. Include SHOPT.sh.
- make_recurse(): Do not write a missing Makefile.
- finalize environment: Look for Mamfiles instead of Makefiles.
src/cmd/INIT/mamake.c:
- Tell clang to suppress annoying warnings about coding style.
- Update version string and self-documentation.
- input(): Add support for indented Mam code by skipping initial
whitespace on each input line.
- files[]: Instead of looking for various of Makefiles to decide
where to build, only look for Mamfiles.
src/Makefile, src/cmd/INIT/Makefile, src/cmd/Makefile,
src/cmd/builtin/Makefile, src/cmd/ksh93/Makefile, src/lib/Makefile,
src/lib/libast/Makefile, src/lib/libcmd/Makefile,
src/lib/libdll/Makefile, src/lib/libsum/Makefile:
- Removed.
src/Mamfile, src/cmd/INIT/Mamfile, src/cmd/Mamfile,
src/cmd/builtin/Mamfile, src/cmd/ksh93/Mamfile, src/lib/Mamfile,
src/lib/libast/Mamfile, src/lib/libcmd/Mamfile,
src/lib/libdll/Mamfile, src/lib/libsum/Mamfile:
- Indent the code with tabs.
- In ksh93/Mamfile, add ${KSH_SHOPT_FLAGS} to every $CC command.
- In ksh93/Mamfile, add "prev SHOPT.sh" for every *.o file
so they are rebuilt whenever SHOPT.sh changes.
bin/Mamfile_indent:
- Added, in case someone wants to re-indent a Mamfile.
src/cmd/INIT/proto.c, src/cmd/INIT/ratz.c, src/cmd/INIT/release.c,
src/lib/libast/features/common, src/lib/libast/include/ast.h:
- Tell clang to suppress annoying warnings about coding style that
it disapproves of (mainly concerning the use of parentheses).
src/cmd/INIT/cc.darwin, src/cmd/INIT/cc.freebsd,
src/cmd/INIT/cc.openbsd:
- Remove now-redundant clang warning suppression flags.
Resolves: https://github.com/ksh93/ksh/issues/60
This commit is contained in:
parent
47468f56c2
commit
6cc2f6a0af
35 changed files with 11768 additions and 12763 deletions
|
|
@ -18,6 +18,8 @@
|
|||
* *
|
||||
***********************************************************************/
|
||||
#pragma prototyped
|
||||
#pragma clang diagnostic ignored "-Wparentheses"
|
||||
#pragma clang diagnostic ignored "-Wunused-value"
|
||||
|
||||
/*
|
||||
* mamake -- MAM make
|
||||
|
|
@ -25,7 +27,8 @@
|
|||
* coded for portability
|
||||
*/
|
||||
|
||||
static char id[] = "\n@(#)$Id: mamake (AT&T Research) 2011-08-31 $\0\n";
|
||||
#define RELEASE_DATE "2021-01-21"
|
||||
static char id[] = "\n@(#)$Id: mamake (AT&T Research/ksh93) " RELEASE_DATE " $\0\n";
|
||||
|
||||
#if _PACKAGE_ast
|
||||
|
||||
|
|
@ -33,17 +36,15 @@ static char id[] = "\n@(#)$Id: mamake (AT&T Research) 2011-08-31 $\0\n";
|
|||
#include <error.h>
|
||||
|
||||
static const char usage[] =
|
||||
"[-?\n@(#)$Id: mamake (AT&T Research) 2011-08-31 $\n]"
|
||||
"[-?\n@(#)$Id: mamake (AT&T Research/ksh93) " RELEASE_DATE " $\n]"
|
||||
USAGE_LICENSE
|
||||
"[+NAME?mamake - make abstract machine make]"
|
||||
"[+DESCRIPTION?\bmamake\b reads \amake abstract machine\a target and"
|
||||
" prerequisite file descriptions from a mamfile (see \b-f\b) and executes"
|
||||
" actions to update targets that are older than their prerequisites."
|
||||
" Mamfiles are generated by the \b--mam\b option of \bnmake\b(1) and"
|
||||
" \bgmake\b(1) and are portable to environments that only have"
|
||||
" Mamfiles are portable to environments that only have"
|
||||
" \bsh\b(1) and \bcc\b(1).]"
|
||||
"[+?In practice \bmamake\b is used to bootstrap build \bnmake\b(1) and"
|
||||
" \bksh\b(1) in new environments. Mamfiles are used rather than"
|
||||
"[+?Mamfiles are used rather than"
|
||||
" old-\bmake\b makefiles because some features are not reliably supported"
|
||||
" across all \bmake\b variants:]{"
|
||||
" [+action execution?Multi-line actions are executed as a"
|
||||
|
|
@ -1127,7 +1128,10 @@ input(void)
|
|||
else if (*state.input && *(e = state.input + strlen(state.input) - 1) == '\n')
|
||||
*e = 0;
|
||||
state.sp->line++;
|
||||
return state.input;
|
||||
e = state.input;
|
||||
while (isspace(*e))
|
||||
e++; /* allow indentation */
|
||||
return e;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1795,10 +1799,13 @@ scan(Dict_item_t* item, void* handle)
|
|||
|
||||
static char* files[] =
|
||||
{
|
||||
"Nmakefile",
|
||||
"nmakefile",
|
||||
"Makefile",
|
||||
"makefile"
|
||||
"Mamfile"
|
||||
/* ksh 93u+m no longer uses these:
|
||||
* "Nmakefile",
|
||||
* "nmakefile",
|
||||
* "Makefile",
|
||||
* "makefile"
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue