forked from wendlers/ywasp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (73 loc) · 2.06 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
##
# Toplevel Makefile YWasp
#
# Stefan Wendler, [email protected]
##
BASEDIR = .
BINDIR = bin
SRCDIR = src
DEPLOYDIR = deploy
FIRMWARE = firmware.elf
TMPDIR = /tmp
VERSION = 0.1
TARGET = ywasp_v$(VERSION)
# where to install to by default
# where to install to by default
ifeq ($(TARCH),MSP430)
INSTDIR ?= $(HOME)/msp430
else
INSTDIR ?= $(HOME)/sat/arm-none-eabi
endif
#OOCD_IF ?= interface/openocd-usb.cfg
OOCD_IF ?= interface/flyswatter.cfg
ifeq ($(TARCH),STM32_100)
OOCD_BOARD ?= board/stm32100b_eval.cfg
else
OOCD_BOARD ?= board/olimex_stm32_h103.cfg
endif
all: target
world: target gen-docs
target:
make -C $(SRCDIR)
gen-docs: target
cd $(SRCDIR) && make gen-docs
style:
cd $(SRCDIR) && make style
check:
make -C $(SRCDIR) check
deploy-src: target style clean gen-docs
rm -fr $(TMPDIR)/$(TARGET)_src
mkdir $(TMPDIR)/$(TARGET)_src
cp -a ./* $(TMPDIR)/$(TARGET)_src/.
rm -fr $(TMPDIR)/$(TARGET)_src/deploy
rm -fr $(TMPDIR)/$(TARGET)_src/tools
mkdir $(TMPDIR)/$(TARGET)_src/deploy
(cd $(TMPDIR); tar --exclude=".svn" -jcvf $(TARGET)_src.tar.bz2 $(TARGET)_src)
mv $(TMPDIR)/$(TARGET)_src.tar.bz2 $(DEPLOYDIR)/.
deploy-bin: clean target
rm -fr $(TMPDIR)/$(TARGET)_bin
mkdir $(TMPDIR)/$(TARGET)_bin
cp CHANGELOG LICENSE README $(TMPDIR)/$(TARGET)_bin/.
cp -a ./bin $(TMPDIR)/$(TARGET)_bin/.
cp -a ./doc $(TMPDIR)/$(TARGET)_bin/.
(cd $(TMPDIR); tar --exclude=".svn" -jcvf $(TARGET)_bin.tar.bz2 $(TARGET)_bin)
mv $(TMPDIR)/$(TARGET)_bin.tar.bz2 $(DEPLOYDIR)/.
deploy: deploy-src deploy-bin
ifeq ($(TARCH),MSP430)
flash-target: target
mspdebug rf2500 "prog $(BINDIR)/$(FIRMWARE)"
else
flash-target: target
openocd -f $(OOCD_IF) -f $(OOCD_BOARD) \
-c init -c targets -c "halt" \
-c "flash write_image erase $(BINDIR)/$(FIRMWARE)" \
-c "verify_image $(BINDIR)/$(FIRMWARE)" \
-c "reset run" -c shutdown
endif
install:
install -D -d -m 755 $(INSTDIR)/include
install -m 644 $(SRCDIR)/include/ywasp.h $(INSTDIR)/include/.
clean:
make -C $(SRCDIR) clean
rm -fr doc/gen
rm -f bin/*