new (last?) attempt at standardizing Makefiles
[openwrt.git] / toolchain / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # Main makefile for the toolchain
8 #
9 include $(TOPDIR)/rules.mk
10 TARGETS-y:=sed kernel-headers sstrip
11 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
12 TARGETS-y+=binutils gcc uClibc
13 endif
14 TARGETS-y+=ipkg-utils libnotimpl ext2fs squashfs jffs2 lzma mkimage
15
16 TARGETS-$(CONFIG_GDB) += gdb
17
18 TARGETS_DOWNLOAD:=$(patsubst %,%-download,$(TARGETS-y))
19 TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS-y))
20 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS-y))
21
22 all: install
23 download: $(TARGETS_DOWNLOAD)
24 install: $(TARGETS_INSTALL)
25 clean: $(TARGETS_CLEAN)
26
27 kernel-headers-prepare: sed-install
28 uClibc-prepare: kernel-headers-prepare sstrip-install
29 ifeq ($(CONFIG_NATIVE_TOOLCHAIN),)
30 binutils-prepare: uClibc-prepare
31 gcc-prepare: binutils-install
32 uClibc-compile: gcc-compile
33 endif
34 gcc-install: uClibc-install
35 squashfs-compile: lzma-install
36
37 TOOLCHAIN_STAMP_DIR:=$(STAGING_DIR)/stampfiles
38
39 $(TOOLCHAIN_STAMP_DIR):
40 mkdir -p $@
41
42 $(STAGING_DIR):
43 @mkdir -p $@/lib
44 @mkdir -p $@/include
45 @mkdir -p $@/$(REAL_GNU_TARGET_NAME)
46 @ln -sf ../lib $@/$(REAL_GNU_TARGET_NAME)/lib
47
48 $(TOOL_BUILD_DIR):
49 @mkdir -p $@
50
51 %-download: FORCE
52 $(MAKE) -C $(patsubst %-download,%,$@) download
53
54 %-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR) FORCE
55 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
56 $(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
57 }
58 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
59
60 %-compile: %-prepare
61 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
62 $(MAKE) -C $(patsubst %-compile,%,$@) compile; \
63 }
64 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
65
66 %-install: %-compile
67 @[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
68 $(MAKE) -C $(patsubst %-install,%,$@) install; \
69 }
70 @touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
71
72 %-clean: FORCE
73 @$(MAKE) -C $(patsubst %-clean,%,$@) clean
74 @rm -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-*
75
This page took 0.039618 seconds and 5 git commands to generate.