Replace deprecated DEBUG config symbol
[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)$(if $(PKG_VERSION),-$(PKG_VERSION))
11 PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
12 PKG_MD5SUM ?= unknown
13
14 include $(INCLUDE_DIR)/prereq.mk
15 include $(INCLUDE_DIR)/host.mk
16 include $(INCLUDE_DIR)/unpack.mk
17 include $(INCLUDE_DIR)/depends.mk
18
19 STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),)))
20 STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
21 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
22 STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)_installed
23
24 include $(INCLUDE_DIR)/download.mk
25 include $(INCLUDE_DIR)/quilt.mk
26 include $(INCLUDE_DIR)/package-defaults.mk
27 include $(INCLUDE_DIR)/package-dumpinfo.mk
28 include $(INCLUDE_DIR)/package-ipkg.mk
29 include $(INCLUDE_DIR)/package-bin.mk
30
31 override MAKEFLAGS=
32 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
33
34 ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
35 ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
36 define Build/Autoclean
37 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
38 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "*/.dep_*")
39 $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "*/.dep_*" -x "*/ipkg*"))
40 endef
41 endif
42 endif
43
44 define Download/default
45 FILE:=$(PKG_SOURCE)
46 URL:=$(PKG_SOURCE_URL)
47 SUBDIR:=$(PKG_SOURCE_SUBDIR)
48 PROTO:=$(PKG_SOURCE_PROTO)
49 VERSION:=$(PKG_SOURCE_VERSION)
50 MD5SUM:=$(PKG_MD5SUM)
51 endef
52
53 define Build/DefaultTargets
54 $(if $(QUILT),$(Build/Quilt))
55 $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
56 $(call Build/Autoclean)
57
58 $(STAMP_PREPARED):
59 @-rm -rf $(PKG_BUILD_DIR)
60 @mkdir -p $(PKG_BUILD_DIR)
61 $(Build/Prepare)
62 touch $$@
63
64 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
65 $(Build/Configure)
66 touch $$@
67
68 $(STAMP_BUILT): $(STAMP_CONFIGURED)
69 $(Build/Compile)
70 touch $$@
71
72 $(STAMP_INSTALLED): $(STAMP_BUILT)
73 $(call Build/InstallDev,$(STAGING_DIR))
74 touch $$@
75
76 ifdef Build/InstallDev
77 compile: $(STAMP_INSTALLED)
78 endif
79
80 define Build/DefaultTargets
81 endef
82
83 prepare: $(STAMP_PREPARED)
84 configure: $(STAMP_CONFIGURED)
85 endef
86
87 define BuildPackage
88 $(eval $(Package/Default))
89 $(eval $(Package/$(1)))
90
91 ifdef DESCRIPTION
92 $$(error DESCRIPTION:= is obselete, use Package/PKG_NAME/description)
93 endif
94
95 ifndef Package/$(1)/description
96 define Package/$(1)/description
97 $(TITLE)
98 endef
99 endif
100
101 $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
102 ifeq ($($(FIELD)),)
103 $$(error Package/$(1) is missing the $(FIELD) field)
104 endif
105 )
106
107 $(call shexport,Package/$(1)/description)
108 $(call shexport,Package/$(1)/config)
109
110 $(if $(DUMP), \
111 $(Dumpinfo), \
112 $(foreach target, \
113 $(if $(Package/$(1)/targets),$(Package/$(1)/targets), \
114 $(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg ) \
115 ), $(BuildTarget/$(target)) \
116 ) \
117 )
118 $(if $(DUMP),,$(call Build/DefaultTargets,$(1)))
119 endef
120
121 # prevent libtool from setting rpath when linking
122 define libtool_disable_rpath
123 find $(PKG_BUILD_DIR) -name 'libtool' | $(XARGS) \
124 $(SED) 's,^hardcode_libdir_flag_spec=.*,hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ ",g'
125 endef
126
127 # prevent libtool from linking against host development libraries
128 define libtool_fixup_libdir
129 find $(PKG_BUILD_DIR) -name '*.la' | $(XARGS) \
130 $(SED) "s,^libdir='/usr/lib',libdir='$(strip $(1))/usr/lib',g"
131 endef
132
133 define pkg_install_files
134 $(foreach install_file,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_file)`; $(INSTALL_DATA) $(2)/$(install_file) $(3)/`dirname $(install_file)`;)
135 endef
136
137 define pkg_install_bin
138 $(foreach install_apps,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_file)`; $(INSTALL_BIN) $(2)/$(install_file) $(3)/`dirname $(install_file)`;)
139 endef
140
141 define Build/Prepare
142 $(call Build/Prepare/Default,)
143 endef
144
145 define Build/Configure
146 $(call Build/Configure/Default,)
147 endef
148
149 define Build/Compile
150 $(call Build/Compile/Default,)
151 endef
152
153 $(PACKAGE_DIR):
154 mkdir -p $@
155
156 dumpinfo:
157 download:
158 prepare:
159 configure:
160 compile:
161 install:
162 clean: FORCE
163 $(call Build/UninstallDev,$(STAGING_DIR))
164 $(Build/Clean)
165 @rm -f $(STAGING_DIR)/stamp/.$(PKG_NAME)-installed
166 @rm -rf $(PKG_BUILD_DIR)
This page took 0.054965 seconds and 5 git commands to generate.