538ad270e5dbc97b0826ce35fdce2475ab93ddcf
[openwrt/openwrt.git] / toolchain / musl / common.mk
1 #
2 # Copyright (C) 2012-2013 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
9
10 PKG_NAME:=musl
11 PKG_VERSION:=$(call qstrip,$(CONFIG_MUSL_VERSION))
12 PKG_RELEASE=1
13
14 PKG_SOURCE_MD5SUM_0.9.15:=06f590a38c85722ee9343db2416425f4
15
16 PKG_SOURCE_URL:=http://www.musl-libc.org/releases
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 LIBC_SO_VERSION:=$(PKG_VERSION)
19 PATCH_DIR:=$(PATH_PREFIX)/patches-$(PKG_VERSION)
20 CONFIG_DIR:=$(PATH_PREFIX)/config-$(PKG_VERSION)
21
22 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
23
24 include $(INCLUDE_DIR)/toolchain-build.mk
25
26 MUSL_CONFIGURE:= \
27 $(TARGET_CONFIGURE_OPTS) \
28 CFLAGS="$(TARGET_CFLAGS)" \
29 CROSS_COMPILE="$(TARGET_CROSS)" \
30 $(HOST_BUILD_DIR)/configure \
31 --prefix=/ \
32 --host=$(GNU_HOST_NAME) \
33 --target=$(REAL_GNU_TARGET_NAME) \
34 --disable-gcc-wrapper
35
36 ifeq ($(CONFIG_MUSL_ENABLE_DEBUG),y)
37 MUSL_CONFIGURE+= \
38 --enable-debug
39 endif
40
41 define Host/Prepare
42 $(call Host/Prepare/Default)
43 $(if $(strip $(QUILT)), \
44 cd $(HOST_BUILD_DIR); \
45 if $(QUILT_CMD) next >/dev/null 2>&1; then \
46 $(QUILT_CMD) push -a; \
47 fi
48 )
49 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
50 endef
51
52 define Host/Configure
53 ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
54 $(MUSL_CONFIGURE) \
55 );
56 endef
57
58 define Host/Clean
59 rm -rf \
60 $(HOST_BUILD_DIR) \
61 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
62 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
63 endef