%.o: %.c
$(COMPILE) $<
-
-&^/configure: &^/configure.ac
- cd &^ && autoconf
-
-config.status: &^/configure
- ./config.status --recheck
-
-subdirs.mk $(MAKFILES): makefiles.phantom
-.INTERMEDIATE: makefiles.phantom
-makefiles.phantom: $(addprefix &^/,$(addsuffix .in,$(MAKEFILES))) \
- config.status &^/build-aux/subdirmk-setup
- ./config.status
+++ /dev/null
-### -*-makefile-gmake-*-
-###
-### Stub subdirectory makefile
-###
-### (c) 2019 Mark Wooding
-###
-
-###----- Licensing notice ---------------------------------------------------
-###
-### This program is free software; you can redistribute it and/or modify
-### it under the terms of the GNU Library General Public License as
-### published by the Free Software Foundation; either version 2 of the
-### License, or (at your option) any later version.
-###
-### This program is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-### GNU Library General Public License for more details.
-###
-### You should have received a copy of the GNU Library General Public
-### License along with this program; if not, write to the Free
-### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-### MA 02111-1307, USA.
-
-SUBDIRS
-
-all:
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-top_builddir = @top_builddir@
-
-subdir = $(patsubst $(top_srcdir)/%,%, $(srcdir))
-%:; $(MAKE) -C$(top_builddir) SUBDIR=$(subdir) $@
INCLUDES=
AC_SUBST(INCLUDES)
-m4_define([SUBDIRSMK_SUBDIRS],
-[m4_map_args_w([$1],[_SUBDIRSMK_SUBDIR(],[/)])])dnl
-
-AC_CONFIG_FILES([subdirs.mk:subdirs.mk.tmp Subdir.mk:Subdir.mk.tmp],[],
-[
-subdirsmk_need_prep=false
-AS_IF([\$ac_need_defaults],
-[subdirsmk_need_prep=true],[
-AS_CASE([" \$ac_config_targets "],[*" subdirs.mk "*],
-[subdirsmk_need_prep=true])])
-AS_IF([\$subdirsmk_need_prep],[
- echo 'running subdirmk-setup'
- '$srcdir'/build-aux/subdirmk-setup --srcdir '$srcdir' $subdirsmk_subdirs
-])])
-
-m4_define([_SUBDIRSMK_SUBDIR],
-[subdirsmk_subdirs="$subdirsmk_subdirs '$1'"
-AC_CONFIG_FILES([$1Subdir.mk:$1Subdir.mk.tmp])])dnl
-
-SUBDIRSMK_SUBDIRS([lib lib/t src])
+m4_include([subdirmk/subdirmk.ac])
+
+SUBDIRMK_SUBDIRS([lib])
+SUBDIRMK_SUBDIRS([lib/t src])
AC_OUTPUT
# $(srcdir)/build-aux/subdirmk-setup SUBDIR...
#
# generates
+# main.mk.tmp
+# and in each subdirectory
# Subdir.mk.tmp
-# Makefile.tmp
+# Makefile
use strict;
default: all
\@: \$@
%: FORCE-ALWAYS-RUN
- \$(MAKE) -C $cd -f subdirs.mk ${dir_prefix}\$@
+ \$(MAKE) -C $cd -f main.mk ${dir_prefix}\$@
Makefile FORCE-ALWAYS-RUN:
\@: \$@
.SUFFIXES:
sub process_tree() {
process_subtree($root, [ ]);
- start_output_file("subdirs.mk.tmp");
+ start_output_file("main.mk.tmp");
foreach my $v (qw(top_srcdir abs_top_srcdir)) {
o "$v=\@$v@\n";
}
--- /dev/null
+
+CONFIGURE ?= configure
+CONFIGURE_AC ?= $(CONFIGURE).ac
+CONFIG_STATUS ?= config.status
+SUBDIRMK ?= subdirmk
+
+&^/$(CONFIGURE): &^/$(CONFIGURE_AC)
+ cd &^ && autoconf
+
+$(CONFIG_STATUS): &^/$(CONFIGURE)
+ ./$(CONFIG_STATUS) --recheck
+
+all-subdirs.mk $(MAKFILES): makefiles.phantom
+.INTERMEDIATE: makefiles.phantom
+makefiles.phantom: $(addprefix &^/,$(addsuffix .in,$(MAKEFILES))) \
+ $(CONFIG_STATUS) &^/$(SUBDIRMK)/generate
+ ./$(CONFIG_STATUS)
--- /dev/null
+
+AC_DEFUN([SUBDIRMK_SUBDIRS],
+[m4_map_args_w([$1],[_SUBDIRMK_SUBDIR(],[/)])])dnl
+
+AC_DEFUN_ONCE([_SUBDIRMK_INIT],[
+ AC_CONFIG_FILES([main.mk:main.mk.tmp Subdir.mk:Subdir.mk.tmp],[],[
+ subdirsmk_need_prep=false
+ AS_IF([\$ac_need_defaults],[
+ subdirsmk_need_prep=true],[
+ AS_CASE([" \$ac_config_targets "],[*" subdirs.mk "*],[
+ subdirsmk_need_prep=true
+ ])
+ ])
+ AS_IF([\$subdirsmk_need_prep],[
+ echo 'running subdirmk/generate'
+ '$srcdir'/subdirmk/generate --srcdir '$srcdir' $subdirsmk_subdirs
+ ])
+ ])
+])
+
+AC_DEFUN([_SUBDIRMK_SUBDIR],[
+ AC_REQUIRE([_SUBDIRMK_INIT])
+ subdirsmk_subdirs="$subdirsmk_subdirs '$1'"
+ AC_CONFIG_FILES([$1Subdir.mk:$1Subdir.mk.tmp])
+])