use soft float by default on arm and powerpc
[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 include $(INCLUDE_DIR)/autotools.mk
31
32 override MAKEFLAGS=
33 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
34
35 ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
36 ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
37 define Build/Autoclean
38 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
39 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED),$(PKG_BUILD_DIR)/.dep_files,-x "*/.dep_*")
40 $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),,-x "*/.dep_*" -x "*/ipkg*"))
41 endef
42 endif
43 endif
44
45 define Download/default
46 FILE:=$(PKG_SOURCE)
47 URL:=$(PKG_SOURCE_URL)
48 SUBDIR:=$(PKG_SOURCE_SUBDIR)
49 PROTO:=$(PKG_SOURCE_PROTO)
50 VERSION:=$(PKG_SOURCE_VERSION)
51 MD5SUM:=$(PKG_MD5SUM)
52 endef
53
54 define sep
55
56 endef
57
58 define Build/DefaultTargets
59 $(if $(QUILT),$(Build/Quilt))
60 $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
61 $(call Build/Autoclean)
62
63 $(STAMP_PREPARED):
64 @-rm -rf $(PKG_BUILD_DIR)
65 @mkdir -p $(PKG_BUILD_DIR)
66 $(foreach hook,$(Hooks/Prepare/Pre),$(call $(hook))$(sep))
67 $(Build/Prepare)
68 $(foreach hook,$(Hooks/Prepare/Post),$(call $(hook))$(sep))
69 touch $$@
70
71 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
72 $(foreach hook,$(Hooks/Configure/Pre),$(call $(hook))$(sep))
73 $(Build/Configure)
74 $(foreach hook,$(Hooks/Configure/Post),$(call $(hook))$(sep))
75 touch $$@
76
77 $(STAMP_BUILT): $(STAMP_CONFIGURED)
78 $(foreach hook,$(Hooks/Compile/Pre),$(call $(hook))$(sep))
79 $(Build/Compile)
80 $(foreach hook,$(Hooks/Compile/Post),$(call $(hook))$(sep))
81 touch $$@
82
83 $(STAMP_INSTALLED): $(STAMP_BUILT)
84 $(NO_TRACE_MAKE) clean-staging
85 rm -rf $(TMP_DIR)/stage-$(PKG_NAME)
86 mkdir -p $(TMP_DIR)/stage-$(PKG_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages
87 $(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_NAME),$(TMP_DIR)/stage-$(PKG_NAME)/host)
88 if [ -d $(TMP_DIR)/stage-$(PKG_NAME) ]; then \
89 (cd $(TMP_DIR)/stage-$(PKG_NAME); find ./ > $(STAGING_DIR)/packages/$(PKG_NAME).list); \
90 $(CP) $(TMP_DIR)/stage-$(PKG_NAME)/* $(STAGING_DIR)/; \
91 fi
92 rm -rf $(TMP_DIR)/stage-$(PKG_NAME)
93 touch $$@
94
95 ifdef Build/InstallDev
96 compile: $(STAMP_INSTALLED)
97 endif
98
99 define Build/DefaultTargets
100 endef
101
102 prepare: $(STAMP_PREPARED)
103 configure: $(STAMP_CONFIGURED)
104 endef
105
106 define BuildPackage
107 $(eval $(Package/Default))
108 $(eval $(Package/$(1)))
109
110 ifdef DESCRIPTION
111 $$(error DESCRIPTION:= is obselete, use Package/PKG_NAME/description)
112 endif
113
114 ifndef Package/$(1)/description
115 define Package/$(1)/description
116 $(TITLE)
117 endef
118 endif
119
120 $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
121 ifeq ($($(FIELD)),)
122 $$(error Package/$(1) is missing the $(FIELD) field)
123 endif
124 )
125
126 $(call shexport,Package/$(1)/description)
127 $(call shexport,Package/$(1)/config)
128
129 $(if $(DUMP), \
130 $(Dumpinfo), \
131 $(foreach target, \
132 $(if $(Package/$(1)/targets),$(Package/$(1)/targets), \
133 $(if $(PKG_TARGETS),$(PKG_TARGETS), ipkg ) \
134 ), $(BuildTarget/$(target)) \
135 ) \
136 )
137 $(if $(DUMP),,$(call Build/DefaultTargets,$(1)))
138 endef
139
140 define pkg_install_files
141 $(foreach install_file,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_file)`; $(INSTALL_DATA) $(2)/$(install_file) $(3)/`dirname $(install_file)`;)
142 endef
143
144 define pkg_install_bin
145 $(foreach install_apps,$(1),$(INSTALL_DIR) $(3)/`dirname $(install_apps)`; $(INSTALL_BIN) $(2)/$(install_apps) $(3)/`dirname $(install_apps)`;)
146 endef
147
148 define Build/Prepare
149 $(call Build/Prepare/Default,)
150 endef
151
152 define Build/Configure
153 $(call Build/Configure/Default,)
154 endef
155
156 define Build/Compile
157 $(call Build/Compile/Default,)
158 endef
159
160 $(PACKAGE_DIR):
161 mkdir -p $@
162
163 dumpinfo:
164 download:
165 prepare:
166 configure:
167 compile:
168 install:
169 clean-staging: FORCE
170 rm -f $(STAMP_INSTALLED)
171 @-(\
172 cd "$(STAGING_DIR)"; \
173 if [ -f packages/$(PKG_NAME).list ]; then \
174 cat packages/$(PKG_NAME).list | xargs -r rm -f 2>/dev/null; \
175 fi; \
176 )
177
178 clean: clean-staging FORCE
179 $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
180 $(Build/Clean)
181 rm -f $(STAGING_DIR)/packages/$(PKG_NAME).list $(STAGING_DIR_HOST)/packages/$(PKG_NAME).list
182 rm -rf $(PKG_BUILD_DIR)
This page took 0.046701 seconds and 5 git commands to generate.