On 17 Jun 2005 at 17:06 UTC-0700, Jason Wessel wrote: > Attached is a patch against the latest CVS to add the function > updatecache. > > Attached is also an example of a batching compiler script. > > The idea here is to use a rule to collect a series of files together > in a variable and pass them all to the compiler at once.
I do something like this when building a library. There is an additional complication for me in that a list of 10K objects in a directory hierarchy exceeds the character length that can be passed to a shell command. So I use a recursive gmake function to build a file containing each item in the list on a separate line, then I use the ~10K line file as input for the command using the unix command 'xargs'. See the man page for that function for more details on usage. I'm attaching my MAKE_LONG_LIST function below. Use it in a target rule, e.g., as follows: LISTFILE := yourtarget.list yourtarget: $(the_very_long_list) $(call MAKE_LONG_LIST,$(LISTFILE),$(the_very_long_list)) xargs $(YOURCOMMAND) $@ < $(LISTFILE) > > I ran into the problem that the standard make 3.80 was not able to > update the time stamps of targets that did not have a direct > dependency of a rule. I would like to get this feature added to gnu > make or learn of another way to do the same thing if it is possible > another way. What you want to do is slightly different. Try chaining the dependencies a little. Your dummy target will be built first. When it comes time to run the .o rules, those files will already be updated and their rules won't be run. SRCS := a.cc b.cc c.cc OBJS := $(SRCS:.cc=.o) .PHONY: dummy dummy: $(SRCS) $(CXX) $(CXXFLAGS) $^ $(OBJS): dummy.foo Ted -- Ted Stern Applications Group Cray Inc. office: 206-701-2182 411 First Avenue South, Suite 600 cell: 206-383-1049 Seattle, WA 98104-2860 FAX: 206-701-2500 Frango ut patefaciam -- I break so that I may reveal (The Paleontological Society motto, equally apropos for debugging)
# # MAKE_LONG_LIST: # # MAKE function to be called when a long variable list needs to be # put into a file with one item on each line. # Two arguments: # $(1) = list name # $(2) = MAKE variable to put into list # # The resulting list can be used in combination with xargs to get # around shell command-line character-length restrictions. # # The current hack is encapsulated in a separate included Makefile # to hide the confusing recursive function. # # RECURSIVE version is requires GNU make-3.80 or higher, but is shorter and # will handle any size list. # # CALC: # Math helper function -- Use shell to do simple operations. # Relies on ksh/bash $(( )) syntax. # If you don't like this or need something more portable, change to # CALC = $(shell echo "$(1)" | bc) CALC = $(shell echo $$(($(1)))) nextindx = $(call CALC,$(3)+1) nextword = $(word $(nextindx),$(2)) nextlist = $(wordlist $(nextindx),$(words $(2)),$(2)) # ADD_TO_LIST: # A recursive function definition to handle iteration # ARG 1 = filename to contain list, one entry per line # ARG 2 = variable containing a very long list # ARG 3 = Increment define ADD_TO_LIST @printf "%s\n" $(wordlist 1,$(3),$(2)) >> $(1) $(if $(nextword),$(call ADD_TO_LIST,$(1),$(nextlist),$(3)),@echo) endef # Actual MAKE_LONG_LIST definition is a wrapper around the recursive call. # Note that the list file is first cleared out using Bourne/ksh/bash syntax. # I just arbitrarily set the iteration size to 500, but you can make it # smaller if the system environment length is still too large. define MAKE_LONG_LIST : > $(1) $(call ADD_TO_LIST,$(1),$(2),500) endef
_______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make