1 | # make/leaf.cfg |
---|
2 | # |
---|
3 | # Make(1) configuration file include'd by all leaf-node Makefiles |
---|
4 | # |
---|
5 | |
---|
6 | # |
---|
7 | # LIBSUFFIX_VA, will "index" into LIBSUFF-*-v macros and |
---|
8 | # convert our ${ARCH} back into .a or _g.a or _p.a based on debug. |
---|
9 | # Useful for installing libraries. |
---|
10 | # |
---|
11 | |
---|
12 | LIBSUFFIX_OPTIMIZE_V= |
---|
13 | LIBSUFFIX_DEBUG_V=_g |
---|
14 | |
---|
15 | LIB_VARIANT=$(LIBSUFFIX_$(VARIANT_V)_V) |
---|
16 | LIBSUFFIX_VA = $(LIB_VARIANT).a |
---|
17 | |
---|
18 | # Pull in the desired "target" compiler |
---|
19 | # Programs built on the host use automake generated rules. |
---|
20 | # This will not change $(ARCH) -- binaries will still be place as per target |
---|
21 | include ${CONFIG.CC} |
---|
22 | ifeq (${DEPEND},$(wildcard ${DEPEND})) |
---|
23 | include ${DEPEND} # pull in dependencies if they exist |
---|
24 | endif |
---|
25 | |
---|
26 | ifndef AUTOMAKE |
---|
27 | # |
---|
28 | # Builtin targets for compilation variants |
---|
29 | # |
---|
30 | debug: |
---|
31 | $(MAKE) -f $(MAKEFILE) MAKEFILE=$(MAKEFILE) VARIANT=DEBUG |
---|
32 | endif |
---|
33 | |
---|
34 | # |
---|
35 | # VARIANT_VA will convert our ${ARCH} back into "" or "debug". |
---|
36 | # Handy when one makefile wants to hop over into a peer's tree and |
---|
37 | # build something "the same" way. |
---|
38 | # |
---|
39 | |
---|
40 | VARIANT-OPTIMIZE-v = |
---|
41 | VARIANT-DEBUG-v = debug |
---|
42 | |
---|
43 | VARIANT_VA = $(VARIANT-$(VARIANT_V)-v) |
---|
44 | |
---|
45 | # |
---|
46 | # TARGET_VA will convert $@ (expected to be 'debug' etc.) |
---|
47 | # into "" or "install" as appropriate. |
---|
48 | # Used for variant recursion. |
---|
49 | # |
---|
50 | |
---|
51 | TARGET_debug_V = all |
---|
52 | |
---|
53 | TARGET_VA = $(TARGET_$@_V) |
---|
54 | |
---|
55 | # |
---|
56 | # Builtin clean and distclean rules |
---|
57 | # Individual makefiles can add stuff via CLEAN_ADDITIONS and CLOBBER_ADDITIONS |
---|
58 | # If desperate to save something, they can override CLEAN_OS, CLEAN_CC, etc. |
---|
59 | # |
---|
60 | |
---|
61 | clean-am: clean-generic |
---|
62 | -$(RM) -r $(CLEAN_OS) $(CLEAN_CC) $(CLEAN_DEPEND) |
---|
63 | -$(RM) -r $(VARIANTS) |
---|
64 | |
---|
65 | distclean-am: distclean-generic clean-am |
---|
66 | -$(RM) -r $(CLOBBER_OS) $(CLOBBER_CC) $(CLOBBER_DEPEND) |
---|
67 | |
---|
68 | ifndef AUTOMAKE |
---|
69 | preinstall-am: |
---|
70 | preinstall: preinstall-am |
---|
71 | |
---|
72 | distclean: distclean-am |
---|
73 | -$(RM) ./config.status |
---|
74 | |
---|
75 | clean: clean-am |
---|
76 | |
---|
77 | .PHONY: distclean distclean-am |
---|
78 | .PHONY: clean clean-am |
---|
79 | endif |
---|
80 | |
---|
81 | EXEEXT?=.exe |
---|
82 | DOWNEXT?=.ralf |
---|
83 | |
---|
84 | define bsp-link-c |
---|
85 | $(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ |
---|
86 | -o $(basename $@)$(EXEEXT) $(LINK_OBJS) $(LINK_LIBS) |
---|
87 | endef |
---|
88 | |
---|
89 | define bsp-link-cxx |
---|
90 | $(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ |
---|
91 | -o $(basename $@)$(EXEEXT) $(LINK_OBJS) $(LINK_LIBS) |
---|
92 | endef |
---|
93 | |
---|
94 | define default-bsp-post-link |
---|
95 | $(NM) -g -n $@ > $(basename $@).num |
---|
96 | $(SIZE) $@ |
---|
97 | endef |
---|
98 | |
---|
99 | ifndef bsp-post-link |
---|
100 | define bsp-post-link |
---|
101 | $(default-bsp-post-link) |
---|
102 | cp $(basename $@)$(EXEEXT) $(basename $@)$(DOWNEXT) |
---|
103 | endef |
---|
104 | endif |
---|
105 | |
---|
106 | define make-exe |
---|
107 | $(bsp-link-c) |
---|
108 | $(bsp-post-link) |
---|
109 | endef |
---|
110 | |
---|
111 | define make-cxx-exe |
---|
112 | $(bsp-link-cxx) |
---|
113 | $(bsp-post-link) |
---|
114 | endef |
---|