On Tue, Jun 15, 2010 at 10:58 PM, Peng Yu <[email protected]> wrote: > My problem is that I have a number of files to be splitted. Then I > want to add a suffix to each file. > > According to the manual, targets are always immediate. I think that > probably secondexpansion may help in this case. But I'm not clear how > to apply it to my case below. Would you please show me? > > > $ ll -go * > -rw------- 1 478 2010-06-15 22:43 Makefile > > txt: > total 8 > -rw------- 1 3893 2010-06-15 22:26 aaa.txt > -rw------- 1 3893 2010-06-15 22:26 bbb.txt > > $ cat Makefile > .PHONY: all clear > .NOTPARALLEL: all > > TXT:=$(wildcard txt/*_sequence.txt)
Correction: the above line should be TXT:=$(wildcard txt/*.txt) But I still get errors. > PREFIX:=$(patsubst txt/%.txt,output/%,$(TXT)) > > ALL_SPLIT_FILES=$(wildcard output/*/*) > RENAME_ALL_SPLIT_FILES=$(patsubst %,%.txt,$(ALL_SPLIT_FILES)) > > all: ; $(RENAME_ALL_SPLIT_FILES) > > .SECONDEXPANSION: > $$(RENAME_ALL_SPLIT_FILES): %.txt: % > mv $< $@ > > $(RENAME_ALL_SPLIT_FILES): split > > split: $(PREFIX) > > $(PREFIX): output/%: txt/%.txt > mkdir -p $@; split --lines 100 --numeric-suffixes $< $@/; touch . > > clean: > $(RM) -r output > > -- > Regards, > Peng > -- Regards, Peng _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
