blob: 051ff5c2e005e9969703a55b7e2343db79190c07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
NUMPROC := 1
OS := $(shell uname)
export NUMPROC
ifeq ($(OS),Linux)
NUMPROC := $(shell grep -c ^processor /proc/cpuinfo)
else ifeq ($(OS),Darwin)
NUMPROC := $(shell sysctl hw.ncpu | awk '{print $$2}')
endif
# Always use # of processory plus 1
NUMPROC:=$$((${NUMPROC}+1))
NUMPROC:=$(shell echo ${NUMPROC})
ifeq ($(NUMPROC),0)
NUMPROC = 1
endif
.NOTPARALLEL:
openwrt/backfire/.repo_access:
mkdir -p openwrt dl
cd openwrt && svn co svn://svn.openwrt.org/openwrt/branches/backfire
ln -s ../../dl $(@D)/
cd $(@D) && ./scripts/feeds update
cd $(@D) && $(MAKE) package/symlinks
touch $@
update/%: openwrt/%/.repo_access
cd $< && svn update
cd $< && ./scripts/feeds update
cd $< && $(MAKE) package/symlinks
touch $</.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 $@~ $@
# 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/%: config/$$(REPO)-$$(PLATFORM)-$$(MODEL).config \
openwrt/$$(REPO)/.repo_access
@echo === Building $(REPO), $(PLATFORM), $(MODEL) ===
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/
cd openwrt/$(REPO) && $(MAKE) -j$(NUMPROC)
mkdir -p $@
rsync -a openwrt/$(REPO)/bin/$(PLATFORM)/ $@/
|