proper series file support for regular packages
[openwrt/staging/chunkeey.git] / include / host-build.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 PKG_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
9 PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/host-install
10
11 include $(INCLUDE_DIR)/host.mk
12 include $(INCLUDE_DIR)/unpack.mk
13 include $(INCLUDE_DIR)/depends.mk
14
15 STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),)))
16 STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
17 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
18 STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
19
20 override MAKEFLAGS=
21
22 include $(INCLUDE_DIR)/download.mk
23 include $(INCLUDE_DIR)/quilt.mk
24
25 Build/Patch:=$(Build/Patch/Default)
26 ifneq ($(strip $(PKG_UNPACK)),)
27 define Build/Prepare/Default
28 $(PKG_UNPACK)
29 $(Build/Patch)
30 endef
31 endif
32
33 define Build/Prepare
34 $(call Build/Prepare/Default)
35 endef
36
37 define Build/Configure/Default
38 @(cd $(PKG_BUILD_DIR)/$(3); \
39 [ -x configure ] && \
40 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
41 $(2) \
42 CPPFLAGS="$(HOST_CFLAGS)" \
43 LDFLAGS="$(HOST_LDFLAGS)" \
44 SHELL="$(BASH)" \
45 ./configure \
46 --target=$(GNU_HOST_NAME) \
47 --host=$(GNU_HOST_NAME) \
48 --build=$(GNU_HOST_NAME) \
49 --program-prefix="" \
50 --program-suffix="" \
51 --prefix=$(STAGING_DIR_HOST) \
52 --exec-prefix=$(STAGING_DIR_HOST) \
53 --sysconfdir=$(STAGING_DIR_HOST)/etc \
54 --localstatedir=$(STAGING_DIR_HOST)/var \
55 $(DISABLE_NLS) \
56 $(1); \
57 true; \
58 )
59 endef
60
61 define Build/Configure
62 $(call Build/Configure/Default)
63 endef
64
65 define Build/Compile/Default
66 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
67 endef
68
69 define Build/Compile
70 $(call Build/Compile/Default)
71 endef
72
73 ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
74 define HostBuild/Autoclean
75 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
76 $(if $(if $(Build/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT)))
77 endef
78 endif
79
80 define Download/default
81 FILE:=$(PKG_SOURCE)
82 URL:=$(PKG_SOURCE_URL)
83 PROTO:=$(PKG_SOURCE_PROTO)
84 VERSION:=$(PKG_SOURCE_VERSION)
85 MD5SUM:=$(PKG_MD5SUM)
86 endef
87
88 define HostBuild
89 $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
90 $(if $(DUMP),,$(call HostBuild/Autoclean))
91
92 $(STAMP_PREPARED):
93 @-rm -rf $(PKG_BUILD_DIR)
94 @mkdir -p $(PKG_BUILD_DIR)
95 $(call Build/Prepare)
96 touch $$@
97
98 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
99 $(call Build/Configure)
100 touch $$@
101
102 $(STAMP_BUILT): $(STAMP_CONFIGURED)
103 $(call Build/Compile)
104 touch $$@
105
106 $(STAMP_INSTALLED): $(STAMP_BUILT)
107 $(call Build/Install)
108 mkdir -p $$(shell dirname $$@)
109 touch $$@
110
111 ifdef Build/Install
112 install: $(STAMP_INSTALLED)
113 endif
114
115 package-clean: FORCE
116 $(call Build/Clean)
117 $(call Build/Uninstall)
118 rm -f $(STAMP_INSTALLED) $(STAMP_BUILT)
119
120 download:
121 prepare: $(STAMP_PREPARED)
122 configure: $(STAMP_CONFIGURED)
123 compile: $(STAMP_BUILT)
124 install:
125 clean: FORCE
126 $(call Build/Clean)
127 rm -rf $(PKG_BUILD_DIR)
128
129 endef