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