source: trunk/toolchain/make/target/uclibc/uclibc.mk @ 6383

Letzte Änderung dieser Datei seit 6383 war 6383, erstellt von er13 vor 8 Jahren

toolchain:

  • document hardcoded -m32 option as requested by dileks
  • refs #842
Dateigröße: 9.3 KB
Zeile 
1UCLIBC_VERSION:=$(TARGET_TOOLCHAIN_UCLIBC_VERSION)
2UCLIBC_DIR:=$(TARGET_TOOLCHAIN_DIR)/uClibc-$(UCLIBC_VERSION)
3UCLIBC_MAKE_DIR:=$(TOOLCHAIN_DIR)/make/target/uclibc
4UCLIBC_SOURCE:=uClibc-$(UCLIBC_VERSION).tar.bz2
5UCLIBC_SOURCE_SITE:=http://www.uclibc.org/downloads
6ifeq ($(strip $(UCLIBC_VERSION)),0.9.28)
7UCLIBC_SOURCE_SITE:=http://www.uclibc.org/downloads/old-releases
8endif
9ifeq ($(strip $(UCLIBC_VERSION)),0.9.29)
10UCLIBC_SOURCE_SITE:=http://www.uclibc.org/downloads/old-releases
11endif
12
13UCLIBC_MD5_0.9.28 = 1ada58d919a82561061e4741fb6abd29
14UCLIBC_MD5_0.9.29 = 61dc55f43b17a38a074f347e74095b20
15UCLIBC_MD5_0.9.30.3 = 73a4bf4a0fa508b01a7a3143574e3d21
16UCLIBC_MD5_0.9.31   = 52fb8a494758630c8d3ddd7f1e0daafd
17UCLIBC_MD5=$(UCLIBC_MD5_$(UCLIBC_VERSION))
18
19UCLIBC_KERNEL_HEADERS_DIR:=$(KERNEL_HEADERS_DEVEL_DIR)
20
21UCLIBC_DEVEL_SUBDIR:=uClibc_dev
22
23# uClibc pregenerated locale data
24UCLIBC_LOCALE_DATA_SITE:=http://www.uclibc.org/downloads
25# TODO: FREETZ_TARGET_UCLIBC_REDUCED_LOCALE_SET is a REBUILD_SUBOPT
26ifeq ($(strip $(FREETZ_TARGET_UCLIBC_REDUCED_LOCALE_SET)),y)
27UCLIBC_LOCALE_DATA_FILENAME:=uClibc-locale-$(if $(FREETZ_TARGET_ARCH_BE),be,le)-32-de_DE-en_US.tar.gz
28else
29UCLIBC_LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
30endif
31UCLIBC_COMMON_BUILD_FLAGS := LOCALE_DATA_FILENAME=$(UCLIBC_LOCALE_DATA_FILENAME)
32
33ifeq ($(strip $(FREETZ_VERBOSITY_LEVEL)),2)
34UCLIBC_COMMON_BUILD_FLAGS += V=1
35endif
36
37UCLIBC_HOST_CFLAGS:=$(TOOLCHAIN_HOST_CFLAGS) -U_GNU_SOURCE -fno-strict-aliasing
38
39$(DL_DIR)/$(UCLIBC_LOCALE_DATA_FILENAME): | $(DL_DIR)
40    $(DL_TOOL) $(DL_DIR) .config $(UCLIBC_LOCALE_DATA_FILENAME) $(UCLIBC_LOCALE_DATA_SITE)
41
42uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
43$(DL_DIR)/$(UCLIBC_SOURCE): | $(DL_DIR)
44    $(DL_TOOL) $(DL_DIR) .config $(UCLIBC_SOURCE) $(UCLIBC_SOURCE_SITE) $(UCLIBC_MD5)
45
46uclibc-unpacked: $(UCLIBC_DIR)/.unpacked
47$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(DL_DIR)/$(UCLIBC_LOCALE_DATA_FILENAME) | $(TARGET_TOOLCHAIN_DIR)
48    $(RM) -r $(UCLIBC_DIR)
49    tar -C $(TARGET_TOOLCHAIN_DIR) $(VERBOSE) -xjf $(DL_DIR)/$(UCLIBC_SOURCE)
50    set -e; \
51    for i in $(UCLIBC_MAKE_DIR)/$(UCLIBC_VERSION)/*.patch; do \
52        $(PATCH_TOOL) $(UCLIBC_DIR) $$i; \
53    done
54    cp -dpf $(DL_DIR)/$(UCLIBC_LOCALE_DATA_FILENAME) $(UCLIBC_DIR)/extra/locale/
55    touch $@
56
57$(UCLIBC_DIR)/.config: $(UCLIBC_DIR)/.unpacked
58    cp $(TOOLCHAIN_DIR)/make/target/uclibc/Config.$(TARGET_TOOLCHAIN_UCLIBC_REF).$(UCLIBC_VERSION) $(UCLIBC_DIR)/.config
59    $(call PKG_EDIT_CONFIG,CROSS=$(TARGET_MAKE_PATH)/$(TARGET_CROSS)) $(UCLIBC_DIR)/Rules.mak
60    $(call PKG_EDIT_CONFIG, \
61        $(if $(FREETZ_TARGET_UCLIBC_VERSION_0_9_28), \
62            KERNEL_SOURCE=\"$(UCLIBC_KERNEL_HEADERS_DIR)\" \
63        , \
64            KERNEL_HEADERS=\"$(UCLIBC_KERNEL_HEADERS_DIR)/include\" \
65            ARCH_WANTS_LITTLE_ENDIAN=$(if $(FREETZ_TARGET_ARCH_LE),y,n) \
66            ARCH_WANTS_BIG_ENDIAN=$(if $(FREETZ_TARGET_ARCH_LE),n,y) \
67        ) \
68        UCLIBC_HAS_IPV6=$(FREETZ_TARGET_IPV6_SUPPORT) \
69        UCLIBC_HAS_LFS=$(FREETZ_TARGET_LFS) \
70        UCLIBC_HAS_FOPEN_LARGEFILE_MODE=n \
71        UCLIBC_HAS_WCHAR=y \
72    ) $(UCLIBC_DIR)/.config
73
74    mkdir -p $(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/usr/include
75    mkdir -p $(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/usr/lib
76    mkdir -p $(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/lib
77    $(MAKE1) -C $(UCLIBC_DIR) \
78        $(UCLIBC_COMMON_BUILD_FLAGS) \
79        PREFIX=$(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/ \
80        DEVEL_PREFIX=/usr/ \
81        RUNTIME_PREFIX=$(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/ \
82        HOSTCC="$(TOOLCHAIN_HOSTCC) $(UCLIBC_HOST_CFLAGS)" \
83        oldconfig < /dev/null > /dev/null
84    touch $@
85
86$(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.config
87    $(MAKE1) -C $(UCLIBC_DIR) \
88        $(UCLIBC_COMMON_BUILD_FLAGS) \
89        PREFIX=$(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/ \
90        DEVEL_PREFIX=/usr/ \
91        RUNTIME_PREFIX=$(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/ \
92        HOSTCC="$(TOOLCHAIN_HOSTCC) $(UCLIBC_HOST_CFLAGS)" headers \
93        $(if $(FREETZ_TARGET_UCLIBC_VERSION_0_9_28),install_dev,install_headers)
94    $(call COPY_KERNEL_HEADERS,$(UCLIBC_KERNEL_HEADERS_DIR),$(TARGET_TOOLCHAIN_STAGING_DIR)/usr)
95    touch $@
96
97uclibc-menuconfig: $(UCLIBC_DIR)/.config
98    $(MAKE1) -C $(UCLIBC_DIR) \
99        $(UCLIBC_COMMON_BUILD_FLAGS) \
100        PREFIX=$(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/ \
101        DEVEL_PREFIX=/usr/ \
102        RUNTIME_PREFIX=$(TARGET_TOOLCHAIN_DIR)/$(UCLIBC_DEVEL_SUBDIR)/ \
103        HOSTCC="$(TOOLCHAIN_HOSTCC) $(UCLIBC_HOST_CFLAGS)" \
104        menuconfig && \
105    cp -f $^ $(TOOLCHAIN_DIR)/make/target/uclibc/Config.$(TARGET_TOOLCHAIN_UCLIBC_REF).$(UCLIBC_VERSION) && \
106    touch $^
107
108$(UCLIBC_DIR)/lib/libc.a: $(UCLIBC_DIR)/.configured $(GCC_BUILD_DIR1)/.installed
109    $(MAKE1) -C $(UCLIBC_DIR) \
110        $(UCLIBC_COMMON_BUILD_FLAGS) \
111        PREFIX= \
112        DEVEL_PREFIX=/ \
113        RUNTIME_PREFIX=/ \
114        HOSTCC="$(TOOLCHAIN_HOSTCC) $(UCLIBC_HOST_CFLAGS)" \
115        all
116ifeq ($(or $(strip $(FREETZ_TARGET_UCLIBC_VERSION_0_9_30)),$(strip $(FREETZ_TARGET_UCLIBC_VERSION_0_9_31))),y)
117    # At this point uClibc is compiled and there is no reason for us to recompile it.
118    # Remove some FORCE rule dependencies causing parts of uClibc to be recompiled (without a need)
119    # over and over again each time make is invoked within uClibc dir (the actual target doesn't matter).
120    # This is a bit dirty workaround we actually should get rid of as soon as we find a better solution.
121    for i in $(UCLIBC_DIR)/Makerules $(UCLIBC_DIR)/extra/locale/Makefile.in; do \
122        cp -a "$$i" "$$i-with-FORCE"; \
123        sed -i -r -e '/.*%[.]o[sS]:.*FORCE.*/s, FORCE , ,g' $$i; \
124    done;
125endif
126    touch -c $@
127
128ifeq ($(strip $(FREETZ_BUILD_TOOLCHAIN)),y)
129UCLIBC_PREREQ=$(GCC_BUILD_DIR1)/.installed
130$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libc.a: $(UCLIBC_DIR)/lib/libc.a
131    $(MAKE1) -C $(UCLIBC_DIR) \
132        $(UCLIBC_COMMON_BUILD_FLAGS) \
133        PREFIX=/ \
134        DEVEL_PREFIX=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/ \
135        RUNTIME_PREFIX=$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/ \
136        install_runtime install_dev
137    $(call COPY_KERNEL_HEADERS,$(UCLIBC_KERNEL_HEADERS_DIR),$(TARGET_TOOLCHAIN_STAGING_DIR)/usr)
138    # Copy some files to make mklibs happy
139ifneq ($(strip $(UCLIBC_VERSION)),0.9.28)
140    for f in libc_pic.a libdl_pic.a libpthread_pic.a; do \
141        $(RM) $(TARGET_TOOLCHAIN_STAGING_DIR)/lib/$$f; \
142    done; \
143    cp $(UCLIBC_DIR)/libc/libc_so.a $(TARGET_TOOLCHAIN_STAGING_DIR)/lib/libc_pic.a; \
144    cp $(UCLIBC_DIR)/libpthread/*/libpthread_so.a $(TARGET_TOOLCHAIN_STAGING_DIR)/lib/libpthread_pic.a ; \
145    cp $(UCLIBC_DIR)/ldso/libdl/libdl_so.a $(TARGET_TOOLCHAIN_STAGING_DIR)/lib/libdl_pic.a
146endif
147    # Build the host utils.
148    # Note: in order the host utils to work the __ELF_NATIVE_CLASS (= __WORDSIZE) of the host
149    # must match that of the target. That's the reason we hardcode the "-m32" option here.
150    $(MAKE1) -C $(UCLIBC_DIR)/utils \
151        $(UCLIBC_COMMON_BUILD_FLAGS) \
152        PREFIX=$(TARGET_TOOLCHAIN_STAGING_DIR) \
153        HOSTCC="$(TOOLCHAIN_HOSTCC) $(UCLIBC_HOST_CFLAGS) -m32" \
154        BUILD_LDFLAGS="$(if $(FREETZ_STATIC_TOOLCHAIN),-static)" \
155        hostutils
156    for i in ldd ldconfig; do \
157        install -c $(UCLIBC_DIR)/utils/$$i.host $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/$$i; \
158        $(HOST_STRIP) $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/bin/$$i; \
159        ln -sf ../$(REAL_GNU_TARGET_NAME)/bin/$$i $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-$$i; \
160        ln -sf $(REAL_GNU_TARGET_NAME)-$$i $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-$$i; \
161    done
162    touch -c $@
163
164$(TARGET_SPECIFIC_ROOT_DIR)/lib/libc.so.0: $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libc.a
165    $(MAKE1) -C $(UCLIBC_DIR) \
166        $(UCLIBC_COMMON_BUILD_FLAGS) \
167        PREFIX="$(FREETZ_BASE_DIR)/$(TARGET_SPECIFIC_ROOT_DIR)" \
168        DEVEL_PREFIX=/usr/ \
169        RUNTIME_PREFIX=/ \
170        install_runtime
171    touch -c $@
172else
173UCLIBC_PREREQ=$(TARGET_CROSS_COMPILER)
174$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libc.a: $(TARGET_CROSS_COMPILER)
175    touch -c $@
176
177$(TARGET_SPECIFIC_ROOT_DIR)/lib/libc.so.0: $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libc.a
178    @$(RM) -r $(TARGET_SPECIFIC_ROOT_DIR)/lib
179    @mkdir -p $(TARGET_SPECIFIC_ROOT_DIR)/lib
180    for i in $(UCLIBC_FILES); do \
181        cp -a $(TARGET_TOOLCHAIN_STAGING_DIR)/lib/$$i $(TARGET_SPECIFIC_ROOT_DIR)/lib/$$i; \
182    done
183    ln -sf libuClibc-$(UCLIBC_VERSION).so $(TARGET_SPECIFIC_ROOT_DIR)/lib/libc.so
184    touch -c $@
185endif
186
187uclibc-configured: kernel-configured $(UCLIBC_DIR)/.configured
188
189uclibc: $(UCLIBC_PREREQ) $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libc.a $(TARGET_SPECIFIC_ROOT_DIR)/lib/libc.so.0
190
191uclibc-configured-source: uclibc-source
192
193uclibc-clean:
194    -$(MAKE1) -C $(UCLIBC_DIR) clean
195    $(RM) $(UCLIBC_DIR)/.config
196
197uclibc-dirclean:
198    $(RM) -r $(UCLIBC_DIR)
199
200.PHONY: uclibc-configured uclibc
201
202#############################################################
203#
204# uClibc for the target
205#
206#############################################################
207
208$(TARGET_UTILS_DIR)/usr/lib/libc.a: $(TARGET_TOOLCHAIN_STAGING_DIR)/usr/lib/libc.a
209    $(MAKE1) -C $(UCLIBC_DIR) \
210        $(UCLIBC_COMMON_BUILD_FLAGS) \
211        PREFIX=$(TARGET_UTILS_DIR) \
212        DEVEL_PREFIX=/usr/ \
213        RUNTIME_PREFIX=/ \
214        RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=/lib/ \
215        install_dev
216    # create two additional symlinks, required because libc.so is not really
217    # a shared lib, but a GNU ld script referencing the libs below
218    for f in libc.so.0 ld-uClibc.so.0; do \
219        ln -fs /lib/$$f $(TARGET_UTILS_DIR)/usr/lib/; \
220    done
221    $(call COPY_KERNEL_HEADERS,$(UCLIBC_KERNEL_HEADERS_DIR),$(TARGET_UTILS_DIR)/usr)
222    $(call REMOVE_DOC_NLS_DIRS,$(TARGET_UTILS_DIR))
223    touch -c $@
224
225uclibc_target: gcc uclibc $(TARGET_UTILS_DIR)/usr/lib/libc.a
226
227uclibc_target-clean: uclibc_target-dirclean
228    $(RM) $(TARGET_UTILS_DIR)/lib/libc.a
229
230uclibc_target-dirclean:
231    $(RM) -r $(TARGET_UTILS_DIR)/usr/include
Hinweis: Hilfe zum Repository-Browser finden Sie in TracBrowser.