- constantly having to write out long file and directory names
- the lack of a per-directory make variable namespace means
long make variables (or namespace clashes)
- - it is difficult to arrange that one can cd to a subdirectory
+ - it is difficult to arrange that one can cd to a subdirectory
and say `make all' and have something reasonable happen
(to wit, build an appropriate subset)
case (in general in variable names we call that TOP rather than the
empty string).
-&CAPS => sub_dir_CAPS or TOP_CAPS
-&lc => sub/dir/lc or lc
+&CAPS => sub_dir_CAPS or TOP_CAPS
+&lc => sub/dir/lc or lc
Here CAPS is any ASCII letter A-Z and lc is a-z.
The assumption is that filenames are usually lowercase and
variables usually uppercase. Otherwise, use another syntax:
#!/bin/sh
# subdirmk, autogen.sh (conventional autoconf invocation script)
-# Copyright 2019 Mark Wooding
# Copyright 2019 Ian Jackson
# SPDX-License-Identifier: LGPL-2.0-or-later
set -e
%: FORCE-ALWAYS-RUN
\@:
Makefile FORCE-ALWAYS-RUN:
- \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(MAKECMDGOALS))
+ \$(MAKE) -C $cd -f main.mk \$(addprefix ${dir_prefix},\$(or \$(MAKECMDGOALS),all))
.SUFFIXES:
+.PHONY: FORCE-ALWAYS-RUN
END
}
}
print O "\n";
}
-
+
return @targets;
}
# SPDX-License-Identifier: LGPL-2.0-or-later
CONFIGURE ?= configure
-CONFIGURE_AC ?= $(CONFIGURE).ac
-CONFIG_STATUS ?= config.status
+CONFIGURE_AC ?= $(CONFIGURE).ac
+CONFIG_STATUS ?= config.status
-CONFIGURE_ACS += $(CONFIGURE_AC)
-CONFIGURE_ACS += subdirmk/subdirmk.ac
+CONFIGURE_ACS += $(CONFIGURE_AC)
+CONFIGURE_ACS += subdirmk/subdirmk.ac
$(top_srcdir)/$(CONFIGURE): $(addprefix $(top_srcdir)/,$(CONFIGURE_ACS))
cd $(top_srcdir) && autoconf
))
main.mk $(MAKEFILES): .makefiles.stamp ;
-.makefiles.stamp: \
+.makefiles.stamp: \
$(top_srcdir)/subdirmk/generate \
$(CONFIG_STATUS) \
$(MAKEFILE_TEMPLATES)
$(filter-out Subdir.sd.mk %/Subdir.sd.mk \
%.mk.in \
, $?),, \
- $(sort \
+ $(patsubst $(top_srcdir)/%,%, $(sort \
$(patsubst %.sd.mk,%.mk,$(filter %.sd.mk,$?)) \
- $(patsubst %.mk.in,%.mk,$(filter %.mk.in,$?))))
+ $(patsubst %.mk.in,%.mk,$(filter %.mk.in,$?)))))
touch $@
realclean:: clean
# Copyright 2019 Ian Jackson
# SPDX-License-Identifier: LGPL-2.0-or-later
-VPATH = &^
+VPATH = $(top_srcdir)
prefix = @prefix@
exec_prefix = @exec_prefix@