Re: GNU make release candidate 3.99.90 available

Greg McGary <[email protected]>
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
On 05/17/13 01:12, Paul Smith wrote:
> Hi all.  The first release candidate for the next release of GNU make,
> GNU make 4.0, is now available for download:
>

Hi Paul,

This announcement shocked me out of complacency.
Is there any chance I could slip-in a feature at this very late date?
If not, I understand.  When might you make a new release?

The feature is something we discussed many years ago, but I dropped
it because I was preempted by paid work and because I had an ugly
work-around.

The problem surfaces with programs that generate multiple output
files combined with parallelism via -jN. An obvious example is
yacc/bison, for which there is already aspecial-case pattern-rule.
I need to solve the general case, whereoutput filenames don't
fit into the naming pattern required bythe yacc/bison mechanism.

We had discussed syntax like so:

[a b c d]: e f
         generate $<

I'm going to implement this over the weekend, and cross my fingers
that you might be able to slip it in.

G

PS: Here's my kludgy work-around:

### Function: $(call 
generate-many,1=STAMP_FILE_NAME,2=GENERATED_FILE_NAMES,3=SOURCE_FILE_NAMES)
###
### Remove a stamp file if any of its prerequisite generated files are absent

define generate-many
   ifneq (,$$(wildcard $(1)))
     ifneq (,$$(filter-out $$(wildcard $(2)),$(2)))
       $$(warning Removing $(1) because of missing files: \
          $$(call nl-ht,$$(filter-out $$(wildcard $(2)),$(2))))
       dummy := $$(shell $$(RM) $(1))
     endif
   endif
   $(filter-out $(1),$(2)): $(1)
   $(1): $(3) | $(call dir-chop/,$(1))
endef

Deployed like so:

$(eval $(call generate-many,gen-stamp,a b c d,e f))
gen-stamp:
         $(TOUCH) $@-$(pid)
         generate e f
         $(MV) $@-$(pid) $@

In case you want to actually test the above, here's the infrastructure
required:

empty :=
space := $(empty) $(empty)
tab := $(empty)    $(empty)
, := ,
### There MUST be TWO newlines below for $(newline) to expand to a single 
newline
define newline


endef

nl-ht =        $(newline)$(tab)$(subst $(space),$(newline)$(tab),$(strip $(1)))

chop/ =        $(patsubst %/,%,$(1))
dir-chop/ =    $(call chop/,$(dir $(1)))

pid :=        $(shell echo $$PPID)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.