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