fix mistakes in unpack change
[openwrt-10.03/.git] / include / host-build.mk
1
2 # Copyright (C) 2006 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 include $(INCLUDE_DIR)/host.mk
9 include $(INCLUDE_DIR)/unpack.mk
10
11 ifneq ($(strip $(PKG_UNPACK)),)
12   define Build/Prepare/Default
13         $(PKG_UNPACK)
14         @if [ -d ./patches ]; then \
15                 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
16         fi
17   endef
18 endif
19
20 define Build/Prepare
21   $(call Build/Prepare/Default)
22 endef
23
24 define Build/Configure/Default
25         @(cd $(PKG_BUILD_DIR)/$(3); \
26         [ -x configure ] && \
27                 $(2) \
28                 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
29                 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
30                 ./configure \
31                 --target=$(GNU_TARGET_NAME) \
32                 --host=$(GNU_TARGET_NAME) \
33                 --build=$(GNU_HOST_NAME) \
34                 --program-prefix="" \
35                 --program-suffix="" \
36                 --prefix=/usr \
37                 --exec-prefix=/usr \
38                 --bindir=/usr/bin \
39                 --sbindir=/usr/sbin \
40                 --libexecdir=/usr/lib \
41                 --sysconfdir=/etc \
42                 --datadir=/usr/share \
43                 --localstatedir=/var \
44                 --mandir=/usr/man \
45                 --infodir=/usr/info \
46                 $(DISABLE_NLS) \
47                 $(1); \
48                 true; \
49         )
50 endef
51
52 define Build/Configure
53   $(call Build/Configure/Default)
54 endef
55
56 define Build/Compile/Default
57         $(MAKE) -C $(PKG_BUILD_DIR) $(1)
58 endef
59
60 define Build/Compile
61   $(call Build/Compile/Default)
62 endef
63
64                 
65 ifneq ($(strip $(PKG_SOURCE)),)
66   download: $(DL_DIR)/$(PKG_SOURCE)
67
68   $(DL_DIR)/$(PKG_SOURCE):
69         mkdir -p $(DL_DIR)
70         $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
71
72   $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
73 endif
74
75 define HostBuild
76   $(PKG_BUILD_DIR)/.prepared:
77         @-rm -rf $(PKG_BUILD_DIR)
78         @mkdir -p $(PKG_BUILD_DIR)
79         $(call Build/Prepare)
80         touch $$@
81
82   $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
83         $(call Build/Configure)
84         touch $$@
85
86   $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
87         $(call Build/Compile)
88         touch $$@
89
90   $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
91         $(call Build/Install)
92         touch $$@
93         
94   ifdef Build/Install
95     install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
96   endif
97
98   package-clean: FORCE
99         $(call Build/Clean)
100         $(call Build/Uninstall)
101         rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
102
103   download:
104   prepare: $(PKG_BUILD_DIR)/.prepared
105   configure: $(PKG_BUILD_DIR)/.configured
106
107   compile-targets: $(PKG_BUILD_DIR)/.built
108   compile: compile-targets
109
110   install-targets:
111   install: install-targets
112
113   clean-targets:
114   clean: FORCE
115         @$(MAKE) clean-targets
116         $(call Build/Clean)
117         rm -rf $(PKG_BUILD_DIR)
118
119 endef