[bffb938] | 1 | # make/leaf.cfg |
---|
| 2 | # |
---|
| 3 | # Make(1) configuration file include'd by all leaf-node Makefiles |
---|
| 4 | # |
---|
| 5 | |
---|
[393d271] | 6 | # |
---|
| 7 | # LIBSUFFIX_VA, will "index" into LIBSUFF-*-v macros and |
---|
[888622c4] | 8 | # convert our ${ARCH} back into .a or _g.a or _p.a based on debug. |
---|
[393d271] | 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 | |
---|
[65a60cd] | 18 | # Pull in the desired "target" compiler |
---|
| 19 | # Programs built on the host use automake generated rules. |
---|
[bde6ac20] | 20 | # This will not change $(ARCH) -- binaries will still be placed as per target |
---|
[d6c83529] | 21 | include ${CONFIG.CC} |
---|
[bffb938] | 22 | ifeq (${DEPEND},$(wildcard ${DEPEND})) |
---|
| 23 | include ${DEPEND} # pull in dependencies if they exist |
---|
| 24 | endif |
---|
| 25 | |
---|
[df49c60] | 26 | ifndef AUTOMAKE |
---|
[bffb938] | 27 | # |
---|
| 28 | # Builtin targets for compilation variants |
---|
| 29 | # |
---|
[29e68b75] | 30 | debug: |
---|
[c2646c8] | 31 | $(MAKE) -f $(MAKEFILE) MAKEFILE=$(MAKEFILE) VARIANT=DEBUG |
---|
[df49c60] | 32 | endif |
---|
[bffb938] | 33 | |
---|
| 34 | # |
---|
[bde6ac20] | 35 | # VARIANT_VA will convert our ${ARCH} back to "" or "debug". |
---|
[bffb938] | 36 | # Handy when one makefile wants to hop over into a peer's tree and |
---|
| 37 | # build something "the same" way. |
---|
| 38 | # |
---|
| 39 | |
---|
[393d271] | 40 | VARIANT-OPTIMIZE-v = |
---|
| 41 | VARIANT-DEBUG-v = debug |
---|
[bffb938] | 42 | |
---|
[393d271] | 43 | VARIANT_VA = $(VARIANT-$(VARIANT_V)-v) |
---|
[bffb938] | 44 | |
---|
| 45 | # |
---|
[888622c4] | 46 | # TARGET_VA will convert $@ (expected to be 'debug' etc.) |
---|
[bffb938] | 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 | # |
---|
[29e68b75] | 56 | # Builtin clean and distclean rules |
---|
[bffb938] | 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 | |
---|
[29e68b75] | 61 | clean-am: clean-generic |
---|
| 62 | -$(RM) -r $(CLEAN_OS) $(CLEAN_CC) $(CLEAN_DEPEND) |
---|
| 63 | -$(RM) -r $(VARIANTS) |
---|
[bffb938] | 64 | |
---|
[29e68b75] | 65 | distclean-am: distclean-generic clean-am |
---|
| 66 | -$(RM) -r $(CLOBBER_OS) $(CLOBBER_CC) $(CLOBBER_DEPEND) |
---|
[6693a68] | 67 | |
---|
[df49c60] | 68 | ifndef AUTOMAKE |
---|
[6693a68] | 69 | preinstall-am: |
---|
| 70 | preinstall: preinstall-am |
---|
[29e68b75] | 71 | |
---|
| 72 | distclean: distclean-am |
---|
[7dd4054] | 73 | -$(RM) ./config.status |
---|
| 74 | |
---|
[29e68b75] | 75 | clean: clean-am |
---|
| 76 | |
---|
| 77 | .PHONY: distclean distclean-am |
---|
| 78 | .PHONY: clean clean-am |
---|
[df49c60] | 79 | endif |
---|
[66a9381d] | 80 | |
---|
[efdda565] | 81 | EXEEXT?=.exe |
---|
| 82 | DOWNEXT?=.ralf |
---|
[66a9381d] | 83 | |
---|
| 84 | define bsp-link-c |
---|
[20e1bdfc] | 85 | $(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ |
---|
[efdda565] | 86 | -o $(basename $@)$(EXEEXT) $(LINK_OBJS) $(LINK_LIBS) |
---|
[66a9381d] | 87 | endef |
---|
| 88 | |
---|
| 89 | define bsp-link-cxx |
---|
[20e1bdfc] | 90 | $(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \ |
---|
[efdda565] | 91 | -o $(basename $@)$(EXEEXT) $(LINK_OBJS) $(LINK_LIBS) |
---|
[66a9381d] | 92 | endef |
---|
| 93 | |
---|
| 94 | define default-bsp-post-link |
---|
| 95 | $(NM) -g -n $@ > $(basename $@).num |
---|
| 96 | $(SIZE) $@ |
---|
| 97 | endef |
---|
| 98 | |
---|
[cb697107] | 99 | ifndef bsp-post-link |
---|
[66a9381d] | 100 | define bsp-post-link |
---|
| 101 | $(default-bsp-post-link) |
---|
[efdda565] | 102 | cp $(basename $@)$(EXEEXT) $(basename $@)$(DOWNEXT) |
---|
[66a9381d] | 103 | endef |
---|
[cb697107] | 104 | endif |
---|
[66a9381d] | 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 |
---|