forked from esper-hub/esper
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
54 lines (34 loc) · 1.28 KB
/
Makefile
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
export BASEDIR := $(CURDIR)
ifndef SITE
$(error SITE is not set. Please Specify a site directory.)
else
export SITEDIR := $(abspath $(SITE))
endif
export BUILDDIR = $(BASEDIR)/build
export DISTDIR = $(BASEDIR)/dist
# Find devices
DEVICES := $(sort $(notdir $(wildcard $(SITEDIR)/devices/*) $(wildcard $(BASEDIR)/devices/*)))
.PHONY: all
all: $(DEVICES)
.PHONY: $(addsuffix /build,$(DEVICES))
$(addsuffix /build,$(DEVICES)): %/build:
mkdir -p $(BUILDDIR)/$*
$(MAKE) -C $(BUILDDIR)/$* -f $(BASEDIR)/Device.mk DEVICE=$*
.PHONY: $(addsuffix /erase,$(DEVICES))
$(addsuffix /erase,$(DEVICES)): %/erase: %/build
$(MAKE) -C $(BUILDDIR)/$* -f $(BASEDIR)/Device.mk DEVICE=$* flashinit
.PHONY: $(addsuffix /flash,$(DEVICES))
$(addsuffix /flash,$(DEVICES)): %/flash: %/build
$(MAKE) -C $(BUILDDIR)/$* -f $(BASEDIR)/Device.mk DEVICE=$* flash
.PHONY: $(addsuffix /dist,$(DEVICES))
$(addsuffix /dist,$(DEVICES)): %/dist: %/build
mkdir -p $(DISTDIR)
cp $(BUILDDIR)/$*/out/firmware/rboot.bin $(DISTDIR)/$*.rboot
cp $(BUILDDIR)/$*/out/firmware/rom0.bin $(DISTDIR)/$*.rom0
cp $(BUILDDIR)/$*/out/firmware/rom1.bin $(DISTDIR)/$*.rom1
cp $(BUILDDIR)/$*/out/firmware/version $(DISTDIR)/$*.version
.PHONY: $(DEVICES)
$(DEVICES): %: %/build %/dist
.PHONY: clean
clean:
rm -f -r $(BUILDDIR) $(DISTDIR)