We want to be able to specify something that appears at the top of
every per-directory segment, principally to provide
for-every-directory variable settings.
A more sophisticated scheme akin to m4 diversions would be possible in
principle, but it would make organising the output files (which must
be processed by autoconf) really awkward - let alone the depenency
management for regenerating the makefiles.
So instead, simply provide a Prefix too. Additionally, soon we are
going to introduce a Final.sd.mk which is processed right at the end.
I think this new scheme will be sufficient in principle to do anything
that might be needed. Sadly it will continue to require that
&:include's are done in the right order.
"Suffix" and "Subdir" tab-complete really badly. In a forthcoming
commit we will rename Subdir.sd.mk to Dir.sd.mk.
Incompatible change. We must update the tests right away.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
where at least something mentions them. So for example, if
&TARGETS_zonk is mentioned in src but not lib, `make zonk' in
lib will fail. If you want to make a target exist everywhere,
where at least something mentions them. So for example, if
&TARGETS_zonk is mentioned in src but not lib, `make zonk' in
lib will fail. If you want to make a target exist everywhere,
-mention its name in Perdir.sd.mk (see below).
+mention its name in Prefix.sd.mk or Suffix.sd.mk (see below).
-Perdir.sd.mk, inclusion
------------------------
+Prefix.sd.mk, Suffix.sd.mk, inclusion
+-------------------------------------
-The file Perdir.sd.mk in the toplevel of the source is automatically
-processed after each individual directory's Subdir.sd.mk, and the
-&-substituted contents therefore appear once for each subdirectory.
+The files Prefix.sd.mk and Suffix.sd.mk in the toplevel of the source
+are automatically processed before and after each individual
+directory's Subdir.sd.mk, and the &-substituted contents therefore
+appear once for each subdirectory.
This lets you do per-directory boilerplate. Some useful boilerplate
is already provided in subdirmk, for you to reference like this:
&:include subdirmk/cdeps.sd.mk
&:include subdirmk/clean.sd.mk
This lets you do per-directory boilerplate. Some useful boilerplate
is already provided in subdirmk, for you to reference like this:
&:include subdirmk/cdeps.sd.mk
&:include subdirmk/clean.sd.mk
-For example you could put that in Perdir.sd.mk.
+For example you could put that in Suffix.sd.mk.
The top-level Subdir.sd.mk is the first makefile included after the
autogenerated `main.mk' which merely has some basic settings and
The top-level Subdir.sd.mk is the first makefile included after the
autogenerated `main.mk' which merely has some basic settings and
How to include `&:include foo.sd.mk' `include foo.mk'
in all relevant .sd.mk in only one
(but not needed for Subdir.sd.mk
How to include `&:include foo.sd.mk' `include foo.mk'
in all relevant .sd.mk in only one
(but not needed for Subdir.sd.mk
If you `include subdirmk/regen.mk', dependency management and
automatic regeneration for all of this template substitution, and for
If you `include subdirmk/regen.mk', dependency management and
automatic regeneration for all of this template substitution, and for
include subdirmk/usual.mk
include subdirmk/regen.mk
include subdirmk/usual.mk
include subdirmk/regen.mk
-Write a Perdir.sd.mk in the toplevel, if you want. It should probably
+Write a Suffix.sd.mk in the toplevel, if you want. It should probably
have:
&:include subdirmk/cdeps.sd.mk
have:
&:include subdirmk/cdeps.sd.mk
&# Usage:
&# &:include subdirmk/cdeps.sd.mk
&# Usage:
&# &:include subdirmk/cdeps.sd.mk
-&# (probably in Perdir.sd.mk)
+&# (probably in Suffix.sd.mk)
&#
&# Arranges for automatic #include dependency tracking for
&# C compilation. The compiler is asked to write the dependencies to
&#
&# Arranges for automatic #include dependency tracking for
&# C compilation. The compiler is asked to write the dependencies to
&# Usage:
&# &:include subdirmk/clean.sd.mk
&# Usage:
&# &:include subdirmk/clean.sd.mk
-&# (probably in Perdir.sd.mk)
+&# (probably in Suffix.sd.mk)
&#
&# Provides a per-directory `clean' target, which deletes all the files
&# in &CLEAN. &OBJECTS, &DEPFILES and &TARGETS are automatically deleted.
&#
&# Provides a per-directory `clean' target, which deletes all the files
&# in &CLEAN. &OBJECTS, &DEPFILES and &TARGETS are automatically deleted.
my ($f, $enoentok) = @_;
process_input_mk($targets, "${srcdir}/$f", \$esclit, $enoentok);
};
my ($f, $enoentok) = @_;
process_input_mk($targets, "${srcdir}/$f", \$esclit, $enoentok);
};
+ $pi->("Prefix.sd.mk", 1);
$pi->("${dir_prefix}Subdir.sd.mk", 0);
$pi->("${dir_prefix}Subdir.sd.mk", 0);
- $pi->("Perdir.sd.mk", 1);
+ $pi->("Suffix.sd.mk", 1);
}
sub process_subtree ($$);
}
sub process_subtree ($$);
# autogenerated - do not edit
# autogenerated - do not edit
# test cases for generate script
# doctests:
# test cases for generate script
# doctests:
all:: $(TOP_TARGETS) sub/all
sometarget1:: $(TOP_TARGETS_sometarget1) sub/sometarget1
all:: $(TOP_TARGETS) sub/all
sometarget1:: $(TOP_TARGETS_sometarget1) sub/sometarget1
SUBDIRMK_MAKEFILES += Subdir.mk
SUBDIRMK_MAKEFILES += sub/Subdir.mk
SUBDIRMK_MAKEFILES += sub/dir/Subdir.mk
SUBDIRMK_MAKEFILES += Subdir.mk
SUBDIRMK_MAKEFILES += sub/Subdir.mk
SUBDIRMK_MAKEFILES += sub/dir/Subdir.mk
-MAKEFILE_TEMPLATES += ./Perdir.sd.mk
+MAKEFILE_TEMPLATES += ./Prefix.sd.mk
MAKEFILE_TEMPLATES += ./Subdir.sd.mk
MAKEFILE_TEMPLATES += ./Subdir.sd.mk
+MAKEFILE_TEMPLATES += ./Suffix.sd.mk
MAKEFILE_TEMPLATES += ./doctest.sd.mk
MAKEFILE_TEMPLATES += ./sub/dir/Subdir.sd.mk
MAKEFILE_TEMPLATES += ./sub/dir/doctest.sd.mk
MAKEFILE_TEMPLATES += ./doctest.sd.mk
MAKEFILE_TEMPLATES += ./sub/dir/Subdir.sd.mk
MAKEFILE_TEMPLATES += ./sub/dir/doctest.sd.mk
# autogenerated - do not edit
# autogenerated - do not edit
# subdirectory test cases
sub/dir/
# subdirectory test cases
sub/dir/
sub/dir/all:: $(sub_dir_TARGETS)
sub/dir/sometarget1:: $(sub_dir_TARGETS_sometarget1)
sub/dir/all:: $(sub_dir_TARGETS)
sub/dir/sometarget1:: $(sub_dir_TARGETS_sometarget1)