[base-files]: On shutdown disabled every mounted swap device.
[openwrt.git] / toolchain / uClibc / Makefile
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 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
9
10 PKG_NAME:=uClibc
11 PKG_VERSION:=$(call qstrip,$(CONFIG_UCLIBC_VERSION))
12 PKG_EXTRAVERSION:=$(call qstrip,$(CONFIG_UCLIBC_EXTRA_VERSION))
13 PKG_VERSION_SNAPSHOT:=$(call qstrip,$(CONFIG_UCLIBC_VERSION_SNAPSHOT))
14 ifeq ($(PKG_VERSION_SNAPSHOT),y)
15 PKG_SOURCE_URL:=http://www.uclibc.org/downloads/snapshots
16 PKG_SOURCE:=uClibc-snapshot.tar.bz2
17 else
18 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
19 PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
20 endif
21 PATCH_DIR:=./patches/$(PKG_VERSION)$(PKG_EXTRAVERSION)
22 CONFIG_DIR:=./config/$(PKG_VERSION)$(PKG_EXTRAVERSION)
23
24 ifeq ($(PKG_VERSION),0.9.28)
25 ifeq ($(PKG_EXTRAVERSION),.2)
26 PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
27 endif
28 ifeq ($(PKG_EXTRAVERSION),.3)
29 PKG_MD5SUM:=428405a36b4662980d9343b32089b5a6
30 endif
31 endif
32
33 ifeq ($(PKG_VERSION),0.9.29)
34 ifeq ($(PKG_EXTRAVERSION),)
35 # currently the default version, no special sub-directory needed
36 PATCH_DIR:=./patches
37 CONFIG_DIR:=./config
38 PKG_MD5SUM:=61dc55f43b17a38a074f347e74095b20
39 endif
40 endif
41
42 ifeq ($(PKG_VERSION),0.9.30)
43 ifeq ($(PKG_EXTRAVERSION),)
44 PKG_MD5SUM:=e5766e2566e0297adebebbcc0aba1f2d
45 endif
46 endif
47
48 ifeq ($(PKG_VERSION_SNAPSHOT),y)
49 PATCH_DIR:=
50 CONFIG_DIR:=./config
51 PKG_MD5SUM:=
52 endif
53
54 ifeq ($(PKG_VERSION_SNAPSHOT),y)
55 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/uClibc-$(PKG_EXTRAVERSION)
56 else
57 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
58 endif
59
60 include $(INCLUDE_DIR)/toolchain-build.mk
61
62 STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
63 STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc-utils_installed
64
65 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
66 -e 's/i.86/i386/' \
67 -e 's/sparc.*/sparc/' \
68 -e 's/arm.*/arm/g' \
69 -e 's/avr32.*/avr32/g' \
70 -e 's/m68k.*/m68k/' \
71 -e 's/ppc/powerpc/g' \
72 -e 's/v850.*/v850/g' \
73 -e 's/sh64/sh/' \
74 -e 's/sh[234].*/sh/' \
75 -e 's/mips.*/mips/' \
76 -e 's/mipsel.*/mips/' \
77 -e 's/cris.*/cris/' \
78 )
79
80
81 define Host/SetToolchainInfo
82 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
83 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR)/info.mk
84 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
85 $(SED) 's,^\(LIBC_PATCHVER\)=.*,\1=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR)/info.mk
86 endef
87
88 define Host/Prepare/Snapshot
89 $(PKG_UNPACK)
90 rm -Rf $(HOST_BUILD_DIR)
91 ln -snf $(BUILD_DIR_TOOLCHAIN)/uClibc $(HOST_BUILD_DIR)
92 $(Host/Patch)
93 $(if $(QUILT),touch $(HOST_BUILD_DIR)/.quilt_used)
94 endef
95
96 define Host/Prepare/V_0_9_28
97 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(BUILD_DIR_TOOLCHAIN)/linux\",g' \
98 $(HOST_BUILD_DIR)/.config
99 ifeq ($(CONFIG_SOFT_FLOAT),y)
100 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(HOST_BUILD_DIR)/.config
101 endif
102 ifeq ($(CONFIG_C99_MATH),y)
103 $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(HOST_BUILD_DIR)/.config
104 endif
105 endef
106
107 define Host/Prepare
108 $(call Host/SetToolchainInfo)
109 @echo prepare uClibc version $(PKG_VERSION)$(PKG_EXTRAVERSION)
110 ifeq ($(PKG_VERSION_SNAPSHOT),y)
111 $(call Host/Prepare/Snapshot)
112 else
113 $(call Host/Prepare/Default)
114 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
115 endif
116 $(CP) ./$(CONFIG_DIR)/$(ARCH)$(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD)) $(HOST_BUILD_DIR)/.config
117 ifeq ($(PKG_VERSION),0.9.28)
118 $(call Host/Prepare/V_0_9_28)
119 endif
120 $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include\",g' \
121 -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
122 -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
123 -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
124 -e 's,^.*CONFIG_ARM_EABI.*,CONFIG_ARM_EABI=$(if $(CONFIG_EABI_SUPPORT),y,n),g' \
125 -e 's,^.*CONFIG_ARM_OABI.*,CONFIG_ARM_OABI=$(if $(CONFIG_EABI_SUPPORT),n,y),g' \
126 -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
127 $(HOST_BUILD_DIR)/.config
128 $(MAKE) -C $(HOST_BUILD_DIR)/extra/config conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS"
129 PATH=$(TARGET_PATH) $(MAKE) -C $(HOST_BUILD_DIR) \
130 PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
131 DEVEL_PREFIX=/usr/ \
132 RUNTIME_PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
133 HOSTCC="$(HOSTCC)" \
134 CC="$(TARGET_CC)" \
135 CPU_CFLAGS="$(TARGET_CFLAGS)" \
136 pregen \
137 $(if $(CONFIG_UCLIBC_VERSION_0_9_28),install_dev,install_headers)
138 endef
139
140 define Host/Configure
141 endef
142
143 UCLIBC_MAKE := PATH=$(TARGET_PATH) $(MAKE) -C $(HOST_BUILD_DIR) \
144 $(TARGET_CONFIGURE_OPTS) \
145 DEVEL_PREFIX=/usr/ \
146 RUNTIME_PREFIX=/ \
147 HOSTCC="$(HOSTCC)" \
148 CPU_CFLAGS="$(TARGET_CFLAGS)" \
149 DOSTRIP=""
150
151 define Host/Compile
152 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR)/Rules.mak
153 $(UCLIBC_MAKE) PREFIX= all
154 $(UCLIBC_MAKE) PREFIX="$(TOOLCHAIN_DIR)/" install_runtime install_dev
155 ln -sf ../../lib/libc.so.0 $(TOOLCHAIN_DIR)/usr/lib/libc.so
156 # ( cd $(TOOLCHAIN_DIR) ; \
157 # for d in lib usr/lib ; do \
158 # for f in libc.so libpthread.so libgcc_s.so ; do \
159 # if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
160 # $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
161 # fi \
162 # done \
163 # done \
164 # )
165 endef
166
167 define Host/Install
168 $(UCLIBC_MAKE) PREFIX= utils
169 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/usr/bin
170 $(INSTALL_BIN) \
171 $(HOST_BUILD_DIR)/utils/ldd \
172 $(TOOLCHAIN_DIR)/usr/bin/
173 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/sbin
174 $(INSTALL_BIN) \
175 $(HOST_BUILD_DIR)/utils/ldconfig \
176 $(TOOLCHAIN_DIR)/sbin/
177 endef
178
179 define Host/Clean
180 rm -rf \
181 $(HOST_BUILD_DIR) \
182 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
183 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
184 endef
185
186 $(eval $(call HostBuild))
This page took 0.063639 seconds and 5 git commands to generate.