forked from esden/superbitrf-firmware
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
71 lines (61 loc) · 2.03 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
##
## This file is part of the superbitrf project.
##
## Copyright (C) 2013 Piotr Esden-Tempski <[email protected]>
##
## This library is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
TEST_TARGETS := test/blink test/usb_cdcacm test/transfer test/multi_usb_cdcacm test/console test/config
# Be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1)
Q := @
# Do not print "Entering directory ...".
# esden: We need to print the directory if we want tools like sublime text to know
# where to jump if you encounter a build error.
#MAKEFLAGS += --no-print-directory
endif
all: lib main tests
$(TEST_TARGETS): lib
@printf " BUILD $@\n";
$(Q)$(MAKE) --directory=$@
tests: $(TEST_TARGETS)
$(Q)true
main: lib
@printf " BUILD main\n";
$(Q)$(MAKE) --directory=src
lib:
$(Q)if [ ! "`ls -A libopencm3`" ] ; then \
echo "######## ERROR ########"; \
echo "\tlibopencm3 is not initialized."; \
echo "\tPlease run:"; \
echo "\t$$ git submodule init"; \
echo "\t$$ git submodule update"; \
echo "\tbefore running make."; \
echo "######## ERROR ########"; \
exit 1; \
fi
$(Q)$(MAKE) -C libopencm3 lib TARGETS="stm32/f1"
flash: main
$(Q)$(MAKE) -C src flash
clean:
$(Q)$(MAKE) -C libopencm3 clean
@printf " CLEAN src\n"
$(Q)$(MAKE) -C src clean
$(Q)for i in $(TEST_TARGETS); do \
if [ -d $$i ]; then \
printf " CLEAN $$i\n"; \
$(MAKE) -C $$i clean SRCLIBDIR=$(SRCLIBDIR) || exit $?; \
fi; \
done
.PHONY: all lib