chiark / gitweb /
WIP REORG
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 12 Nov 2019 17:34:03 +0000 (17:34 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 12 Nov 2019 17:34:03 +0000 (17:34 +0000)
Subdir.mk.in
build-aux/subdirmk.in [deleted file]
configure.ac
subdirmk/generate [moved from build-aux/subdirmk-setup with 97% similarity]
subdirmk/regen.mk.in [new file with mode: 0644]
subdirmk/subdirmk.ac [new file with mode: 0644]

index fa38d6578e06fdea3e002767cfdddfb3e8847823..ef342802ad52f25477035edb2e318b810802efd0 100644 (file)
@@ -22,15 +22,3 @@ COMPILE              ?= $(CC) -c -o$@ -MD $(DEFS) $(INCLUDES) $(CFLAGS)
 
 %.o: %.c
        $(COMPILE) $<
 
 %.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
diff --git a/build-aux/subdirmk.in b/build-aux/subdirmk.in
deleted file mode 100644 (file)
index 5b8cfc6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-### -*-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) $@
index e56fee9a188399f01a9643912ca48fa12887718f..acd7f47dbe066f52b230d404730cdc046eac14f6 100644 (file)
@@ -32,26 +32,10 @@ AC_PROG_CC
 INCLUDES=
 AC_SUBST(INCLUDES)
 
 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
 
 
 AC_OUTPUT
 
similarity index 97%
rename from build-aux/subdirmk-setup
rename to subdirmk/generate
index e6e30e039912fd36f5703982199d3d7cc7cad736..857e768cd494b317ba14b0f8851fbec11362c787 100755 (executable)
@@ -3,8 +3,10 @@
 # $(srcdir)/build-aux/subdirmk-setup SUBDIR...
 #
 # generates
 # $(srcdir)/build-aux/subdirmk-setup SUBDIR...
 #
 # generates
+#   main.mk.tmp
+# and in each subdirectory
 #   Subdir.mk.tmp
 #   Subdir.mk.tmp
-#   Makefile.tmp
+#   Makefile
 
 use strict;
 
 
 use strict;
 
@@ -81,7 +83,7 @@ sub write_makefile ($$) {
 default: all
        \@: \$@
 %:     FORCE-ALWAYS-RUN
 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:
 Makefile FORCE-ALWAYS-RUN:
        \@: \$@
 .SUFFIXES:
@@ -196,7 +198,7 @@ sub process_subtree ($$) {
 
 sub process_tree() {
     process_subtree($root, [ ]);
 
 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";
     }
     foreach my $v (qw(top_srcdir abs_top_srcdir)) {
        o "$v=\@$v@\n";
     }
diff --git a/subdirmk/regen.mk.in b/subdirmk/regen.mk.in
new file mode 100644 (file)
index 0000000..0e8bb6a
--- /dev/null
@@ -0,0 +1,17 @@
+
+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)
diff --git a/subdirmk/subdirmk.ac b/subdirmk/subdirmk.ac
new file mode 100644 (file)
index 0000000..43963df
--- /dev/null
@@ -0,0 +1,25 @@
+
+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])
+])