package/e2fsprogs: update to 1.42.12, add subpackages for static tune2fs and e2fsck
[openadk.git] / toolchain / Makefile
blobe06e58de961e6d9b50d80cc57cb95a326a8434f0
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 # Steps to build toolchains
5 # 1) build and install binutils
6 # 2) build and install mpfr, mpc, libelf and gmp
7 # 3) build and install minimal gcc c compiler
8 # 4) install kernel-headers
9 # 5) install libc headers
10 # 6) build and install initial static gcc
11 # 7) build and install full libc
12 # 8) build and install full shared gcc
13 # 9) rebuild and install full libc (in case of musl/uclibc)
14 # 10) build and install gdb debugger
16 include $(ADK_TOPDIR)/rules.mk
18 TARGETS:=binutils gmp mpfr mpc libelf gcc
20 ifeq ($(ADK_TARGET_LIB_GLIBC),y)
21 TARGETS+=glibc
22 CLIB:=glibc
23 endif
24 ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
25 TARGETS+=uclibc
26 CLIB:=uclibc
27 endif
28 ifeq ($(ADK_TARGET_LIB_UCLIBC_NG),y)
29 TARGETS+=uclibc-ng
30 CLIB:=uclibc-ng
31 endif
32 ifeq ($(ADK_TARGET_LIB_MUSL),y)
33 TARGETS+=musl
34 CLIB:=musl
35 endif
37 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
38 TARGETS+=elf2flt
39 ELF2FLT:=elf2flt-install
40 endif
42 # disable gdb for arc and avr32
43 ifeq ($(ADK_TARGET_ARCH_ARC),)
44 TARGETS+=gdb
45 GDB:=gdb-install
46 endif
47 ifeq (${ADK_PRELINK},y)
48 TARGETS+=prelink-cross
49 endif
51 DOWNLOAD:=kernel-headers-download $(patsubst %,%-download,$(TARGETS))
52 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS))
53 FIXUP:=$(patsubst %,%-fixup,$(CLIB))
54 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
56 install: $(TARGETS_INSTALL)
57 clean: $(TARGETS_CLEAN)
58 download: $(DOWNLOAD)
59 fixup: $(FIXUP)
61 gcc-prepare: binutils-install gmp-install mpfr-install mpc-install libelf-install
62 $(CLIB)-prepare: gcc-prepare kernel-headers-prepare
63 gcc-configure: $(CLIB)-prepare
64 $(CLIB)-compile: gcc-configure
65 gcc-compile: $(CLIB)-install
66 $(CLIB)-fixup: gcc-install $(GDB) $(ELF2FLT)
68 %-download:
69 $(TRACE) toolchain/$(patsubst %-download,%,$@)/download
70 $(MAKE) -C $(patsubst %-download,%,$@) fetch
72 %-prepare:
73 $(TRACE) toolchain/$(patsubst %-prepare,%,$@)/prepare
74 @if test x"$(patsubst %-prepare,%,$@)" = x"$(CLIB)"; then \
75 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare \
76 $(MAKE_TRACE); \
77 else \
78 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare \
79 CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' $(MAKE_TRACE); \
82 %-configure: %-prepare
83 $(TRACE) toolchain/$(patsubst %-configure,%,$@)/configure
84 @if test x"$(patsubst %-configure,%,$@)" = x"$(CLIB)"; then \
85 $(MAKE) -C $(patsubst %-configure,%,$@) configure \
86 $(MAKE_TRACE); \
87 else \
88 $(MAKE) -C $(patsubst %-configure,%,$@) configure \
89 CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' $(MAKE_TRACE); \
92 %-compile: %-configure
93 $(TRACE) toolchain/$(patsubst %-compile,%,$@)/compile
94 @if test x"$(patsubst %-compile,%,$@)" = x"$(CLIB)"; then \
95 $(MAKE) -C $(patsubst %-compile,%,$@) compile \
96 $(MAKE_TRACE); \
97 else \
98 $(MAKE) -C $(patsubst %-compile,%,$@) compile \
99 CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' CXXFLAGS='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE); \
102 %-install: %-compile
103 $(TRACE) toolchain/$(patsubst %-install,%,$@)/install
104 @if test x"$(patsubst %-install,%,$@)" = x"$(CLIB)"; then \
105 $(MAKE) -C $(patsubst %-install,%,$@) install \
106 $(MAKE_TRACE); \
107 else \
108 $(MAKE) -C $(patsubst %-install,%,$@) install \
109 CC='$(HOST_CC)' CFLAGS='$(HOST_CFLAGS)' CXXFLAGS='$(HOST_STATIC_CXXFLAGS)' $(MAKE_TRACE); \
112 %-fixup: %-install
113 $(TRACE) toolchain/$(patsubst %-fixup,%,$@)/fixup
114 @$(MAKE) -C $(patsubst %-fixup,%,$@) fixup $(MAKE_TRACE)
116 %-clean:
117 $(TRACE) toolchain/$(patsubst %-clean,%,$@)/clean
118 @$(MAKE) -C $(patsubst %-clean,%,$@) clean $(MAKE_TRACE)