2c3632d14f
Lots of code refactoring, simplification and cleanup. Lots of new unit-tests providing much higher code coverage. All courtesy of rillig at netbsd. Other significant changes: o new read-only variable .SHELL which provides the path of the shell used to run scripts (as defined by the .SHELL target). o variable parsing detects more errors. o new debug option -dl: LINT mode, does the equivalent of := for all variable assignments so that file and line number are reported for variable parse errors.
38 lines
1.1 KiB
Makefile
Executable File
38 lines
1.1 KiB
Makefile
Executable File
# $NetBSD: sh-dots.mk,v 1.1 2020/08/22 11:27:02 rillig Exp $
|
|
#
|
|
# Tests for the special shell command line "...", which does not run the
|
|
# commands below it but appends them to the list of commands that are run
|
|
# at the end.
|
|
|
|
all: first hidden repeated commented
|
|
|
|
# The ${.TARGET} correctly expands to the target name, even though the
|
|
# commands are run separately from the main commands.
|
|
first:
|
|
@echo first ${.TARGET}
|
|
...
|
|
@echo first delayed ${.TARGET}
|
|
|
|
# The dots cannot be prefixed by the usual @-+ characters.
|
|
# They must be written exactly as dots.
|
|
hidden: .IGNORE
|
|
@echo hidden ${.TARGET}
|
|
@...
|
|
@echo hidden delayed ${.TARGET}
|
|
|
|
# Since the shell command lines don't recognize '#' as comment character,
|
|
# the "..." is not interpreted specially here.
|
|
commented: .IGNORE
|
|
@echo commented ${.TARGET}
|
|
... # Run the below commands later
|
|
@echo commented delayed ${.TARGET}
|
|
|
|
# The "..." can appear more than once, even though that doesn't make sense.
|
|
# The second "..." is a no-op.
|
|
repeated: .IGNORE
|
|
@echo repeated ${.TARGET}
|
|
...
|
|
@echo repeated delayed ${.TARGET}
|
|
...
|
|
@echo repeated delayed twice ${.TARGET}
|