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