add preliminary support for musl
[openwrt/openwrt.git] / toolchain / musl / Makefile
1 PATH_PREFIX=.
2
3 include ./common.mk
4
5 HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
6 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.musl_installed
7
8 HOST_BUILD_PARALLEL:=1
9
10 define Host/SetToolchainInfo
11 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
12 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.musl-libc.org/,' $(TOOLCHAIN_DIR)/info.mk
13 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
14 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(LIBC_SO_VERSION),' $(TOOLCHAIN_DIR)/info.mk
15 endef
16
17 define Host/Compile
18 $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) all
19 endef
20
21 define Host/Install
22 $(call Host/SetToolchainInfo)
23 $(MAKE) -C $(HOST_BUILD_DIR) DESTDIR="$(TOOLCHAIN_DIR)/" install
24 ( cd $(TOOLCHAIN_DIR) ; \
25 for d in lib usr/lib ; do \
26 for f in libc.so libpthread.so libgcc_s.so ; do \
27 if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
28 $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
29 fi \
30 done \
31 done \
32 )
33 rm -f \
34 $(TOOLCHAIN_DIR)/lib/libresolv*.so* \
35 $(TOOLCHAIN_DIR)/lib/libnsl*.so*
36 endef
37
38 $(eval $(call HostBuild))