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