[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU make release candidate 3.99.90 available

From: Greg McGary
Subject: Re: GNU make release candidate 3.99.90 available
Date: Fri, 17 May 2013 13:14:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5

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

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.


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))
  $(filter-out $(1),$(2)): $(1)
  $(1): $(3) | $(call dir-chop/,$(1))

Deployed like so:

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

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

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


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

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

pid :=        $(shell echo $$PPID)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]