diff options
author | Katze Miau <miaukatzemiau@priveasy.de> | 2012-03-02 08:41:04 (GMT) |
---|---|---|
committer | Katze Miau <miaukatzemiau@priveasy.de> | 2012-03-02 08:41:04 (GMT) |
commit | 61a642235abc3cf0f1297f4f386504a110bd0aa5 (patch) | |
tree | 3dadcb773f2d2040d69392cda046f85f127f4ce4 /Makefile | |
parent | 754907fd31da80d247432d02128bb4e9c79d31b0 (diff) |
add toolbin/merge_config to compose configs and files
toolbin/merge_config takes a list of basenames and merges them by
applying them from left to right. If the first basename may refer to a
file or a directory; the resulting merge is of the same type.
Usage:
toolbin/merge_config --merge --dst location [--verbose] base base2 ...
For each basename X up to one of three possible files may exist:
$X - copy $X as result of the merge (overwritting any existing $X)
$X.patch - patch an existing $X
$X.delete - delete an existing $X
toolbin/extract_variants decomposes a string like foo/bar-baz/boing-bu
along the dashes into:
foo/bar-baz-boing-bu
foo/bar-baz-boing
foo/bar-baz
foo/bar
It is used to generate all possible sources merge_config should consider.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 33 |
1 files changed, 10 insertions, 23 deletions
@@ -36,35 +36,22 @@ update/%: openwrt/%/.repo_access # format config/($repo)-$(platform)-$(model).config .SECONDEXPANSION: -config/%.config: REPO=$(shell echo $(@F) | cut -f1 -d-) -config/%.config: PLATFORM=$(shell echo $(@F) | cut -f2 -d- | cut -f1 -d.) -config/%.config: MODEL=$(shell echo $(@F) | cut -f3- -d- | cut -f1 -d.) -config/%.config: $$(shell find config -iname '$$(REPO).config') \ - $$(shell find config -iname '$$(REPO)-$$(PLATFORM).patch') \ - $$(shell find config -iname '$$(REPO)-$$(PLATFORM)-$$(MODEL).patch') - cp config/$(REPO).config $@~ - if [ -n "$(MODEL)" ]; then \ - patch $@~ <config/$(REPO)-$(PLATFORM).patch && \ - patch $@~ <config/$(REPO)-$(PLATFORM)-$(MODEL).patch; \ - else \ - patch $@~ <config/$(REPO)-$(PLATFORM).patch; \ - fi - mv $@~ $@ +config/%.config: config + toolbin/merge_config --merge --verbose --dst $@ \ + $(shell toolbin/extract_variants $(shell echo $@ | sed 's/.config$$//') 2>/dev/null) # format image/($repo)/openwrt-$(platform)-$(model) .SECONDEXPANSION: image/%: REPO=$(shell basename $(@D)) +image/%: HW=$(shell echo $(@F) | cut -f2- -d-) image/%: PLATFORM=$(shell echo $(@F) | cut -f2 -d-) -image/%: MODEL=$(shell echo $(@F) | cut -f3- -d-) -image/%: config/$$(REPO)-$$(PLATFORM)-$$(MODEL).config \ - openwrt/$$(REPO)/.repo_access - @echo === Building $(REPO), $(PLATFORM), $(MODEL) === +image/%: config/$$(REPO)-$$(HW).config openwrt/$$(REPO)/.repo_access + @echo === Building $(REPO), $(HW) === cp $< openwrt/$(REPO)/.config - -rm -r openwrt/$(REPO)/files openwrt/$(REPO)/bin/$(PLATFORM) - cp -a files/common openwrt/$(REPO)/files - [ -d files/$(PLATFORM) ] && rsync -a files/$(PLATFORM)/ openwrt/$(REPO)/files/ - [ -d files/$(PLATFORM)-$(MODEL) ] && rsync -a files/$(PLATFORM)-$(MODEL)/ openwrt/$(REPO)/files/ + -rm -r openwrt/$(REPO)/files openwrt/$(REPO)/bin/$(PLATFORM)/openwrt* + toolbin/merge_config --merge --verbose --dst openwrt/$(REPO)/files \ + files/common $(shell toolbin/extract_variants files/$(HW)) ./name_firmware openwrt/$(REPO) cd openwrt/$(REPO) && $(MAKE) -j$(NUMPROC) - mkdir -p $@ + mkdir -p $(shell dirname $@) rsync -a openwrt/$(REPO)/bin/$(PLATFORM)/ $@/ |