fac04682852f0ec97a46a29b889952eadae496ad
[openwrt.git] / toolchain / Makefile
1 # Main makefile for the toolchain
2 include $(TOPDIR)/rules.mk
3 TARGETS-y:=sed kernel-headers utils binutils gcc uClibc ipkg-utils libnotimpl
4 TARGETS-$(CONFIG_GDB) += gdb
5
6 TARGETS_DOWNLOAD:=$(patsubst %,%-source,$(TARGETS-y))
7 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y))
8 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y))
9
10 all: install
11 download: $(TARGETS_DOWNLOAD)
12 install: $(TARGETS_INSTALL)
13 clean: $(TARGETS_CLEAN)
14
15 uClibc-prepare: kernel-headers-prepare sed-install utils-install
16 binutils-prepare: uClibc-prepare
17 gcc-prepare: binutils-install
18 uClibc-compile: gcc-prepare
19 gcc-compile: uClibc-install
20
21 TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
22
23 $(TOOLCHAIN_STAMP_DIR):
24 mkdir -p $@
25
26 $(STAGING_DIR):
27 @mkdir -p $@/lib
28 @mkdir -p $@/include
29 @mkdir -p $@/$(REAL_GNU_TARGET_NAME)
30 @ln -sf ../lib $@/$(REAL_GNU_TARGET_NAME)/lib
31
32 $(TOOL_BUILD_DIR):
33 @mkdir -p $@
34
35 %-source: FORCE
36 $(MAKE) -C $(patsubst %-source,%,$@) source
37
38 %-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR) FORCE
39 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
40 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
41 }
42 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
43
44 %-compile: %-prepare
45 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
46 $(MAKE) -C $(patsubst %-compile,%,$@) compile; \
47 }
48 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
49
50 %-install: %-compile
51 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
52 $(MAKE) -C $(patsubst %-install,%,$@) install; \
53 }
54 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
55
56 %-clean: FORCE
57 @$(MAKE) -C $(patsubst %-clean,%,$@) clean
58 @rm -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-*
59
This page took 0.037294 seconds and 3 git commands to generate.