chiark / gitweb /
WIP
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Nov 2019 13:10:29 +0000 (13:10 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Nov 2019 13:10:29 +0000 (13:10 +0000)
NOTES
Subdir.mk.in [new file with mode: 0644]
build-aux/subdirmk-setup [new file with mode: 0644]
build-aux/subdirmk.in
lib/Subdir.mk.in

diff --git a/NOTES b/NOTES
index b202381..fcb4e95 100644 (file)
--- a/NOTES
+++ b/NOTES
@@ -1,14 +1,20 @@
-&=             =>      subdir
-&_             =>      subdir_
-&/             =>      subdir/
-&CAPS          =>      subdir_CAPS
-&lc            =>      subdir/lc
-
-&.= &._ &./ &.CAPS &.lc        =>      $(top_srcdir)/subdir
-&:= &:_ &:/ &:CAPS &:lc        =>      $(abs_top_srcdir)/subdir
+&=                     =>      subdir
+&_                     =>      subdir_
+&/                     =>      subdir/
+&CAPS                  =>      subdir_CAPS     _ counts
+&lc                    =>      subdir/lc       _ counts
+
+&,= &,_ &,/ &,CAPS &,lc                prefixes $(top_srcdir)/subdir
+&;= &;_ &;/ &;CAPS &;lc                prefixes $(abs_top_srcdir)/subdir
+
+&.                     =>      $(top_srcdir)
+&:                     =>      $(abs_top_srcdir)
+
 & thing thing          =>      like &thing &thing (until EOL)
 & thing thing          =>      like &thing &thing (until EOL)
+                               (edits only `thing's which are CAPS or lc
+                               and follow a space)
 
 
-&&             =>      &
+&&                     =>      &
 
 &! spc         disables & *until* EOL
 
 
 &! spc         disables & *until* EOL
 
@@ -22,3 +28,7 @@ eg notably
 eg
  &!@@@         @@@ is recognised instead of &
  @@@!&         go back to &
 eg
  &!@@@         @@@ is recognised instead of &
  @@@!&         go back to &
+
+&TARGETS[_things]              is handled specially
+                               must be spelled precisely this way
+                               if no _things, means _all
diff --git a/Subdir.mk.in b/Subdir.mk.in
new file mode 100644 (file)
index 0000000..792d600
--- /dev/null
@@ -0,0 +1 @@
+#
diff --git a/build-aux/subdirmk-setup b/build-aux/subdirmk-setup
new file mode 100644 (file)
index 0000000..9f3c8c6
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+#
+# $(srcdir)/build-aux/subdirmk-setup SUBDIR...
+#
+# generates
+#   Subdir.mk.tmp
+#   Makefile.tmp
+
+use strict;
+
+our @allsubdirs = @ARGV;
+
+sub write_makefile () {
+    start_output_file("Makefile");
+    print O <<END;
+%:
+       $(MAKE) -C @top $subdir/$@
+END
+
+    my @thesedirs = $subdir, grep { $_ =~ m{^$subdir/} } @allsubdirs;
+    printf O "include $_/Subdir.mk"
+       
+
+
+sub process_subdir ($$) {
+    my ($subdir) = @_;
+    my $d
+    write_makefile($subdir);
+    filter_subdir_mk();
+}
+
+foreach (@allsubdirs) { process_subdir($_); }
index 33d9875..5b8cfc6 100644 (file)
@@ -22,6 +22,8 @@
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA.
 
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA.
 
+SUBDIRS
+
 all:
 
 srcdir                  = @srcdir@
 all:
 
 srcdir                  = @srcdir@
index 8dd75e1..6162e90 100644 (file)
@@ -23,7 +23,7 @@
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA.
 
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA.
 
-&TARGETS_all   += & libtoy.a
+&TARGETS       += & libtoy.a
 
 &OBJECTS       += & toylib.c
 
 
 &OBJECTS       += & toylib.c