source: branches/backfire/tools/Makefile

Last change on this file was 27579, checked in by jow, 5 years ago

[backfire] backport r24631, needed for at least gstreamer on backfire

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1#
2# Copyright (C) 2006-2011 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 host tools
8#
9curdir:=tools
10
11# subdirectories to descend into
12tools-y :=
13ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
14tools-$(CONFIG_GCC_VERSION_4_3)$(CONFIG_GCC_VERSION_4_4) += gmp mpfr
15endif
16tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs
17tools-y += sstrip ipkg-utils genext2fs libuuid mtd-utils mkimage
18tools-y += firmware-utils patch-cmdline quilt yaffs2 xz cmake
19tools-y += mm-macros xorg-macros xfce-macros missing-macros
20tools-$(CONFIG_TARGET_orion) += wrt350nv2-builder upslug2
21tools-$(CONFIG_TARGET_x86) += qemu
22ifneq ($(CONFIG_LINUX_2_4)$(CONFIG_LINUX_2_6_25),)
23tools-y += squashfs lzma-old
24else
25ifneq ($(CONFIG_TARGET_ar71xx),)
26tools-y += squashfs lzma-old
27endif
28tools-y += squashfs4 lzma
29endif
30tools-$(CONFIG_CCACHE) += ccache
31
32ifdef CONFIG_GCC_USE_GRAPHITE
33  tools-y += ppl cloog
34  $(curdir)/cloog/compile := $(curdir)/ppl/install
35endif
36
37# builddir dependencies
38$(curdir)/bison/compile := $(curdir)/flex/install
39$(curdir)/pkg-config/compile := $(curdir)/sed/install
40$(curdir)/libtool/compile := $(curdir)/sed/install
41$(curdir)/squashfs/compile := $(curdir)/lzma-old/install
42$(curdir)/squashfs4/compile := $(curdir)/lzma/install
43$(curdir)/quilt/compile := $(curdir)/sed/install $(curdir)/autoconf/install
44$(curdir)/dtc/compile := $(curdir)/bison/install
45$(curdir)/autoconf/compile := $(curdir)/m4/install $(curdir)/libtool/install
46$(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install
47$(curdir)/mpfr/compile := $(curdir)/gmp/install
48$(curdir)/mtd-utils/compile := $(curdir)/libuuid/install
49$(curdir)/mkimage/compile := $(curdir)/sed/install
50$(curdir)/qemu/compile := $(curdir)/libuuid/install
51$(curdir)/upslug2/compile := $(curdir)/automake/install
52$(curdir)/mm-macros/compile := $(curdir)/automake/install
53$(curdir)/xorg-macros/compile := $(curdir)/automake/install
54$(curdir)/xfce-macros/compile := $(curdir)/automake/install
55$(curdir)/missing-macros/compile := $(curdir)/automake/install
56
57$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
58$(curdir)/builddirs-default := $(tools-y)
59
60define PrepareStaging
61        @for dir in $(1); do ( \
62                set -x; \
63                mkdir -p "$$dir"; \
64                cd "$$dir"; \
65                mkdir -p bin lib include stamp; \
66        ); done
67endef
68
69# preparatory work
70$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
71        $(call PrepareStaging,$(STAGING_DIR))
72        mkdir -p $(BUILD_DIR)/stamp
73        touch $@
74
75$(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
76        $(call PrepareStaging,$(STAGING_DIR_HOST))
77        mkdir -p $(BUILD_DIR_HOST)/stamp
78        $(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/
79        touch $@
80
81
82define PrepareCommand
83$(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR)/.prepared
84        @mkdir -p "$$(dir $$@)"; rm -f "$$@"
85        @export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \
86                echo "Command $(1) not found."; false; \
87        }; ln -s "$$$$FILE" "$$@"
88
89endef
90
91$(eval $(call PrepareCommand,find,gfind find))
92$(eval $(call PrepareCommand,md5sum,md5sum $(SCRIPT_DIR)/md5sum))
93$(eval $(call PrepareCommand,cp,gcp cp))
94$(eval $(call PrepareCommand,stat,gstat stat))
95
96$(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,find md5sum cp stat)
97$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
98$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
99
100# prerequisites for the individual targets
101$(curdir)/ := .config prereq
102$(curdir)//install = $(1)/compile
103
104$(eval $(call stampfile,$(curdir),tools,install,,CONFIG_CCACHE CONFIG_powerpc CONFIG_GCC_VERSION_4_3 CONFIG_GCC_USE_GRAPHITE CONFIG_TARGET_orion))
105$(eval $(call subdir,$(curdir)))
Note: See TracBrowser for help on using the repository browser.