2 # Copyright (C) 2006-2011 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 # Main makefile for the host tools
11 # subdirectories to descend into
14 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN
),)
16 ifdef CONFIG_GCC_USE_GRAPHITE
20 ifneq ($(CONFIG_SDK
)$(CONFIG_PACKAGE_kmod-b43
)$(CONFIG_BRCMSMAC_USE_FW_FROM_WL
),)
25 tools-y
+= autoconf-archive
36 tools-y
+= firmware-utils
44 tools-y
+= make-ext4fs
46 tools-y
+= missing-macros
53 tools-y
+= patch-image
57 tools-y
+= squashfskit4
62 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(BUILD_B43_TOOLS
),y
) += b43-tools
63 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(BUILD_ISL
),y
) += isl
64 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(BUILD_TOOLCHAIN
),y
) += gmp mpc mpfr
65 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_TARGET_apm821xx
)$(CONFIG_TARGET_gemini
),y
) += genext2fs
66 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_TARGET_ath79
),y
) += lzma-old squashfs
67 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_TARGET_mxs
),y
) += elftosb sdimage
68 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_TARGET_realtek
),y
) += 7z
69 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_TARGET_tegra
),y
) += cbootimage cbootimage-configs
70 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_USES_MINOR
),y
) += kernel2minor
71 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_USE_SPARSE
),y
) += sparse
72 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_USE_LLVM_BUILD
),y
) += llvm-bpf
74 # builddir dependencies
75 $(curdir
)/autoconf
/compile
:= $(curdir
)/m4
/compile
76 $(curdir
)/automake
/compile
:= $(curdir
)/autoconf
/compile
$(curdir
)/pkgconf
/compile
$(curdir
)/xz
/compile
77 $(curdir
)/b43-tools
/compile
:= $(curdir
)/bison
/compile
78 $(curdir
)/bc
/compile
:= $(curdir
)/bison
/compile
$(curdir
)/libtool
/compile
79 $(curdir
)/bison
/compile
:= $(curdir
)/flex
/compile
80 $(curdir
)/cbootimage
/compile
+= $(curdir
)/automake
/compile
81 $(curdir
)/cmake
/compile
+= $(curdir
)/libressl
/compile
$(curdir
)/ninja
/compile
$(curdir
)/expat
/compile
$(curdir
)/xz
/compile
$(curdir
)/zlib
/compile
$(curdir
)/zstd
/compile
82 $(curdir
)/dosfstools
/compile
:= $(curdir
)/automake
/compile
83 $(curdir
)/e2fsprogs
/compile
:= $(curdir
)/libtool
/compile
84 $(curdir
)/fakeroot
/compile
:= $(curdir
)/libtool
/compile
85 $(curdir
)/findutils
/compile
:= $(curdir
)/bison
/compile
86 $(curdir
)/firmware-utils
/compile
+= $(curdir
)/cmake
/compile
87 $(curdir
)/flex
/compile
:= $(curdir
)/libtool
/compile
88 $(curdir
)/genext2fs
/compile
:= $(curdir
)/libtool
/compile
89 $(curdir
)/gengetopt
/compile
:= $(curdir
)/libtool
/compile
90 $(curdir
)/gmp
/compile
:= $(curdir
)/libtool
/compile
91 $(curdir
)/isl
/compile
:= $(curdir
)/gmp
/compile
92 $(curdir
)/libdeflate
/compile
:= $(curdir
)/cmake
/compile
93 $(curdir
)/libressl
/compile
:= $(curdir
)/pkgconf
/compile
94 $(curdir
)/libtool
/compile
:= $(curdir
)/automake
/compile
$(curdir
)/missing-macros
/compile
95 $(curdir
)/lzma-old
/compile
:= $(curdir
)/zlib
/compile
96 $(curdir
)/llvm-bpf
/compile
:= $(curdir
)/cmake
/compile
97 $(curdir
)/make-ext4fs
/compile
:= $(curdir
)/zlib
/compile
98 $(curdir
)/meson
/compile
:= $(curdir
)/ninja
/compile
99 $(curdir
)/missing-macros
/compile
:= $(curdir
)/autoconf
/compile
100 $(curdir
)/mkimage
/compile
+= $(curdir
)/bison
/compile
$(curdir
)/libressl
/compile
101 $(curdir
)/mklibs
/compile
:= $(curdir
)/libtool
/compile
102 $(curdir
)/mpc
/compile
:= $(curdir
)/mpfr
/compile
$(curdir
)/gmp
/compile
103 $(curdir
)/mpfr
/compile
:= $(curdir
)/gmp
/compile
104 $(curdir
)/mtd-utils
/compile
:= $(curdir
)/libtool
/compile
$(curdir
)/e2fsprogs
/compile
$(curdir
)/zlib
/compile
105 $(curdir
)/padjffs2
/compile
:= $(curdir
)/findutils
/compile
106 $(curdir
)/patchelf
/compile
:= $(curdir
)/libtool
/compile
107 $(curdir
)/pkgconf
/compile
:= $(curdir
)/meson
/compile
108 $(curdir
)/quilt
/compile
:= $(curdir
)/autoconf
/compile
$(curdir
)/findutils
/compile
109 $(curdir
)/sdcc
/compile
:= $(curdir
)/bison
/compile
110 $(curdir
)/squashfs
/compile
:= $(curdir
)/lzma-old
/compile
111 $(curdir
)/squashfskit4
/compile
:= $(curdir
)/xz
/compile
$(curdir
)/zlib
/compile
112 $(curdir
)/zstd
/compile
:= $(curdir
)/meson
/compile
114 ifneq ($(HOST_OS
),Linux
)
115 $(curdir
)/squashfskit4
/compile
+= $(curdir
)/coreutils
/compile
118 ifeq ($(HOST_OS
),Darwin
)
121 $(curdir
)/dwarves
/compile
+= $(curdir
)/elfutils
/compile
122 $(curdir
)/elfutils
/compile
:= $(curdir
)/m4
/compile
$(curdir
)/zlib
/compile
123 tools-
$(if
$(CONFIG_BUILD_ALL_HOST_TOOLS
)$(CONFIG_DWARVES
),y
) += dwarves
127 ifneq ($(CONFIG_CCACHE
)$(CONFIG_SDK
),)
128 $(foreach tool
, $(filter-out zstd zlib xz pkgconf patch ninja meson libressl expat cmake
,$(tools-y
)), $(eval
$(curdir
)/$(tool
)/compile
+= $(curdir
)/ccache
/compile
))
130 $(curdir
)/ccache
/compile
:= $(curdir
)/cmake
/compile
133 # in case there is no patch tool on the host we need to make patch tool a
134 # dependency for tools which have patches directory
135 $(foreach tool
, $(tools-y
), $(if
$(wildcard $(curdir
)/$(tool
)/patches
),$(eval
$(curdir
)/$(tool
)/compile
+= $(curdir
)/patch
/compile
)))
137 $(foreach tool
, $(filter-out xz
,$(tools-y
)), $(eval
$(curdir
)/$(tool
)/compile
+= $(curdir
)/xz
/compile
))
139 # make any tool depend on tar, xz and patch to ensure that archives can be unpacked and patched properly
140 tools-core
:= tar xz patch
142 $(foreach tool
, $(tools-y
), $(eval
$(curdir
)/$(tool
)/compile
+= $(patsubst %,$(curdir
)/%/compile
,$(tools-core
))))
143 tools-y
+= $(tools-core
)
145 # make core tools depend on sed and flock
146 $(foreach tool
, $(filter-out xz
,$(tools-core
)), $(eval
$(curdir
)/$(tool
)/compile
+= $(curdir
)/sed
/compile
))
147 $(curdir
)/xz
/compile
+= $(curdir
)/flock
/compile
149 $(curdir
)/sed
/compile
:= $(curdir
)/flock
/compile
$(curdir
)/xz
/compile
152 $(curdir
)/autoremove
:= 1
153 $(curdir
)/builddirs
:= $(tools-y
) $(tools-dep
) $(tools-
)
154 $(curdir
)/builddirs-default
:= $(tools-y
)
157 $(curdir
)/builddirs-check
:=$($(curdir
)/builddirs
)
158 $(curdir
)/builddirs-download
:=$($(curdir
)/builddirs
)
161 ifndef DUMP_TARGET_DB
162 define PrepareStaging
163 @for
dir in
$(1); do
( \
164 $(if
$(QUIET
),,set
-x
;) \
167 mkdir
-p bin lib stamp usr
/include usr
/lib
; \
175 $(STAGING_DIR
)/.prepared
: $(TMP_DIR
)/.build
176 $(call PrepareStaging
,$(STAGING_DIR
))
177 mkdir
-p
$(BUILD_DIR
)/stamp
180 $(STAGING_DIR_HOST
)/.prepared
: $(TMP_DIR
)/.build
181 $(call PrepareStaging
,$(STAGING_DIR_HOST
))
182 mkdir
-p
$(BUILD_DIR_HOST
)/stamp
$(STAGING_DIR_HOST
)/include/sys
183 $(INSTALL_DATA
) $(TOPDIR
)/tools
/include/*.h
$(STAGING_DIR_HOST
)/include/
184 $(INSTALL_DATA
) $(TOPDIR
)/tools
/include/sys
/*.h
$(STAGING_DIR_HOST
)/include/sys
/
185 ifneq ($(HOST_OS
),Linux
)
186 mkdir
-p
$(STAGING_DIR_HOST
)/include/asm
187 $(INSTALL_DATA
) $(TOPDIR
)/tools
/include/asm
/*.h
$(STAGING_DIR_HOST
)/include/asm
/
189 ln
-snf lib
$(STAGING_DIR_HOST
)/lib64
194 $(curdir
)//prepare
= $(STAGING_DIR
)/.prepared
$(STAGING_DIR_HOST
)/.prepared
$(BIN_DIR
)
195 $(curdir
)//compile
= $(STAGING_DIR
)/.prepared
$(STAGING_DIR_HOST
)/.prepared
$(BIN_DIR
)
197 # prerequisites for the individual targets
198 $(curdir
)/ := .config prereq
200 $(curdir
)/install: $(curdir
)/compile
202 tools_enabled
= $(foreach tool
,$(sort $(tools-y
) $(tools-
)),$(if
$(filter $(tool
),$(tools-y
)),y
,n
))
203 $(eval
$(call stampfile
,$(curdir
),tools
,compile
,,_
$(subst $(space
),,$(tools_enabled
)),$(STAGING_DIR_HOST
)))
204 $(eval
$(call stampfile
,$(curdir
),tools
,check,$(TMP_DIR
)/.build
,,$(STAGING_DIR_HOST
)))
205 $(eval
$(call subdir
,$(curdir
)))