forked from buserror/simavr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
69 lines (52 loc) · 1.61 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
# Makefile
# Normal build will link against the shared library for simavr
# in the current build tree, so you don't have to 'install' to
# run simavr or the examples.
#
# For package building, you will need to pass RELEASE=1 to make
RELEASE ?= 0
DESTDIR = /usr/local
PREFIX = ${DESTDIR}
.PHONY: doc
all: build-simavr build-tests build-examples build-parts
build-simavr: Libs.mk
$(MAKE) -C simavr RELEASE=$(RELEASE)
build-tests: build-simavr
$(MAKE) -C tests RELEASE=$(RELEASE)
build-examples: build-simavr
$(MAKE) -C examples RELEASE=$(RELEASE)
build-parts: build-examples
$(MAKE) -C examples/parts RELEASE=$(RELEASE)
install: install-simavr install-parts
install-simavr:
$(MAKE) -C simavr install RELEASE=$(RELEASE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
install-parts:
$(MAKE) -C examples/parts install RELEASE=$(RELEASE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
# Find whether libelf and libdwarf are available.
Libs.mk:
@echo CONF $@
@echo "# Autogenerated: do not edit." > $@
@if \
echo "#include <libelf.h>" > testit.c && \
$(CC) -E $(CFLAGS) ${AVR_CPPFLAGS} testit.c > /dev/null 2>&1 ; \
then \
echo CFLAGS += -DHAVE_LIBELF >> $@ ; \
echo LDFLAGS += -lelf >> $@ ; \
if \
echo "#include <dwarf.h>" > testit.c && \
$(CC) -E $(CFLAGS) ${AVR_CPPFLAGS} testit.c > /dev/null 2>&1 ; \
then \
echo CFLAGS += -DHAVE_LIBDWARF >> $@ ; \
echo LDFLAGS += -ldwarf >> $@ ; \
fi \
fi
@rm -f testit.c
doc:
$(MAKE) -C doc RELEASE=$(RELEASE)
clean:
$(MAKE) -C simavr clean
$(MAKE) -C tests clean
$(MAKE) -C examples clean
$(MAKE) -C examples/parts clean
$(MAKE) -C doc clean
rm -f Libs.mk