chiark / gitweb /
&:include feature
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Nov 2019 13:48:21 +0000 (13:48 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 13 Nov 2019 13:48:21 +0000 (13:48 +0000)
subdirmk/README
subdirmk/generate
subdirmk/regen.mk.in

index 7cf84cf756597db3b2073c4c158172456fca59ed..5da0c3d4301d90eb9a39bce077cb9e853607014f 100644 (file)
 & ~ thing thing... &           & may be omitted before EOL or before \EOL
                                other &'s not recognised
 
 & ~ thing thing... &           & may be omitted before EOL or before \EOL
                                other &'s not recognised
 
+start of line (maybe after ws):
+&:<directive> <args>....
+args are processed for & first
+&:include filename             filename should usually be foo.mk.in
+&:-include filename
+
 CAPS is [A-Z][0-9_A-Z]*(?!\w)
 lc is [a-z][-+,0-9_a-z]*(?!\w)
 
 CAPS is [A-Z][0-9_A-Z]*(?!\w)
 lc is [a-z][-+,0-9_a-z]*(?!\w)
 
index 7b8727b1988c254968889387fb5c402a8f7965b6..3208c8d9b333b0ec47355342c244fbd2ce994e5c 100755 (executable)
@@ -125,6 +125,9 @@ sub process_input_mk ($$$$$$$$) {
        return;
     }
     while (<$input>) {
        return;
     }
     while (<$input>) {
+       if (s#^\s*$esc\:##) {
+           $buffering_output='';
+       }
        for (;;) {
            unless (s{^(.*?)(\\)?(?=$esc)}{}) { o $_; last; }
            o $1;
        for (;;) {
            unless (s{^(.*?)(\\)?(?=$esc)}{}) { o $_; last; }
            o $1;
@@ -165,6 +168,20 @@ sub process_input_mk ($$$$$$$$) {
                die "bad escape $$esclitr$_ ";
            }
        }
                die "bad escape $$esclitr$_ ";
            }
        }
+       if (defined $buffering_output) {
+           $_=$buffering_output;
+           $buffering_output=undef;
+           if (m#^(-?)include\s+(\S+)\s+$#) {
+               my $subf = "$srcdir/$2";
+               o "MAKEFILE_TEMPLATES += $subf\n";
+               process_input_mk($dir_prefix, $dir_suffix, $dir_name,
+                                $var_prefix, $targets,
+                                $subf, $esclitr, $subf);
+               o "\n";
+           } else {
+               die "unknown directive $_ ";
+           }
+       }
     }
     $input->error and die "read $f: $!\n";
     close $input or die "close $f: $!\n";
     }
     $input->error and die "read $f: $!\n";
     close $input or die "close $f: $!\n";
index 7e9f0cf108c98f45e997973f2e3ba627279e74ab..bc05e722be1a836c525b3cc40c8ae0afb8bb512d 100644 (file)
@@ -14,11 +14,13 @@ $(CONFIG_STATUS): $(top_srcdir)/$(CONFIGURE)
 
 MAKEFILES += subdirmk/regen.mk
 
 
 MAKEFILES += subdirmk/regen.mk
 
+MAKEFILE_TEMPLATES += $(top_srcdir)/Perdir.mk.in
+
 main.mk $(MAKEFILES): .makefiles.stamp ;
 .makefiles.stamp:                                              \
                $(top_srcdir)/subdirmk/generate                 \
                $(CONFIG_STATUS)                                \
 main.mk $(MAKEFILES): .makefiles.stamp ;
 .makefiles.stamp:                                              \
                $(top_srcdir)/subdirmk/generate                 \
                $(CONFIG_STATUS)                                \
-               $(top_srcdir)/Perdir.mk.in                      \
+               $(MAKEFILE_TEMPLATES)                           \
                $(foreach m,$(MAKEFILES),$(top_srcdir)/$(m).in)
 # This filtering arranges that we can often run config.status to
 # generate only particular output files.  We look for *inputs* that
                $(foreach m,$(MAKEFILES),$(top_srcdir)/$(m).in)
 # This filtering arranges that we can often run config.status to
 # generate only particular output files.  We look for *inputs* that