[bffb938] | 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 | # list of all known managers |
---|
| 11 | # This list is used, along with $(MANAGERS) (set by app makefile) |
---|
| 12 | # to build the list of *not wanted* drivers. |
---|
| 13 | # |
---|
| 14 | # ref: target compiler config file for usage |
---|
| 15 | # |
---|
| 16 | |
---|
[6455dde] | 17 | MANAGER_LIST=barrier dpmem event io msg mp part |
---|
| 18 | MANAGER_LIST+=region sem signal timer rtmon ext |
---|
[bffb938] | 19 | |
---|
| 20 | # Convert *real* spellings in $(MANAGERS) (set |
---|
| 21 | # in application makefile) to their "correct" name. |
---|
| 22 | # (I hate abbreviations :-) |
---|
| 23 | |
---|
| 24 | MANAGERS := $(patsubst message, msg, $(MANAGERS)) |
---|
| 25 | MANAGERS := $(patsubst multi_processor, mp, $(MANAGERS)) |
---|
| 26 | MANAGERS := $(patsubst partition, part, $(MANAGERS)) |
---|
| 27 | MANAGERS := $(patsubst rate_monotonic, rtmon, $(MANAGERS)) |
---|
| 28 | MANAGERS := $(patsubst semaphore, sem, $(MANAGERS)) |
---|
| 29 | MANAGERS := $(patsubst dual_ported_memory, dpmem, $(MANAGERS)) |
---|
| 30 | MANAGERS := $(patsubst extension, ext, $(MANAGERS)) |
---|
| 31 | |
---|
| 32 | # allow 'all' to mean all managers |
---|
| 33 | MANAGERS := $(patsubst all, $(MANAGER_LIST), $(MANAGERS)) |
---|
| 34 | |
---|
| 35 | # and finally rip out duplicates |
---|
| 36 | MANAGERS := $(sort $(MANAGERS)) |
---|
| 37 | |
---|
[393d271] | 38 | # |
---|
| 39 | # LIBSUFFIX_VA, will "index" into LIBSUFF-*-v macros and |
---|
[888622c4] | 40 | # convert our ${ARCH} back into .a or _g.a or _p.a based on debug. |
---|
[393d271] | 41 | # Useful for installing libraries. |
---|
| 42 | # |
---|
| 43 | |
---|
| 44 | LIBSUFFIX_OPTIMIZE_V= |
---|
| 45 | LIBSUFFIX_DEBUG_V=_g |
---|
| 46 | |
---|
| 47 | LIB_VARIANT=$(LIBSUFFIX_$(VARIANT_V)_V) |
---|
| 48 | LIBSUFFIX_VA = $(LIB_VARIANT).a |
---|
| 49 | |
---|
[65a60cd] | 50 | # Pull in the desired "target" compiler |
---|
| 51 | # Programs built on the host use automake generated rules. |
---|
[bffb938] | 52 | # This will not change $(ARCH) -- binaries will still be place as per target |
---|
[d6c83529] | 53 | include ${CONFIG.CC} |
---|
[bffb938] | 54 | ifeq (${DEPEND},$(wildcard ${DEPEND})) |
---|
| 55 | include ${DEPEND} # pull in dependencies if they exist |
---|
| 56 | endif |
---|
| 57 | |
---|
[df49c60] | 58 | ifndef AUTOMAKE |
---|
[bffb938] | 59 | # |
---|
| 60 | # Builtin targets for compilation variants |
---|
| 61 | # |
---|
[29e68b75] | 62 | debug: |
---|
[c2646c8] | 63 | $(MAKE) -f $(MAKEFILE) MAKEFILE=$(MAKEFILE) VARIANT=DEBUG |
---|
[df49c60] | 64 | endif |
---|
[bffb938] | 65 | |
---|
| 66 | # |
---|
[888622c4] | 67 | # VARIANT_VA will convert our ${ARCH} back into "" or "debug". |
---|
[bffb938] | 68 | # Handy when one makefile wants to hop over into a peer's tree and |
---|
| 69 | # build something "the same" way. |
---|
| 70 | # |
---|
| 71 | |
---|
[393d271] | 72 | VARIANT-OPTIMIZE-v = |
---|
| 73 | VARIANT-DEBUG-v = debug |
---|
[bffb938] | 74 | |
---|
[393d271] | 75 | VARIANT_VA = $(VARIANT-$(VARIANT_V)-v) |
---|
[bffb938] | 76 | |
---|
| 77 | # |
---|
[888622c4] | 78 | # TARGET_VA will convert $@ (expected to be 'debug' etc.) |
---|
[bffb938] | 79 | # into "" or "install" as appropriate. |
---|
| 80 | # Used for variant recursion. |
---|
| 81 | # |
---|
| 82 | |
---|
| 83 | TARGET_debug_V = all |
---|
| 84 | |
---|
| 85 | TARGET_VA = $(TARGET_$@_V) |
---|
| 86 | |
---|
| 87 | # |
---|
[29e68b75] | 88 | # Builtin clean and distclean rules |
---|
[bffb938] | 89 | # Individual makefiles can add stuff via CLEAN_ADDITIONS and CLOBBER_ADDITIONS |
---|
| 90 | # If desperate to save something, they can override CLEAN_OS, CLEAN_CC, etc. |
---|
| 91 | # |
---|
| 92 | |
---|
[29e68b75] | 93 | clean-am: clean-generic |
---|
| 94 | -$(RM) -r $(CLEAN_OS) $(CLEAN_CC) $(CLEAN_DEPEND) |
---|
| 95 | -$(RM) -r $(VARIANTS) |
---|
[bffb938] | 96 | |
---|
[29e68b75] | 97 | distclean-am: distclean-generic clean-am |
---|
| 98 | -$(RM) -r $(CLOBBER_OS) $(CLOBBER_CC) $(CLOBBER_DEPEND) |
---|
[6693a68] | 99 | |
---|
[df49c60] | 100 | ifndef AUTOMAKE |
---|
[6693a68] | 101 | preinstall-am: |
---|
| 102 | preinstall: preinstall-am |
---|
[29e68b75] | 103 | |
---|
| 104 | distclean: distclean-am |
---|
[7dd4054] | 105 | -$(RM) ./config.status |
---|
| 106 | |
---|
[29e68b75] | 107 | clean: clean-am |
---|
| 108 | |
---|
| 109 | .PHONY: distclean distclean-am |
---|
| 110 | .PHONY: clean clean-am |
---|
[df49c60] | 111 | endif |
---|
[66a9381d] | 112 | |
---|
| 113 | ## what to do about $(EXEEXT) --> $(EXEEXT) |
---|
| 114 | ## -o $(basename $@)$(EXEEXT) OR |
---|
| 115 | ## -o $(basename $@)$(EXEEXT) OR |
---|
| 116 | |
---|
| 117 | DOWNEXT=.ralf |
---|
| 118 | |
---|
| 119 | define bsp-link-c |
---|
| 120 | $(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ |
---|
| 121 | -o $(basename $@).exe $(LINK_OBJS) $(LINK_LIBS) |
---|
| 122 | endef |
---|
| 123 | |
---|
| 124 | define bsp-link-cxx |
---|
| 125 | $(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ |
---|
| 126 | -o $(basename $@).exe $(LINK_OBJS) $(LINK_LIBS) |
---|
| 127 | endef |
---|
| 128 | |
---|
| 129 | define default-bsp-post-link |
---|
| 130 | $(NM) -g -n $@ > $(basename $@).num |
---|
| 131 | $(SIZE) $@ |
---|
| 132 | endef |
---|
| 133 | |
---|
[cb697107] | 134 | ifndef bsp-post-link |
---|
[66a9381d] | 135 | define bsp-post-link |
---|
| 136 | $(default-bsp-post-link) |
---|
| 137 | cp $(basename $@).exe $(basename $@)$(DOWNEXT) |
---|
| 138 | endef |
---|
[cb697107] | 139 | endif |
---|
[66a9381d] | 140 | |
---|
| 141 | define make-exe |
---|
| 142 | $(bsp-link-c) |
---|
| 143 | $(bsp-post-link) |
---|
| 144 | endef |
---|
| 145 | |
---|
| 146 | define make-cxx-exe |
---|
| 147 | $(bsp-link-cxx) |
---|
| 148 | $(bsp-post-link) |
---|
| 149 | endef |
---|