toolchain/uClibc: handle different MIPS64 ABIs
[openwrt/openwrt.git] / toolchain / musl / common.mk
1 #
2 # Copyright (C) 2012 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=$(PKG_SOURCE_VERSION)
13
14 PKG_SOURCE_VERSION_0.9.8:=e6dcebd5efa2d390f0a24dc11444024e9fd1990c
15 PKG_SOURCE_VERSION_0.9.9:=a57ac9bf64ba202bd94d1b81bddd93b850c7b9d6
16
17 PKG_SOURCE_PROTO:=git
18 PKG_SOURCE_URL:=git://git.musl-libc.org/musl
19 PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
20 PKG_SOURCE_VERSION:=$(PKG_SOURCE_VERSION_$(PKG_VERSION))
21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
22 LIBC_SO_VERSION:=$(PKG_VERSION)
23 PATCH_DIR:=$(PATH_PREFIX)/patches-$(PKG_VERSION)
24 CONFIG_DIR:=$(PATH_PREFIX)/config-$(PKG_VERSION)
25
26 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
27
28 include $(INCLUDE_DIR)/toolchain-build.mk
29
30 MUSL_CONFIGURE:= \
31 $(TARGET_CONFIGURE_OPTS) \
32 CFLAGS="$(TARGET_CFLAGS)" \
33 CROSS_COMPILE="$(TARGET_CROSS)" \
34 $(HOST_BUILD_DIR)/configure \
35 --prefix=/ \
36 --host=$(GNU_HOST_NAME) \
37 --target=$(REAL_GNU_TARGET_NAME) \
38 --disable-gcc-wrapper
39
40 ifeq ($(CONFIG_MUSL_ENABLE_DEBUG),y)
41 MUSL_CONFIGURE+= \
42 --enable-debug
43 endif
44
45 define Host/Prepare
46 $(call Host/Prepare/Default)
47 $(if $(strip $(QUILT)), \
48 cd $(HOST_BUILD_DIR); \
49 if $(QUILT_CMD) next >/dev/null 2>&1; then \
50 $(QUILT_CMD) push -a; \
51 fi
52 )
53 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
54 endef
55
56 define Host/Configure
57 ( cd $(HOST_BUILD_DIR); rm -f config.cache; \
58 $(MUSL_CONFIGURE) \
59 );
60 endef
61
62
63 define Host/Clean
64 rm -rf \
65 $(HOST_BUILD_DIR) \
66 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
67 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
68 endef