properly disable CONFIG_CRYPTO_HW
[oweals/openwrt.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         $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
31   endef
32 endif
33
34 define Build/Prepare
35   $(call Build/Prepare/Default)
36 endef
37
38 define Build/Configure/Default
39         @(cd $(PKG_BUILD_DIR)/$(3); \
40         [ -x configure ] && \
41                 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
42                 $(2) \
43                 CPPFLAGS="$(HOST_CFLAGS)" \
44                 LDFLAGS="$(HOST_LDFLAGS)" \
45                 SHELL="$(BASH)" \
46                 ./configure \
47                 --target=$(GNU_HOST_NAME) \
48                 --host=$(GNU_HOST_NAME) \
49                 --build=$(GNU_HOST_NAME) \
50                 --program-prefix="" \
51                 --program-suffix="" \
52                 --prefix=$(STAGING_DIR_HOST) \
53                 --exec-prefix=$(STAGING_DIR_HOST) \
54                 --sysconfdir=$(STAGING_DIR_HOST)/etc \
55                 --localstatedir=$(STAGING_DIR_HOST)/var \
56                 $(DISABLE_NLS) \
57                 $(1); \
58                 true; \
59         )
60 endef
61
62 define Build/Configure
63   $(call Build/Configure/Default)
64 endef
65
66 define Build/Compile/Default
67         $(MAKE) -C $(PKG_BUILD_DIR) $(1)
68 endef
69
70 define Build/Compile
71   $(call Build/Compile/Default)
72 endef
73
74 ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
75   define HostBuild/Autoclean
76     $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
77     $(if $(if $(Build/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT)))
78   endef
79 endif
80
81 define Download/default
82   FILE:=$(PKG_SOURCE)
83   URL:=$(PKG_SOURCE_URL)
84   PROTO:=$(PKG_SOURCE_PROTO)
85   VERSION:=$(PKG_SOURCE_VERSION)
86   MD5SUM:=$(PKG_MD5SUM)
87 endef
88
89 define HostBuild
90   $(if $(QUILT),$(Build/Quilt))
91   $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
92   $(if $(DUMP),,$(call HostBuild/Autoclean))
93   
94   $(STAMP_PREPARED):
95         @-rm -rf $(PKG_BUILD_DIR)
96         @mkdir -p $(PKG_BUILD_DIR)
97         $(call Build/Prepare)
98         touch $$@
99
100   $(STAMP_CONFIGURED): $(STAMP_PREPARED)
101         $(call Build/Configure)
102         touch $$@
103
104   $(STAMP_BUILT): $(STAMP_CONFIGURED)
105         $(call Build/Compile)
106         touch $$@
107
108   $(STAMP_INSTALLED): $(STAMP_BUILT)
109         $(call Build/Install)
110         mkdir -p $$(shell dirname $$@)
111         touch $$@
112         
113   ifdef Build/Install
114     install: $(STAMP_INSTALLED)
115   endif
116
117   package-clean: FORCE
118         $(call Build/Clean)
119         $(call Build/Uninstall)
120         rm -f $(STAMP_INSTALLED) $(STAMP_BUILT)
121
122   download:
123   prepare: $(STAMP_PREPARED)
124   configure: $(STAMP_CONFIGURED)
125   compile: $(STAMP_BUILT)
126   install:
127   clean: FORCE
128         $(call Build/Clean)
129         rm -rf $(PKG_BUILD_DIR)
130
131 endef