steps.mk
author Yann Diorcet <diorcet.yann@gmail.com>
Fri Nov 16 15:25:57 2012 +0100 (2012-11-16)
changeset 3119 1c56c03b7ed5
parent 3115 1c68438f44f7
child 3123 6a5946fbc728
permissions -rw-r--r--
scripts: add BUILD/HOST extra cflags/ldflags

On some hosts, and for certain toolchains (eg. toolchain targetting
the upcoming Darwin), it may be necessary to pass arbitrary CFLAGS
and/or LDFLAGS when building the components.

And necessary infrastructure:
- EXTRA_{CFLAGS,LDFLAGS}_FOR_{BUILD,HOST} as config options
- pass those extra flags to components

Fix-up a slight typo in elf2flt at the same time (misnamed cflags).

Signed-off-by: Yann Diorcet <diorcet.yann@gmail.com>
Message-Id: <d24043276c9243a35421.1353077450@macbook-smorlat.local>
Patchwork-Id: 199645
yann@136
     1
# Makefile for each steps
yann@2908
     2
# Copyright 2006 Yann E. MORIN <yann.morin.1998@free.fr>
yann@136
     3
yann@1001
     4
# ----------------------------------------------------------
yann@1001
     5
# This is the steps help entry
yann@1001
     6
yann@1001
     7
help-build::
yann@1001
     8
	@echo  '  list-steps         - List all build steps'
yann@1001
     9
yann@1015
    10
help-env::
yann@1876
    11
	@echo  '  STOP=step          - Stop the build just after this step (list with list-steps)'
yann@1876
    12
	@echo  '  RESTART=step       - Restart the build just before this step (list with list-steps)'
yann@1015
    13
yann@1001
    14
# ----------------------------------------------------------
yann@1001
    15
# The steps list
yann@1001
    16
yann@2936
    17
# The _for_build steps are noop for native and cross,
yann@2936
    18
# but are actual steps for canadian and cross-native.
yann@1149
    19
# Please keep the last line with a '\' and keep the following empy line:
yann@1001
    20
# it helps when diffing and merging.
Yann@3115
    21
CT_STEPS := libc_check_config        \
Yann@3115
    22
            companion_libs_for_build \
Yann@3115
    23
            binutils_for_build       \
Yann@3115
    24
            elf2flt_for_build        \
Yann@3115
    25
            companion_libs_for_host  \
Yann@3115
    26
            binutils_for_host        \
Yann@3115
    27
            elf2flt_for_host         \
Yann@3115
    28
            cc_core_pass_1           \
Yann@3115
    29
            kernel_headers           \
Yann@3115
    30
            libc_start_files         \
Yann@3115
    31
            cc_core_pass_2           \
Yann@3115
    32
            libc                     \
Yann@3115
    33
            cc_for_build             \
Yann@3115
    34
            cc_for_host              \
Yann@3115
    35
            libc_finish              \
Yann@3115
    36
            libelf_for_target        \
Yann@3115
    37
            binutils_for_target      \
Yann@3115
    38
            debug                    \
Yann@3115
    39
            test_suite               \
Yann@3115
    40
            finish                   \
yann@461
    41
yann@2936
    42
# Keep an empty line above this comment, so the last
yann@2936
    43
# back-slash terminated line works as expected.
yann@2936
    44
yann@1143
    45
# Make the list available to sub-processes (scripts/crosstool-NG.sh needs it)
yann@461
    46
export CT_STEPS
yann@181
    47
yann@1001
    48
# Print the steps list
yann@1001
    49
PHONY += list-steps
yann@1001
    50
list-steps:
yann@1001
    51
	@echo  'Available build steps, in order:'
yann@1001
    52
	@for step in $(CT_STEPS); do    \
yann@1001
    53
	     echo "  - $${step}";       \
yann@1001
    54
	 done
yann@1001
    55
	@echo  'Use "<step>" as action to execute only that step.'
yann@1001
    56
	@echo  'Use "+<step>" as action to execute up to that step.'
yann@1001
    57
	@echo  'Use "<step>+" as action to execute from that step onward.'
yann@1001
    58
yann@1001
    59
# ----------------------------------------------------------
yann@1001
    60
# This part deals with executing steps
yann@1001
    61
yann@181
    62
$(CT_STEPS):
yann@1010
    63
	$(SILENT)$(MAKE) -rf $(CT_NG) V=$(V) RESTART=$@ STOP=$@ build
yann@136
    64
yann@304
    65
$(patsubst %,+%,$(CT_STEPS)):
yann@1010
    66
	$(SILENT)$(MAKE) -rf $(CT_NG) V=$(V) STOP=$(patsubst +%,%,$@) build
yann@136
    67
yann@304
    68
$(patsubst %,%+,$(CT_STEPS)):
yann@1010
    69
	$(SILENT)$(MAKE) -rf $(CT_NG) V=$(V) RESTART=$(patsubst %+,%,$@) build