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