c0d62148e881a79af31044df8caddfc1cdb834bc
2 # Copyright (C) 2006-2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 PKG_BUILD_DIR ?
= $(BUILD_DIR_HOST
)/$(PKG_NAME
)$(if
$(PKG_VERSION
),-$(PKG_VERSION
))
9 PKG_INSTALL_DIR ?
= $(PKG_BUILD_DIR
)/host-install
11 include $(INCLUDE_DIR
)/host.mk
12 include $(INCLUDE_DIR
)/unpack.mk
13 include $(INCLUDE_DIR
)/depends.mk
15 STAMP_PREPARED
=$(PKG_BUILD_DIR
)/.prepared
$(if
$(QUILT
)$(DUMP
),,$(shell $(call find_md5
,${CURDIR} $(PKG_FILE_DEPEND
),)))
16 STAMP_CONFIGURED
:=$(PKG_BUILD_DIR
)/.configured
17 STAMP_BUILT
:=$(PKG_BUILD_DIR
)/.built
18 STAMP_INSTALLED
:=$(STAGING_DIR_HOST
)/stamp
/.
$(PKG_NAME
)_installed
22 include $(INCLUDE_DIR
)/download.mk
23 include $(INCLUDE_DIR
)/quilt.mk
25 Build
/Patch
:=$(Build
/Patch
/Default
)
26 ifneq ($(strip $(PKG_UNPACK
)),)
27 define Build
/Prepare
/Default
34 $(call Build
/Prepare
/Default
)
37 define Build
/Configure
/Default
38 @
(cd
$(PKG_BUILD_DIR
)/$(3); \
40 $(CP
) $(SCRIPT_DIR
)/config.
{guess
,sub
} $(PKG_BUILD_DIR
)/$(3)/ && \
42 CPPFLAGS
="$(HOST_CFLAGS)" \
43 LDFLAGS
="$(HOST_LDFLAGS)" \
46 --target
=$(GNU_HOST_NAME
) \
47 --host
=$(GNU_HOST_NAME
) \
48 --build
=$(GNU_HOST_NAME
) \
51 --prefix=$(STAGING_DIR_HOST
) \
52 --exec-prefix
=$(STAGING_DIR_HOST
) \
53 --sysconfdir
=$(STAGING_DIR_HOST
)/etc \
54 --localstatedir
=$(STAGING_DIR_HOST
)/var \
61 define Build
/Configure
62 $(call Build
/Configure
/Default
)
65 define Build
/Compile
/Default
66 $(MAKE
) -C
$(PKG_BUILD_DIR
) $(1)
70 $(call Build
/Compile
/Default
)
73 ifneq ($(if
$(QUILT
),,$(CONFIG_AUTOREBUILD
)),)
74 define HostBuild
/Autoclean
75 $(call rdep
,${CURDIR} $(PKG_FILE_DEPEND
),$(STAMP_PREPARED
))
76 $(if
$(if
$(Build
/Compile
),$(filter prepare
,$(MAKECMDGOALS
)),1),,$(call rdep
,$(PKG_BUILD_DIR
),$(STAMP_BUILT
)))
80 define Download
/default
82 URL
:=$(PKG_SOURCE_URL
)
83 PROTO
:=$(PKG_SOURCE_PROTO
)
84 VERSION
:=$(PKG_SOURCE_VERSION
)
89 $(if
$(strip $(PKG_SOURCE_URL
)),$(call Download
,default
))
90 $(if
$(DUMP
),,$(call HostBuild
/Autoclean
))
93 @
-rm -rf
$(PKG_BUILD_DIR
)
94 @mkdir
-p
$(PKG_BUILD_DIR
)
98 $(STAMP_CONFIGURED
): $(STAMP_PREPARED
)
99 $(call Build
/Configure
)
102 $(STAMP_BUILT
): $(STAMP_CONFIGURED
)
103 $(call Build
/Compile
)
106 $(STAMP_INSTALLED
): $(STAMP_BUILT
)
107 $(call Build
/Install
)
108 mkdir
-p
$$(shell dirname
$$@
)
112 install: $(STAMP_INSTALLED
)
117 $(call Build
/Uninstall
)
118 rm -f
$(STAMP_INSTALLED
) $(STAMP_BUILT
)
121 prepare
: $(STAMP_PREPARED
)
122 configure
: $(STAMP_CONFIGURED
)
123 compile
: $(STAMP_BUILT
)
127 rm -rf
$(PKG_BUILD_DIR
)