[ar71xx] ls-sr71: add GPIO LEDs
[openwrt.git] / include / host-build.mk
1 #
2 # Copyright (C) 2006-2009 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 HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
9 HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
10
11 include $(INCLUDE_DIR)/host.mk
12 include $(INCLUDE_DIR)/unpack.mk
13 include $(INCLUDE_DIR)/depends.mk
14
15 HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPEND),)))
16 HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured
17 HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
18 HOST_STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
19
20 override MAKEFLAGS=
21
22 include $(INCLUDE_DIR)/download.mk
23 include $(INCLUDE_DIR)/quilt.mk
24
25 Host/Patch:=$(Host/Patch/Default)
26 ifneq ($(strip $(HOST_UNPACK)),)
27 define Host/Prepare/Default
28 $(HOST_UNPACK)
29 $(Host/Patch)
30 endef
31 endif
32
33 define Host/Prepare
34 $(call Host/Prepare/Default)
35 endef
36
37 HOST_CONFIGURE_VARS = \
38 CPPFLAGS="$(HOST_CFLAGS)" \
39 LDFLAGS="$(HOST_LDFLAGS)" \
40 SHELL="$(BASH)"
41
42 HOST_CONFIGURE_ARGS = \
43 --target=$(GNU_HOST_NAME) \
44 --host=$(GNU_HOST_NAME) \
45 --build=$(GNU_HOST_NAME) \
46 --program-prefix="" \
47 --program-suffix="" \
48 --prefix=$(STAGING_DIR_HOST) \
49 --exec-prefix=$(STAGING_DIR_HOST) \
50 --sysconfdir=$(STAGING_DIR_HOST)/etc \
51 --localstatedir=$(STAGING_DIR_HOST)/var
52
53 HOST_CONFIGURE_CMD = ./configure
54
55 define Host/Configure/Default
56 @(cd $(HOST_BUILD_DIR)/$(3); \
57 if [ -x configure ]; then \
58 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/$(3)/ && \
59 $(2) \
60 $(HOST_CONFIGURE_CMD) \
61 $(HOST_CONFIGURE_VARS) \
62 $(HOST_CONFIGURE_ARGS) \
63 $(1); \
64 fi \
65 )
66 endef
67
68 define Host/Configure
69 $(call Host/Configure/Default)
70 endef
71
72 define Host/Compile/Default
73 $(MAKE) -C $(HOST_BUILD_DIR) $(1)
74 endef
75
76 define Host/Compile
77 $(call Host/Compile/Default)
78 endef
79
80 ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
81 define HostHost/Autoclean
82 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(HOST_STAMP_PREPARED))
83 $(if $(if $(Host/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(HOST_BUILD_DIR),$(HOST_STAMP_BUILT)))
84 endef
85 endif
86
87 define Download/default
88 FILE:=$(PKG_SOURCE)
89 URL:=$(PKG_SOURCE_URL)
90 PROTO:=$(PKG_SOURCE_PROTO)
91 SUBDIR:=$(PKG_SOURCE_SUBDIR)
92 VERSION:=$(PKG_SOURCE_VERSION)
93 MD5SUM:=$(PKG_MD5SUM)
94 endef
95
96 ifndef DUMP
97 define HostBuild
98 $(if $(QUILT),$(Host/Quilt))
99 $(if $(STAMP_PREPARED),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
100 $(if $(DUMP),,$(call HostHost/Autoclean))
101
102 $(HOST_STAMP_PREPARED):
103 @-rm -rf $(HOST_BUILD_DIR)
104 @mkdir -p $(HOST_BUILD_DIR)
105 $(call Host/Prepare)
106 touch $$@
107
108 $(HOST_STAMP_CONFIGURED): $(HOST_STAMP_PREPARED)
109 $(call Host/Configure)
110 touch $$@
111
112 $(HOST_STAMP_BUILT): $(HOST_STAMP_CONFIGURED)
113 $(call Host/Compile)
114 touch $$@
115
116 $(HOST_STAMP_INSTALLED): $(HOST_STAMP_BUILT)
117 $(call Host/Install)
118 mkdir -p $$(shell dirname $$@)
119 touch $$@
120
121 ifdef Host/Install
122 host-install: $(HOST_STAMP_INSTALLED)
123 endif
124
125 $(if $(STAMP_BUILT),compile: host-install)
126 host-prepare: $(HOST_STAMP_PREPARED)
127 host-configure: $(HOST_STAMP_CONFIGURED)
128 host-compile: $(HOST_STAMP_BUILT)
129 host-install:
130 host-clean: FORCE
131 $(call Host/Clean)
132 $(call Host/Uninstall)
133 rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
134
135 endef
136
137 download:
138 prepare: host-prepare
139 compile: host-compile
140 install: host-install
141 clean: host-clean
142
143 endif
144
This page took 0.056839 seconds and 5 git commands to generate.