make sure tmp/info gets created
[openwrt/openwrt.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 ifeq ($(DUMP),)
77 ifeq ($(CONFIG_AUTOREBUILD),y)
78 ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
79 $$(info Forcing package rebuild)
80 $(PKG_BUILD_DIR)/.prepared: package-clean
81 endif
82 endif
83 endif
84
85 $(PKG_BUILD_DIR)/.prepared:
86 @-rm -rf $(PKG_BUILD_DIR)
87 @mkdir -p $(PKG_BUILD_DIR)
88 $(call Build/Prepare)
89 touch $$@
90
91 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
92 $(call Build/Configure)
93 touch $$@
94
95 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
96 $(call Build/Compile)
97 touch $$@
98
99 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
100 $(call Build/Install)
101 mkdir -p $$(shell dirname $$@)
102 touch $$@
103
104 ifdef Build/Install
105 install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
106 endif
107
108 package-clean: FORCE
109 $(call Build/Clean)
110 $(call Build/Uninstall)
111 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
112
113 download:
114 prepare: $(PKG_BUILD_DIR)/.prepared
115 configure: $(PKG_BUILD_DIR)/.configured
116 compile: $(PKG_BUILD_DIR)/.built
117 install:
118 clean: FORCE
119 $(call Build/Clean)
120 rm -rf $(PKG_BUILD_DIR)
121
122 endef