POSIX Issue 8 will require a new assignment operator, :::=.
This operator behaves similarly to the BSD make := operator: the
right-hand side is expanded immediately, but then the value is
re-escaped (all '$' are converted to '$$') and the resulting variable
is considered a recursive variable: the value is re-expanded on use.
* src/variable.h (enum variable_flavor): Add f_expand flavor.
* src/variable.c (do_variable_definition): When defining f_expand,
post-process the result to re-escape '$' characters.
Remove default: to the compiler warns about un-handled enum values.
Set recursive values for both f_recursive and f_expand.
(parse_variable_definition): Rewrite this method.
The previous version was annoying to extend to ':::='.
(print_variable): Remove default: so the compiler warns us about
un-handled enum values.
* src/function.c (func_origin): Remove default: so the compiler warns
us about un-handled enum values.
* doc/make.texi: Add documentation for :::=.
* tests/scripts/variables/define: Add a test for define :::=.
* tests/scripts/variables/flavors: Add tests for :::=.
* tests/scripts/variables/negative: Add tests for :::=.
If multiple intermediate files are built together be sure all of them
are removed after make is finished. Continue to ensure that targets
that exist before make starts are not removed even if they appear to be
intermediate.
Add a number of tests to pattern rules to verify this behavior.
* src/filedef.h (struct file): Add a new is_explicit bitfield.
* src/file.c (rehash_file): Merge the is_explicit bit.
(enter_prereqs): Set is_explicit if the file is explicitly mentioned.
* src/implicit.c (pattern_search): Set intermediate on the file if it's
not explicit.
(record_files): Set is_explicit if a file is mentioned as a target.
* src/remake.c (update_file_1): Set secondary on files that already
exist so they won't be removed.
* tests/scripts/features/double_colon: Add a test for double-colon
pattern rules.
* tests/scripts/features/patternrules: Update KGO for tests where more
files are removed.
Add new tests to verify handling removal of intermediate files in the
context of grouped pattern targets.
Change the handling of included makefiles which are phony targets to
be similar to double-colon rules with no prerequisites: simply don't
build them at all during the remake a makefile phase.
Ensure that any included makefile which is needed but not built
results in an error.
Update the documentation to make this clear.
Add tests to verify this behavior.
* doc/make.texi (Remaking Makefiles): Clarify double-colon exception.
Document that phony targets are handled the same way.
(Phony Targets): Ditto.
* src/main.c (main): Check for phony targets when skipping goals.
Rather than throwing out skipped but failed goals keep them
separately then report them as errors.
* src/read.c (eval): Set the file location on included makefiles even
when there's no error.
* tests/scripts/features/include: Add tests for handling included
makefiles with both phony and double-colon rules to rebuild them.
Accept a "-" directory value to the -I option to clear the set of
directories to be searched up to that point, including the default
directories.
* NEWS: Announce the change.
* doc/make.texi (Summary of Options): Add documentation.
* src/read.c (construct_include_path): Check for '-' and if found,
clear the list of directories to be searched.
* tests/scripts/options/dash-I: Add tests for -I-.
* tests/scripts/variables/INCLUDE_DIRS: Add tests for -I-.
Support a new special target, .NOTINTERMEDIATE. Any file or pattern
prerequisite of this target will never be considered intermediate.
This differs from .SECONDARY in that .SECONDARY files won't be deleted
but they will still not be built if they are missing.
.NOTINTERMEDIATE files are treated the same way as a target which is
explicitly mentioned in the makefile. This is mostly useful with
patterns; obviously mentioning a target explicitly here is enough in
and of itself to make something not intermediate.
Some adjustments made by psmith@gnu.org
* NEWS: Announce the new feature.
* doc/make.texi (Special Targets): Document .NOTINTERMEDIATE.
(Chained Rules): Describe how to use .NOTINTERMEDIATE.
* src/main.c (main): Add "notintermediate" to the .FEATURES variable.
* src/filedef.h (struct file): Add "notintermediate" flag.
* src/file.c (no_intermediates): Mark global .NOTINTERMEDIATE.
(snap_file): Support .NOTINTERMEDIATE special target. Throw an error
if the same target is marked both .NOTINTERMEDIATE and .SECONDARY or
.INTERMEDIATE.
(rehash_file): Merge intermediate, notintermediate, secondary flags.
(remove_intermediates): Check notintermediate flag before removing.
(print_file):
* src/implicit.c (pattern_search): Set notintermediate based on the
pattern.
* tests/scripts/targets/NOTINTERMEDIATE: Add a new test suite.
Add a new function $(let ...) which allows lexically scoped variables.
* NEWS: Add information on this feature.
* doc/make.texi (Let Function): Document the 'let' function.
* src/function.c (func_let): Create the 'let' built-in function.
* tests/scripts/functions/let: Test the 'let' built-in function.
Add debug options to print recipes even if they would otherwise be
silent, and to print the reason that a target was considered out of
date.
Modify --trace to simply be a shorthand for --debug=print,why.
* NEWS: Announce changes.
* doc/make.texi (Summary of Options): Document the new options.
* doc/make.1: Ditto.
* src/debug.h: Add new flags DB_PRINT and DB_WHY.
* src/makeint.h: Remove the trace_flag variable.
* src/job.c (start_job_command): Check debug flags not trace_flag.
(new_job): Ditto.
* src/main.c (trace_flag): Make a static variable for switches.
(decode_debug_flags): Set DB_PRINT and DB_WHY if trace_flag is set.
* tests/scripts/variables/GNUMAKEFLAGS: Update known-good messages.
* tests/scripts/variables/MAKEFLAGS: Ditto.
Rewrite the environment variable algorithm to correctly inherit
export settings from parent variable sets. The new algorithm
for computing the table of environment variables is:
- Start with the most local variable set and proceed to global.
- If the variable already exists in the table and we don't know
its export status, update it with the current variable's status.
- If the variable is not in the table and it's not global, add it
regardless of its status so if it's unexported we remember that.
- If the variable is not in the table and is global, check its
export status and don't add it if we won't export it.
Then when generating the environment variables, check the export
status of each variable in case it was a target-specific variable
and we have determined it should not be exported.
Rework SHELL handling to check at the end whether we added it or
not and if we didn't, add the value from the environment.
* NEWS: Announce support for target-specific "unexport"."
* doc/make.texi (Target-specific): Document the support.
* src/variable.h (enum variable_export): Make into a global type.
* src/read.c (struct vmodifiers): Use enum variable_export rather
than individual booleans.
(parse_var_assignment): Parse the "unexport" keyword.
(eval): Remember the vmodifier value in the variable.
(record_target_var): Ditto.
* src/variable.c (should_export): Check if the variable should be
exported.
(target_environment): Implement the above algorithm.
* tests/scripts/features/export: Test export/unexport with variable
assignments on the same line.
* tests/scripts/features/targetvars: Add a comprehensive suite of
tests for different types of target-specific export / unexport.
* tests/scripts/variables/SHELL: Update the comment.
Ensure that makefiles are rebuilt in the order in which make first
considered them, and document this behavior in the manual.
* NEWS: Add a note about the new behavior
* doc/make.text (How make Processes a Makefile): Document it.
* main.c (main): Inverse the list of makefile goals.
* read.c (read_all_makefiles): Add default makefiles to the list at
the front in reverse order, the same way other makefiles are added.
* tests/scripts/features/include: Add tests to verify rebuild order.
POSIX says that suffix rules cannot have prerequisites, but after
making this change we observed a number of makefiles "in the wild"
that were relying on this behavior and failed.
For .POSIX: makefiles, obey POSIX. Otherwise preserve the old
behavior. However, generate a warning so users know this is a
problem. In a future version we will change all behavior to be
POSIX-conforming.
* NEWS: describe the change
* src/rule.c (convert_to_pattern): If posix_pedantic don't make a
pattern rule if prereqs exist. Otherwise show a warning.
* tests/scripts/features/suffixrules: Add tests for the new behavior
including .POSIX vs. non-.POSIX.
Initial implementation by Christof Warlich <cwarlich@gmx.de>
* NEWS: Announce the new feature.
* doc/make.texi (Other Special Variables): Document .EXTRA_PREREQS.
* src/dep.h (struct dep): New flag to note extra prereq deps.
* src/filedef.h (expand_extra_prereqs): Declare a function to expand
the value of .EXTRA_PREREQS.
* src/file.c (expand_extra_prereqs): Given a struct variable lookup
of .EXTRA_PREREQS, convert it into a list of deps and for each one
make sure it has a struct file and has the new flag set.
(snap_file): A new function invoked by hash_map that will perform
per-file operations: set up second expansion, intermediate, and also
.EXTRA_PREREQS. Manage circular dependencies by ignoring them.
(snap_deps): Defer per-file operations until the end. Look up the
global .EXTRA_PREREQS and pass it along to snap_file for each file.
* src/implicit.c (struct patdeps): Remember the extra prereqs flag.
(pattern_search): Transfer extra prereqs flag settings into the
matched pattern rule.
* src/rule.h (snap_implicit_rules): Rename count_implicit_rules to
snap_implicit_rules since we now do more than count.
* src/rule.c (snap_implicit_rules): As we walk through all the pattern
rules, add in any global .EXTRA_PREREQS to the dep list. Ensure we
take them into account for the max number of prereqs and name length.
* src/main.c (main): Add extra-prereqs to .FEATURES.
Call the renamed snap_implicit_rules.
* tests/scripts/variables/EXTRA_PREREQS: Add tests.
This patch allows "grouped targets" using the &: syntax:
tgt1 tgt2 ... tgtn &: pre1 pre2 ...
recipe
When the &: separator is used (in single or double colon forms), all
the targets are understood to be built by a single invocation of the
recipe. This is accomplished by piggy-backing on the already-existing
pattern rule feature, using the file's "also_make" list.
* NEWS: Add information about grouped targets.
* doc/make.texi (Multiple Targets): Add information on grouped targets.
(Pattern Intro): Refer to the new section to discuss multiple patterns.
* src/main.c (main): Add "grouped-targets" to .FEATURES
* src/read.c (make_word_type): Add new types for &: and &::.
(eval): Recognize the &: and &:: separator and remember when used.
(record_files): Accept an indicator of whether the rule is grouped.
If so, update also_make for each file to depend on the other files.
(get_next_mword): Recognize the &: and &:: word types.
* tests/scripts/features/grouped_targets: New test script.
* AUTHORS: Add Kaz Kylheku
There's no need to frighten users away from capabilities which are
perfectly reasonable and definitely not going away, by calling them
obsolete or discouraged in the manual.
Move the source code (other than glob) into the "src" subdirectory.
Update all scripting and recommendations to support this change.
* *.c, *.h, w32/*: Move to src/
* configure.ac, Makefile.am, maintMakefile: Locate new source files.
* Basic.mk.template, mk/*: Update for new source file locations.
* NEWS, README.DOS.template: Update for new locations.
* build.template, build_w32.bat, builddos.bat: Ditto.
* po/POTFILES.in: Ditto
* tests/run_make_tests.pl, tests/scripts/features/load*: Ditto.
* make.1: Move to doc.
* mk/VMS.mk: Add support for building on VMS (hopefully).
* makefile.vms, prepare_w32.bat: Remove.
* SCOPTIONS: Update to define HAVE_CONFIG_H
* doc/make.texi (Appending): Document this behavior.
* variable.c (do_variable_definition): Only add a space if the variable
value is not empty.
* tests/scripts/variables/flavors: Test this behavior.
* make.1: Document the -E and --eval options.
* doc/make.texi: Document the -E option.
* tests/scripts/options/eval: Test the -E option and MAKEFILES.
* NEWS: Add information about the new option.
* make.1: Document the new flag.
* doc/make.texi: Document the new flag. Remove suggestions that the
.SILENT special target is deprecated or should not be used.
* tests/scripts/options/dash-s: Test the -s and --no-silent options.
* NEWS: Add information about the new option.
Previously if the jobserver was active, MAKEFLAGS would contain only
the -j option but not the number (not -j5 or whatever) so users
could not discover that value. Allow that value to be provided in
MAKEFLAGS without error but still give warnings if -jN is provided
on the command line if the jobserver is already activated.
* NEWS: Discuss the new behavior.
* os.h, posixos.c, w32/w32os.c: Return success/failure from
jobserver_setup() and jobserver_parse_auth().
* main.c (main): Separate the command line storage of job slots (now
in arg_job_slots) from the control storage (in job_slots). Make a
distinction between -jN flags read from MAKEFLAGS and those seen
on the command line: for the latter if the jobserver is enabled then
warn and disable it, as before.
* tests/scripts/features/jobserver: Add new testing.