dependency fix
[openwrt.git] / include / package.mk
1 #
2 # Copyright (C) 2006-2007 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 all: $(if $(DUMP),dumpinfo,compile)
9
10 PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
11 PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
12
13 include $(INCLUDE_DIR)/prereq.mk
14 include $(INCLUDE_DIR)/host.mk
15 include $(INCLUDE_DIR)/unpack.mk
16 include $(INCLUDE_DIR)/depends.mk
17
18 STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared$(if $(DUMP),,_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s))
19 STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
20 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
21
22 include $(INCLUDE_DIR)/quilt.mk
23 include $(INCLUDE_DIR)/package-defaults.mk
24 include $(INCLUDE_DIR)/package-dumpinfo.mk
25 include $(INCLUDE_DIR)/package-ipkg.mk
26
27 override MAKEFLAGS=
28 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
29
30 ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
31 ifneq ($(CONFIG_AUTOREBUILD),)
32 define Build/Autoclean
33 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
34 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
35 $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
36 endef
37 endif
38 endif
39
40 define Build/DefaultTargets
41 ifneq ($(strip $(PKG_SOURCE_URL)),)
42 download: $(DL_DIR)/$(PKG_SOURCE)
43
44 $(DL_DIR)/$(PKG_SOURCE):
45 mkdir -p $(DL_DIR)
46 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
47
48 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
49 endif
50
51 $(call Build/Autoclean)
52
53 $(STAMP_PREPARED):
54 @-rm -rf $(PKG_BUILD_DIR)
55 @mkdir -p $(PKG_BUILD_DIR)
56 $(Build/Prepare)
57 touch $$@
58
59 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
60 $(Build/Configure)
61 touch $$@
62
63 $(STAMP_BUILT): $(STAMP_CONFIGURED)
64 $(Build/Compile)
65 @$(NO_TRACE_MAKE) $(PKG_BUILD_DIR)/.dep_files
66 touch $$@
67
68 ifdef Build/InstallDev
69 compile: $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
70 $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(STAMP_BUILT)
71 mkdir -p $(STAGING_DIR)/stampfiles
72 $(Build/InstallDev)
73 touch $$@
74 endif
75
76 define Build/DefaultTargets
77 endef
78 endef
79
80 define BuildPackage
81 $(eval $(Package/Default))
82 $(eval $(Package/$(1)))
83
84 # <HACK> Support obsolete DESCRIPTION field
85 ifndef Package/$(1)/description
86 define Package/$(1)/description
87 $(TITLE)$(subst \,
88 ,\ $(DESCRIPTION))
89 endef
90 endif
91 # </HACK>
92
93 $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
94 ifeq ($($(FIELD)),)
95 $$(error Package/$(1) is missing the $(FIELD) field)
96 endif
97 )
98
99 $(call shexport,Package/$(1)/description)
100 $(call shexport,Package/$(1)/config)
101
102 $(Dumpinfo)
103 $(BuildIPKG)
104 endef
105
106 define Build/Prepare
107 $(call Build/Prepare/Default,)
108 endef
109
110 define Build/Configure
111 $(call Build/Configure/Default,)
112 endef
113
114 define Build/Compile
115 $(call Build/Compile/Default,)
116 endef
117
118 $(PACKAGE_DIR):
119 mkdir -p $@
120
121 dumpinfo:
122 download:
123 prepare: $(STAMP_PREPARED)
124 configure: $(STAMP_CONFIGURED)
125 compile:
126 install:
127 clean: FORCE
128 $(Build/UninstallDev)
129 $(Build/Clean)
130 @rm -f $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
131 @rm -rf $(PKG_BUILD_DIR)
This page took 0.046095 seconds and 5 git commands to generate.