5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 #--------------------------------------------------------------
9 # You shouldn't need to mess with anything beyond this point...
10 #--------------------------------------------------------------
11 noconfig_targets := menuconfig config oldconfig randconfig \
12 defconfig allyesconfig allnoconfig clean distclean \
19 include $(top_builddir)Rules.mak
21 # need to have libc.so built, before we can build the others
22 ifeq ($(HAVE_SHARED),y)
24 DIRS = ldso libcrypt libresolv libnsl libutil librt
27 DIRS = libcrypt libresolv libnsl libutil librt
29 ifeq ($(UCLIBC_HAS_FLOATS),y)
32 ifeq ($(UCLIBC_HAS_THREADS),y)
35 ifeq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
39 ifeq ($(HAVE_DOT_CONFIG),y)
43 # In this section, we need .config
48 $(SECHO) Finally finished compiling ...
51 include/bits/uClibc_config.h: .config
52 @if [ ! -x $(top_builddir)extra/config/conf ] ; then \
53 $(MAKE) -C $(top_builddir)extra/config conf; \
55 $(RM) -r $(top_builddir)include/bits
56 $(INSTALL) -d $(top_builddir)include/bits
57 @$(top_builddir)extra/config/conf -o $(top_srcdir)extra/Configs/Config.in
59 # For the moment, we have to keep re-running this target
60 # because the fix includes scripts rely on pre-processers
61 # in order to generate the headers correctly :(. That
62 # means we can't use the $(HOSTCC) in order to get the
64 ifeq ($(ARCH_HAS_MMU),y)
65 export header_extra_args =
67 export header_extra_args = -n
69 headers: $(top_srcdir)include/bits/uClibc_config.h
71 $(top_srcdir)extra/scripts/fix_includes.sh \
72 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
74 @cd $(top_builddir)include/bits; \
76 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
79 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
80 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
84 @cd $(top_builddir)include/sys; \
86 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
89 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
90 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
94 @cd $(top_builddir); \
97 TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
98 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
99 $(RM) include/bits/sysnum.h.new; \
101 $(RM) include/bits/sysnum.h; \
102 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
104 ifeq ($(UCLIBC_HAS_THREADS),y)
105 $(MAKE) -C libpthread threads_headers
107 $(MAKE) -C libc/sysdeps/linux/common common_headers
108 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) arch_headers
110 # Command used to download source code
111 WGET:=wget --passive-ftp
113 LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
116 ifeq ($(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA),y)
117 (cd $(top_builddir)extra/locale; \
118 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
119 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
122 ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
123 (cd $(top_builddir)extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
124 $(MAKE) -C $(top_srcdir)extra/locale pregen
127 pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS))
128 $(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen
129 $(MAKE) -C $(patsubst _pre_dir_%, %, $@)
131 subdirs: $(patsubst %, _dir_%, $(DIRS))
132 $(patsubst %, _dir_%, $(DIRS)): pre_subdirs
133 $(MAKE) -C $(patsubst _dir_%, %, $@)
135 install: install_runtime install_dev finished2
138 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
140 # Installs header files.
142 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
143 if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
144 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
148 tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
149 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
150 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ssp-internal.h
151 ifneq ($(UCLIBC_HAS_FLOATS),y)
152 # Remove floating point related headers since float support is disabled.
153 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
154 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
155 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
156 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
157 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
158 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
160 ifneq ($(UCLIBC_HAS_WCHAR),y)
161 # Remove wide char headers since wide char support is disabled.
162 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
163 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
165 ifneq ($(UCLIBC_HAS_LOCALE),y)
166 # Remove iconv header since locale support is disabled.
167 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
169 ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
170 # Remove printf header since custom print specifier support is disabled.
171 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
173 ifneq ($(UCLIBC_HAS_XLOCALE),y)
174 # Remove xlocale header since extended locale support is disabled.
175 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
177 ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
178 # Remove libintl header since gettext support is disabled.
179 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
181 ifneq ($(UCLIBC_HAS_REGEX),y)
182 # Remove regex headers since regex support is disabled.
183 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
184 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
186 ifneq ($(UCLIBC_HAS_WORDEXP),y)
187 # Remove wordexp header since wordexp support is disabled.
188 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
190 ifneq ($(UCLIBC_HAS_FTW),y)
191 # Remove ftw header since ftw support is disabled.
192 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
194 ifneq ($(UCLIBC_HAS_GLOB),y)
195 # Remove glob header since glob support is disabled.
196 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
198 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
199 # Remove getopt header since gnu getopt support is disabled.
200 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
202 ifneq ($(HAS_SHADOW),y)
203 # Remove shadow header since shadow password support is disabled.
204 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
206 ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
207 # Remove thread_db header since thread debug support is disabled.
208 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
210 ifneq ($(UCLIBC_HAS_THREADS),y)
211 # Remove pthread headers since thread support is disabled.
212 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
213 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
214 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
216 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
217 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
219 -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r
220 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
222 # Installs development library links.
223 install_dev: install_headers
224 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
225 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
226 ifeq ($(HAVE_SHARED),y)
227 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
228 sed -e 's/lib\///'` ; do \
229 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
230 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
232 if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
233 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
234 sed -e '/^GROUP/d' $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
236 ifeq ($(COMPAT_ATEXIT),y)
237 if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
238 echo "GROUP ( $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) )" \
239 >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
242 if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
243 echo "GROUP ( $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) )" \
244 >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
247 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
248 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
249 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
251 # # If we build shared libraries then the static libs are PIC...
252 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
253 if [ -d lib ] ; then \
254 for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
255 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
256 | sed -e 's/\.a$$/_pic.a/'`; \
261 # Installs run-time libraries
263 ifeq ($(HAVE_SHARED),y)
264 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
265 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
266 $(PREFIX)$(RUNTIME_PREFIX)lib
267 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
268 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
271 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
272 $(PREFIX)$(RUNTIME_PREFIX)lib; \
277 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
279 # Installs helper applications, such as 'ldd' and 'ldconfig'
281 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
285 $(SECHO) Finished installing ...
288 else # ifeq ($(HAVE_DOT_CONFIG),y)
293 # ---------------------------------------------------------------------------
295 $(MAKE) -C extra/config conf
298 $(MAKE) -C extra/config ncurses mconf
300 menuconfig: extra/config/mconf
301 $(RM) -r include/bits
302 $(INSTALL) -d include/bits
303 @./extra/config/mconf extra/Configs/Config.in
306 config: extra/config/conf
307 $(RM) -r include/bits
308 $(INSTALL) -d include/bits
309 @./extra/config/conf extra/Configs/Config.in
311 oldconfig: extra/config/conf
312 $(RM) -r include/bits
313 $(INSTALL) -d include/bits
314 @./extra/config/conf -o extra/Configs/Config.in
316 randconfig: extra/config/conf
317 $(RM) -r include/bits
318 $(INSTALL) -d include/bits
319 @./extra/config/conf -r extra/Configs/Config.in
321 allyesconfig: extra/config/conf
322 $(RM) -r include/bits
323 $(INSTALL) -d include/bits
324 @./extra/config/conf -y extra/Configs/Config.in
325 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
326 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
327 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
328 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
329 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
330 @./extra/config/conf -o extra/Configs/Config.in
332 allnoconfig: extra/config/conf
333 $(RM) -r include/bits
334 $(INSTALL) -d include/bits
335 @./extra/config/conf -n extra/Configs/Config.in
337 defconfig: extra/config/conf
338 $(RM) -r include/bits
339 $(INSTALL) -d include/bits
340 @./extra/config/conf -d extra/Configs/Config.in
343 @$(RM) -r lib include/bits
344 $(RM) lib*/*.a ldso/*/*.a libpthread/*/*.a
345 $(RM) libc/misc/locale/locale_data.c
346 $(RM) libc/misc/internals/interp.c
347 $(RM) include/fpu_control.h
348 $(MAKE) -C extra/locale clean
349 $(MAKE) -C ldso ldso_headers_clean
350 $(MAKE) -C libpthread threads_headers_clean
351 $(MAKE) -C test clean
352 $(MAKE) -C utils clean
354 for i in `(cd $(top_builddir)libc/sysdeps/linux/common/sys; ls *.h)` ; do \
355 $(RM) include/sys/$$i; \
357 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
358 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
359 $(RM) include/sys/$$i; \
362 @$(RM) include/linux include/asm*
363 @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
364 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
366 -find . \( -name \*.o -o -name \*.os -o -name \*.oS \) -exec $(RM) {} \;
369 -find . \( -name core -o -name \*.orig -o -name \*~ -o -name .\#\* \) -exec $(RM) {} \;
370 $(RM) .config .config.old .config.cmd
371 $(RM) extra/locale/*.txt
372 $(MAKE) -C extra clean
376 $(RM) -r uClibc-$(VERSION); \
377 cp -dRf uClibc uClibc-$(VERSION); \
378 find uClibc-$(VERSION)/ -type f \
379 -name .\#* -exec $(RM) -r {} \; ; \
380 find uClibc-$(VERSION)/ -type d \
381 -name .svn -exec $(RM) -r {} \; ; \
383 tar -cvzf uClibc-$(VERSION).tar.gz uClibc-$(VERSION)/
385 endif # ifeq ($(HAVE_DOT_CONFIG),y)
387 include $(top_srcdir)Makerules
392 .PHONY: dummy subdirs release distclean clean config oldconfig menuconfig utils