[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Deferred targets or second expansion? (rename results from split)
From: |
Peng Yu |
Subject: |
Deferred targets or second expansion? (rename results from split) |
Date: |
Tue, 15 Jun 2010 22:58:53 -0500 |
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)
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
- Deferred targets or second expansion? (rename results from split),
Peng Yu <=