OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | # |
2 | # Copyright (C) 2006-2008 OpenWrt.org |
||
3 | # |
||
4 | # This is free software, licensed under the GNU General Public License v2. |
||
5 | # See /LICENSE for more information. |
||
6 | # |
||
7 | |||
8 | __package_mk:=1 |
||
9 | |||
10 | all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile)) |
||
11 | |||
12 | include $(INCLUDE_DIR)/download.mk |
||
13 | |||
14 | PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) |
||
15 | PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install |
||
16 | PKG_BUILD_PARALLEL ?= |
||
17 | PKG_USE_MIPS16 ?= 1 |
||
18 | PKG_IREMAP ?= 1 |
||
19 | |||
20 | MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) $(if $(filter 3.% 4.0 4.1,$(MAKE_VERSION)),-j)) |
||
21 | |||
22 | ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) |
||
23 | PKG_JOBS?=-j1 |
||
24 | else |
||
25 | PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL),$(MAKE_J),-j1) |
||
26 | endif |
||
27 | ifdef CONFIG_USE_MIPS16 |
||
28 | ifeq ($(strip $(PKG_USE_MIPS16)),1) |
||
29 | TARGET_ASFLAGS_DEFAULT = $(filter-out -mips16 -minterlink-mips16,$(TARGET_CFLAGS)) |
||
30 | TARGET_CFLAGS += -mips16 -minterlink-mips16 |
||
31 | endif |
||
32 | endif |
||
33 | ifeq ($(strip $(PKG_IREMAP)),1) |
||
34 | IREMAP_CFLAGS = $(call iremap,$(PKG_BUILD_DIR),$(notdir $(PKG_BUILD_DIR))) |
||
35 | TARGET_CFLAGS += $(IREMAP_CFLAGS) |
||
36 | endif |
||
37 | |||
38 | include $(INCLUDE_DIR)/hardening.mk |
||
39 | include $(INCLUDE_DIR)/prereq.mk |
||
40 | include $(INCLUDE_DIR)/unpack.mk |
||
41 | include $(INCLUDE_DIR)/depends.mk |
||
42 | |||
43 | ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),) |
||
44 | USE_GIT_TREE:=1 |
||
45 | QUILT:=1 |
||
46 | endif |
||
47 | ifdef USE_SOURCE_DIR |
||
48 | QUILT:=1 |
||
49 | endif |
||
50 | ifneq ($(wildcard $(PKG_BUILD_DIR)/.source_dir),) |
||
51 | QUILT:=1 |
||
52 | endif |
||
53 | |||
54 | include $(INCLUDE_DIR)/quilt.mk |
||
55 | |||
56 | find_library_dependencies = $(wildcard $(patsubst %,$(STAGING_DIR)/pkginfo/%.version, \ |
||
57 | $(filter-out $(BUILD_PACKAGES),$(foreach dep, \ |
||
58 | $(filter-out @%, $(patsubst +%,%,$(1))), \ |
||
59 | $(if $(findstring :,$(dep)), \ |
||
60 | $(word 2,$(subst :,$(space),$(dep))), \ |
||
61 | $(dep) \ |
||
62 | ) \ |
||
63 | )))) |
||
64 | |||
65 | PKG_DIR_NAME:=$(lastword $(subst /,$(space),$(CURDIR))) |
||
66 | STAMP_NO_AUTOREBUILD=$(wildcard $(PKG_BUILD_DIR)/.no_autorebuild) |
||
67 | PREV_STAMP_PREPARED:=$(if $(STAMP_NO_AUTOREBUILD),$(wildcard $(PKG_BUILD_DIR)/.prepared*)) |
||
68 | ifneq ($(PREV_STAMP_PREPARED),) |
||
69 | STAMP_PREPARED:=$(PREV_STAMP_PREPARED) |
||
70 | CONFIG_AUTOREBUILD:= |
||
71 | else |
||
72 | STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))_$(call confvar,CONFIG_AUTOREMOVE $(PKG_PREPARED_DEPENDS))) |
||
73 | endif |
||
74 | STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS))) |
||
75 | STAMP_CONFIGURED_WILDCARD=$(PKG_BUILD_DIR)/.configured_* |
||
76 | STAMP_BUILT:=$(PKG_BUILD_DIR)/.built |
||
77 | STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),)_installed |
||
78 | |||
79 | STAGING_FILES_LIST:=$(PKG_DIR_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list |
||
80 | |||
81 | define CleanStaging |
||
82 | rm -f $(STAMP_INSTALLED) |
||
83 | @-(\ |
||
3 | office | 84 | cd "$(STAGING_DIR)"; \ |
85 | if [ -f packages/$(STAGING_FILES_LIST) ]; then \ |
||
86 | cat packages/$(STAGING_FILES_LIST) | xargs -r rm -f 2>/dev/null; \ |
||
1 | office | 87 | fi; \ |
88 | ) |
||
89 | endef |
||
90 | |||
91 | |||
92 | PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install |
||
93 | |||
94 | include $(INCLUDE_DIR)/package-defaults.mk |
||
95 | include $(INCLUDE_DIR)/package-dumpinfo.mk |
||
96 | include $(INCLUDE_DIR)/package-ipkg.mk |
||
97 | include $(INCLUDE_DIR)/package-bin.mk |
||
98 | include $(INCLUDE_DIR)/autotools.mk |
||
99 | |||
100 | _pkg_target:=$(if $(QUILT),,.) |
||
101 | |||
102 | override MAKEFLAGS= |
||
103 | CONFIG_SITE:=$(INCLUDE_DIR)/site/$(ARCH) |
||
104 | CUR_MAKEFILE:=$(filter-out Makefile,$(firstword $(MAKEFILE_LIST))) |
||
105 | SUBMAKE:=$(NO_TRACE_MAKE) $(if $(CUR_MAKEFILE),-f $(CUR_MAKEFILE)) |
||
106 | PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig:$(STAGING_DIR)/usr/share/pkgconfig |
||
107 | unexport QUIET CONFIG_SITE |
||
108 | |||
109 | ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),) |
||
110 | ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),) |
||
111 | define Build/Autoclean |
||
112 | $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED) |
||
113 | $(call rdep,${CURDIR} $(PKG_FILE_DEPENDS),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "*/.dep_*") |
||
114 | $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "*/.dep_*" -x "*/ipkg*")) |
||
115 | endef |
||
116 | endif |
||
117 | endif |
||
118 | |||
119 | ifdef USE_GIT_TREE |
||
120 | define Build/Prepare/Default |
||
121 | mkdir -p $(PKG_BUILD_DIR) |
||
122 | ln -s $(CURDIR)/git-src $(PKG_BUILD_DIR)/.git |
||
123 | ( cd $(PKG_BUILD_DIR); \ |
||
124 | git checkout .; \ |
||
125 | git submodule update --recursive; \ |
||
126 | git submodule foreach git config --unset core.worktree; \ |
||
127 | git submodule foreach git checkout .; \ |
||
128 | ) |
||
129 | endef |
||
130 | endif |
||
131 | ifdef USE_SOURCE_DIR |
||
132 | define Build/Prepare/Default |
||
133 | rm -rf $(PKG_BUILD_DIR) |
||
134 | $(if $(wildcard $(USE_SOURCE_DIR)/*),,@echo "Error: USE_SOURCE_DIR=$(USE_SOURCE_DIR) path not found"; false) |
||
135 | ln -snf $(USE_SOURCE_DIR) $(PKG_BUILD_DIR) |
||
136 | touch $(PKG_BUILD_DIR)/.source_dir |
||
137 | endef |
||
138 | endif |
||
139 | |||
140 | define Build/Exports/Default |
||
141 | $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR_HOSTPKG)/share/aclocal $$(STAGING_DIR_HOSTPKG)/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p)) |
||
142 | $(1) : export STAGING_PREFIX=$$(STAGING_DIR)/usr |
||
143 | $(1) : export PATH=$$(TARGET_PATH_PKG) |
||
144 | $(1) : export CONFIG_SITE:=$$(CONFIG_SITE) |
||
145 | $(1) : export PKG_CONFIG_PATH:=$$(PKG_CONFIG_PATH) |
||
146 | $(1) : export PKG_CONFIG_LIBDIR:=$$(PKG_CONFIG_PATH) |
||
3 | office | 147 | $(1) : export CCACHE_DIR:=$(STAGING_DIR)/ccache |
1 | office | 148 | endef |
149 | Build/Exports=$(Build/Exports/Default) |
||
150 | |||
151 | define Build/CoreTargets |
||
152 | STAMP_PREPARED:=$$(STAMP_PREPARED) |
||
153 | STAMP_CONFIGURED:=$$(STAMP_CONFIGURED) |
||
154 | |||
155 | $(if $(QUILT),$(Build/Quilt)) |
||
156 | $(call Build/Autoclean) |
||
157 | $(call DefaultTargets) |
||
158 | |||
159 | download: |
||
160 | $(foreach hook,$(Hooks/Download), |
||
161 | $(call $(hook))$(sep) |
||
162 | ) |
||
163 | |||
164 | $(STAMP_PREPARED) : export PATH=$$(TARGET_PATH_PKG) |
||
165 | $(STAMP_PREPARED): $(STAMP_PREPARED_DEPENDS) |
||
166 | @-rm -rf $(PKG_BUILD_DIR) |
||
167 | @mkdir -p $(PKG_BUILD_DIR) |
||
168 | touch $$@_check |
||
169 | $(foreach hook,$(Hooks/Prepare/Pre),$(call $(hook))$(sep)) |
||
170 | $(Build/Prepare) |
||
171 | $(foreach hook,$(Hooks/Prepare/Post),$(call $(hook))$(sep)) |
||
172 | touch $$@ |
||
173 | |||
174 | $(call Build/Exports,$(STAMP_CONFIGURED)) |
||
175 | $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(STAMP_CONFIGURED_DEPENDS) |
||
176 | rm -f $(STAMP_CONFIGURED_WILDCARD) |
||
177 | $(CleanStaging) |
||
178 | $(foreach hook,$(Hooks/Configure/Pre),$(call $(hook))$(sep)) |
||
179 | $(Build/Configure) |
||
180 | $(foreach hook,$(Hooks/Configure/Post),$(call $(hook))$(sep)) |
||
181 | touch $$@ |
||
182 | |||
183 | $(call Build/Exports,$(STAMP_BUILT)) |
||
184 | $(STAMP_BUILT): $(STAMP_CONFIGURED) $(STAMP_BUILT_DEPENDS) |
||
185 | rm -f $$@ |
||
186 | touch $$@_check |
||
187 | $(foreach hook,$(Hooks/Compile/Pre),$(call $(hook))$(sep)) |
||
188 | $(Build/Compile) |
||
189 | $(foreach hook,$(Hooks/Compile/Post),$(call $(hook))$(sep)) |
||
190 | $(Build/Install) |
||
191 | $(foreach hook,$(Hooks/Install/Post),$(call $(hook))$(sep)) |
||
192 | touch $$@ |
||
193 | |||
194 | $(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG) |
||
195 | $(STAMP_INSTALLED): $(STAMP_BUILT) |
||
196 | rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME) |
||
197 | mkdir -p $(TMP_DIR)/stage-$(PKG_DIR_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages |
||
198 | $(foreach hook,$(Hooks/InstallDev/Pre),\ |
||
199 | $(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\ |
||
200 | ) |
||
201 | $(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host) |
||
202 | $(foreach hook,$(Hooks/InstallDev/Post),\ |
||
203 | $(call $(hook),$(TMP_DIR)/stage-$(PKG_DIR_NAME),$(TMP_DIR)/stage-$(PKG_DIR_NAME)/host)$(sep)\ |
||
204 | ) |
||
205 | if [ -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) ]; then \ |
||
206 | $(SCRIPT_DIR)/clean-package.sh \ |
||
207 | "$(STAGING_DIR)/packages/$(STAGING_FILES_LIST)" \ |
||
208 | "$(STAGING_DIR)"; \ |
||
209 | fi |
||
210 | if [ -d $(TMP_DIR)/stage-$(PKG_DIR_NAME) ]; then \ |
||
211 | (cd $(TMP_DIR)/stage-$(PKG_DIR_NAME); find ./ > $(TMP_DIR)/stage-$(PKG_DIR_NAME).files); \ |
||
212 | $(call locked, \ |
||
213 | mv $(TMP_DIR)/stage-$(PKG_DIR_NAME).files $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) && \ |
||
214 | $(CP) $(TMP_DIR)/stage-$(PKG_DIR_NAME)/* $(STAGING_DIR)/; \ |
||
215 | ,staging-dir); \ |
||
216 | fi |
||
217 | rm -rf $(TMP_DIR)/stage-$(PKG_DIR_NAME) |
||
218 | touch $$@ |
||
219 | |||
220 | ifdef Build/InstallDev |
||
221 | $(_pkg_target)compile: $(STAMP_INSTALLED) |
||
222 | endif |
||
223 | |||
224 | $(_pkg_target)prepare: $(STAMP_PREPARED) |
||
225 | $(_pkg_target)configure: $(STAMP_CONFIGURED) |
||
226 | $(_pkg_target)dist: $(STAMP_CONFIGURED) |
||
227 | $(_pkg_target)distcheck: $(STAMP_CONFIGURED) |
||
228 | |||
229 | ifneq ($(CONFIG_AUTOREMOVE),) |
||
230 | compile: |
||
231 | -touch -r $(PKG_BUILD_DIR)/.built $(PKG_BUILD_DIR)/.autoremove 2>/dev/null >/dev/null |
||
232 | $(FIND) $(PKG_BUILD_DIR) -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | \ |
||
233 | $(XARGS) rm -rf |
||
234 | endif |
||
235 | endef |
||
236 | |||
237 | define Build/DefaultTargets |
||
238 | $(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) |
||
239 | $(if $(DUMP),,$(Build/CoreTargets)) |
||
240 | |||
241 | define Build/DefaultTargets |
||
242 | endef |
||
243 | endef |
||
244 | |||
245 | define BuildPackage |
||
246 | $(eval $(Package/Default)) |
||
247 | $(eval $(Package/$(1))) |
||
248 | |||
249 | ifdef DESCRIPTION |
||
250 | $$(error DESCRIPTION:= is obsolete, use Package/PKG_NAME/description) |
||
251 | endif |
||
252 | |||
253 | ifndef Package/$(1)/description |
||
254 | define Package/$(1)/description |
||
255 | $(TITLE) |
||
256 | endef |
||
257 | endif |
||
258 | |||
259 | BUILD_PACKAGES += $(1) |
||
260 | $(STAMP_PREPARED): $$(if $(QUILT)$(DUMP),,$(call find_library_dependencies,$(DEPENDS))) |
||
261 | |||
262 | $(foreach FIELD, TITLE CATEGORY SECTION VERSION, |
||
263 | ifeq ($($(FIELD)),) |
||
264 | $$(error Package/$(1) is missing the $(FIELD) field) |
||
265 | endif |
||
266 | ) |
||
267 | |||
268 | $(if $(DUMP), \ |
||
269 | $(if $(CHECK),,$(Dumpinfo/Package)), \ |
||
270 | $(foreach target, \ |
||
271 | $(if $(Package/$(1)/targets),$(Package/$(1)/targets), \ |
||
272 | $(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg) \ |
||
273 | ), $(BuildTarget/$(target)) \ |
||
274 | ) \ |
||
275 | ) |
||
276 | $(if $(PKG_HOST_ONLY),,$(call Build/DefaultTargets,$(1))) |
||
277 | endef |
||
278 | |||
279 | define pkg_install_files |
||
280 | $(foreach install_file,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_file)`; $(INSTALL_DATA) $(2)/$(install_file) $(3)/`dirname $(install_file)`;) |
||
281 | endef |
||
282 | |||
283 | define pkg_install_bin |
||
284 | $(foreach install_apps,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_apps)`; $(INSTALL_BIN) $(2)/$(install_apps) $(3)/`dirname $(install_apps)`;) |
||
285 | endef |
||
286 | |||
287 | Build/Prepare=$(call Build/Prepare/Default,) |
||
288 | Build/Configure=$(call Build/Configure/Default,) |
||
289 | Build/Compile=$(call Build/Compile/Default,) |
||
290 | Build/Install=$(if $(PKG_INSTALL),$(call Build/Install/Default,)) |
||
291 | Build/Dist=$(call Build/Dist/Default,) |
||
292 | Build/DistCheck=$(call Build/DistCheck/Default,) |
||
293 | |||
294 | .NOTPARALLEL: |
||
295 | |||
296 | .PHONY: prepare-package-install |
||
297 | prepare-package-install: |
||
298 | @mkdir -p $(PKG_INFO_DIR) |
||
299 | @rm -f $(PKG_INSTALL_STAMP) |
||
300 | @echo "$(filter-out essential nonshared,$(PKG_FLAGS))" > $(PKG_INSTALL_STAMP).flags |
||
301 | |||
302 | $(PACKAGE_DIR): |
||
303 | mkdir -p $@ |
||
304 | |||
305 | compile: |
||
306 | .install: .compile |
||
307 | install: compile |
||
308 | |||
309 | force-clean-build: FORCE |
||
310 | rm -rf $(PKG_BUILD_DIR) |
||
311 | |||
312 | clean-build: $(if $(wildcard $(PKG_BUILD_DIR)/.autoremove),force-clean-build) |
||
313 | |||
314 | clean: force-clean-build |
||
315 | $(CleanStaging) |
||
316 | $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST)) |
||
317 | $(Build/Clean) |
||
318 | rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST) |
||
319 | |||
320 | dist: |
||
321 | $(Build/Dist) |
||
322 | |||
323 | distcheck: |
||
324 | $(Build/DistCheck) |