-
Notifications
You must be signed in to change notification settings - Fork 110
/
Makefile.am
133 lines (114 loc) · 3.84 KB
/
Makefile.am
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
ACLOCAL_AMFLAGS = -I config/m4
AUTOMAKE_OPTIONS = foreign
host_abs_top_builddir = $(abs_top_builddir)/../..
# Use noinst_HEADERS over EXTRA_DIST to work around Automake conditional
# include (IMHO) bug.
#EXTRA_DIST =
SUBDIRS =
DIST_SUBDIRS =
CLEANFILES =
BUILT_SOURCES =
lib_LTLIBRARIES =
bin_PROGRAMS =
include_HEADERS =
noinst_HEADERS =
noinst_LTLIBRARIES =
noinst_PROGRAMS =
check_PROGRAMS =
SUFFIXES =
# Automake hooks / local rules
CLEAN_LOCAL_TARGETS =
INSTALL_HTML_LOCAL_TARGETS =
UNINSTALL_LOCAL_TARGETS =
INSTALL_DATA_LOCAL_TARGETS =
ALL_LOCAL_TARGETS =
CHECK_TARGETS =
clean-local: $(CLEAN_LOCAL_TARGETS)
install-html-local: $(INSTALL_HTML_LOCAL_TARGETS)
uninstall-local: $(UNINSTALL_LOCAL_TARGETS)
install-data-local: $(INSTALL_DATA_LOCAL_TARGETS)
all-local: $(ALL_LOCAL_TARGETS)
check: $(CHECK_TARGETS)
# All hooks / local targets are phonies?
PHONIES = \
$(CLEAN_LOCAL_TARGETS) \
$(INSTALL_HTML_LOCAL_TARGETS) \
$(UNINSTALL_LOCAL_TARGETS) \
$(INSTALL_DATA_LOCAL_TARGETS) \
$(ALL_LOCAL_TARGETS)
.PHONY: $(PHONIES)
# DEVICE_RULES: Programs and C sources with dev-XXXX suffix will be built
# with device tools and flags.
DEVICE_OVERRIDE_FLAGS := CC LD CFLAGS CPPFLAGS AM_CFLAGS AM_CPPFLAGS LDFLAGS LDADD AM_LDFLAGS LIBADD LIBS
define DEVICE_RULES_
%-dev-$(1)$(EXEEXT): $(3)=$$($(2)_$(3))
%-dev-$(1).$(OBJEXT): $(3)=$$($(2)_$(3))
endef
define DEVICE_RULES
$(foreach flag,$(DEVICE_OVERRIDE_FLAGS),$(eval $(call DEVICE_RULES_,$(1),$(2),$(flag))))
# Copy from generic dev file if not exists
%-dev-$(1).c: %-dev.c
cp $$^ $$@
endef
$(eval $(call DEVICE_RULES,epiphany,EPIPHANY))
EPIPHANY_CPPFLAGS:=$(CPPFLAGS)
EPIPHANY_AM_CPPFLAGS:=$(AM_CPPFLAGS)
EPIPHANY_LDADD = $(abs_top_builddir)/../devices/epiphany/src/libpal.la
# TODO: Move to configure.ac / become independent
if HOST_IS_EPIPHANY
ESDK = /opt/adapteva/esdk
EINCS = -I$(ESDK)/tools/host/include
ELIBS = -L$(ESDK)/tools/host/lib
CFLAGS_FOR_BUILD += -DPAL_SOURCE -I$(top_srcdir)/include $(EINCS)
LDFLAGS_FOR_BUILD += -L$(host_abs_top_builddir)/src/.libs \
-Wl,-rpath=$(host_abs_top_builddir)/src/.libs -lpal
endif
if BUILD_DEV_EPIPHANY
if PAL_IS_TOPDIR
SUBDIRS += devices/epiphany
DIST_SUBDIRS += devices/epiphany
else
-include ../devices/epiphany/Makemodule.host.am
endif
endif
# Top level targets
noinst_HEADERS += config include bootstrap CHANGELOG.md CODING-STYLE.md \
CONTRIBUTING.md LICENSE QUESTIONS.md README.md scripts
noinst_HEADERS += host/placeholder.txt
noinst_HEADERS += devices/epiphany/placeholder.txt
# Reports
PHONIES += reports report-code-size report-stack-usage
report-code-size: all
@mkdir -p reports
$(SHELL) $(top_srcdir)/scripts/report-code-size.sh src \
> reports/code-size.txt
@echo Code size report saved to reports/code-size.txt
report-stack-usage: all
@mkdir -p reports
$(SHELL) $(top_srcdir)/scripts/report-stack-usage.sh src \
> reports/stack-usage.txt
@echo Stack usage report saved to reports/stack-usage.txt
reports: report-code-size report-stack-usage
clean-local-top:
-rm -rf reports
-find . -type f -name "*.su" -delete
CLEAN_LOCAL_TARGETS += clean-local-top
if PAL_IS_TOPDIR
SUBDIRS += host
DIST_SUBDIRS += host
if ENABLE_DOC
include doc/Makemodule.am
endif
else
include include/Makemodule.am
include src/Makemodule.am
if ENABLE_EXAMPLES
include examples/Makemodule.am
endif
if ENABLE_BENCHMARK
include benchmark/Makemodule.am
endif
if ENABLE_TESTS
include tests/Makemodule.am
endif
endif