-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
86 lines (71 loc) · 2.13 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
##
# Toplevel Makefile RobotRemCtrlFW
#
# Stefan Wendler, [email protected]
##
BASEDIR = .
SRCDIR = src
BINDIR = bin
TESTBINDIR = test-bin
FIRMWARE = firmware.elf
OOCD_IF = interface/openocd-usb.cfg
OOCD_BOARD = board/stm32100b_eval.cfg
TESTSRCDIR = test-src
DEPLOYDIR = deploy
TMPDIR = /tmp
VERSION = 0.1
TARGET = RobotControlFW_v$(VERSION)
all: target
world: target target-test gen-docs
target:
make -C $(SRCDIR)
target-test: target
make -C $(TESTSRCDIR)
gen-docs: target
cd $(SRCDIR) && make gen-docs
style:
cd $(SRCDIR) && make style
cd $(TESTSRCDIR) && make style
check:
make -C $(SRCDIR) check
# We do not check the tests
# make -C $(TESTSRCDIR) check
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
flash-target-test: target-test
openocd -f $(OOCD_IF) -f $(OOCD_BOARD) \
-c init -c targets -c "halt" \
-c "flash write_image erase $(TESTBINDIR)/firmware.elf" \
-c "verify_image $(TESTBINDIR)/$(FIRMWARE)" \
-c "reset run" -c shutdown
deploy-src: target-test check 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-test
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/.
cp -a ./test-bin $(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
tags: target
ctags -R --c++-kinds=+p --fields=+iaS --extra=+q $(SRCDIR)
clean:
make -C $(SRCDIR) clean
make -C $(TESTSRCDIR) clean
rm -fr doc/gen
rm -f bin/*
rm -f test-bin/*