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