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 b2023817f2beb3c80a9cab908a9623f60bf58fff..fcb4e9505de16160bfbf1c5f79bcd92dadbcecfc 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)
+                               (edits only `thing's which are CAPS or lc
+                               and follow a space)
 
-&&             =>      &
+&&                     =>      &
 
 &! spc         disables & *until* EOL
 
@@ -22,3 +28,7 @@ eg notably
 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 33d9875a2a5055f77d2ac0718628a56ff24faa00..5b8cfc6d2683ab8ca37077b12a58e12b46797c03 100644 (file)
@@ -22,6 +22,8 @@
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA.
 
+SUBDIRS
+
 all:
 
 srcdir                  = @srcdir@
index 8dd75e1a330b6d00939d383b263c9f6489219a3d..6162e90ec3cf3b7adb337c4a591bfa3cef6d327e 100644 (file)
@@ -23,7 +23,7 @@
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA.
 
-&TARGETS_all   += & libtoy.a
+&TARGETS       += & libtoy.a
 
 &OBJECTS       += & toylib.c