diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -14,17 +14,32 @@ update/%: openwrt/%/.repo_access cd $< && $(MAKE) package/symlinks touch $</.repo_access -# format image/($repo)/openwrt-$(platform)-$(model).bin +# 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 $@~ $@ + +# format image/($repo)/openwrt-$(platform)-$(model) .SECONDEXPANSION: image/%: REPO=$(shell basename $(@D)) image/%: PLATFORM=$(shell echo $(@F) | cut -f2 -d-) image/%: MODEL=$(shell echo $(@F) | cut -f3- -d-) -image/%: openwrt/$$(REPO)/.repo_access config/$$(REPO).config \ - config/$$(REPO)-$$(PLATFORM).patch config/$$(REPO)-$$(PLATFORM)-$$(MODEL).patch +image/%: config/$$(REPO)-$$(PLATFORM)-$$(MODEL).config \ + openwrt/$$(REPO)/.repo_access @echo === Building $(REPO), $(PLATFORM), $(MODEL) === - cp config/$(REPO).config openwrt/$(REPO)/.config - patch openwrt/$(REPO)/.config <config/$(REPO)-$(PLATFORM).patch - patch openwrt/$(REPO)/.config <config/$(REPO)-$(PLATFORM)-$(MODEL).patch + cp $< openwrt/$(REPO)/.config -rm -r openwrt/$(REPO)/files openwrt/$(REPO)/bin/$(PLATFORM) cp -a files/common openwrt/$(REPO)/files rsync -a files/$(PLATFORM)/ openwrt/$(REPO)/files/ |