I'll take this up with bug-make.  Thank you again for bringing it up.

GCC has this:

# write_entries_to_file - writes each entry in a list
# to the specified file.  Entries are written in chunks of
# $(write_entries_to_file_split) to accomodate systems with
# severe command-line-length limitations.
# Parameters:
# $(1): variable containing entries to iterate over
# $(2): output file
write_entries_to_file_split = 50
write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
  $(foreach range, \
   $(shell i=1; while test $$i -le $(words $(1)); do \
     echo $$i; i=`expr $$i + $(write_entries_to_file_split)`; done), \
   $(shell echo $(wordlist $(range), \
    $(shell expr $(range) + $(write_entries_to_file_split) - 1), $(1)) \
     | tr ' ' '\n' >> $(2)))


Maybe you can unfunctionize it and do something like

write_entries_to_file = echo $(DISTFILES) | tr ' ' '\n' > DISTFILES.list

write_entries_to_file_split = 50
write_entries_to_file_gnu = $(shell :>dist.lst) \
  $(foreach range, \
   $(shell i=1; while test $$i -le $(words $(DISTFILES)); do \
     echo $$i; i=`expr $$i + $(write_entries_to_file_split)`; done), \
   $(shell echo $(wordlist $(range), \
    $(shell expr $(range) + $(write_entries_to_file_split) - 1),
    $(DISTFILES)) \
     | tr ' ' '\n' >> dist.lst))

# Hoping non-GNU make does nothing with this???  Surely GNU make
# expands unknown function to nothing...
$(eval write_entries_to_file = $$(write_entries_to_file_gnu))

distdir: $(DISTFILES) dist.lst
        ...
        dist_files=`cat dist.lst`
        ...

DISTFILES.list: Makefile
        $(write_entries_to_file)

?

Paolo


Reply via email to