3 # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
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 \
15 include $(top_builddir)Rules.mak
17 ifeq ($(HAVE_DOT_CONFIG),y)
21 # In this section, we need .config
24 include $(top_srcdir)ldso/ldso/Makefile.in
25 include $(top_srcdir)libc/Makefile.in
26 include $(top_srcdir)ldso/libdl/Makefile.in
27 include $(top_srcdir)libcrypt/Makefile.in
28 include $(top_srcdir)libintl/Makefile.in
29 include $(top_srcdir)libm/Makefile.in
30 include $(top_srcdir)libnsl/Makefile.in
31 include $(top_srcdir)libresolv/Makefile.in
32 include $(top_srcdir)librt/Makefile.in
33 include $(top_srcdir)libutil/Makefile.in
34 include $(top_srcdir)libpthread/Makefile.in
36 include/bits/uClibc_config.h: .config
38 $(INSTALL) -d include/bits
39 @if [ ! -x extra/config/conf ] ; then \
40 $(MAKE) -C extra/config conf; \
42 @extra/config/conf -o $(top_srcdir)extra/Configs/Config.in
44 # For the moment, we have to keep re-running this target
45 # because the fix includes scripts rely on pre-processers
46 # in order to generate the headers correctly :(. That
47 # means we can't use the $(HOSTCC) in order to get the
49 ifeq ($(ARCH_HAS_MMU),y)
50 export header_extra_args =
52 export header_extra_args = -n
54 headers: include/bits/sysnum.h
56 include/bits/sysnum.h: include/bits/uClibc_config.h
59 $(top_srcdir)extra/scripts/fix_includes.sh \
60 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
62 if [ -f libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h ] ; then \
63 $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h include/ ; \
65 $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \
67 $(LN) -fs ../libc/sysdeps/linux/common/dl-osinfo.h include/
70 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
73 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
74 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
80 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
83 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
84 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
88 @cd $(top_builddir); \
91 top_builddir=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
92 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
93 $(RM) include/bits/sysnum.h.new; \
95 $(RM) include/bits/sysnum.h; \
96 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
99 # Command used to download source code
100 WGET:=wget --passive-ftp
102 LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
105 ifeq ($(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA),y)
106 (cd $(top_builddir)extra/locale; \
107 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
108 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
111 ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
112 (cd $(top_builddir)extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
113 $(MAKE) -C $(top_srcdir)extra/locale pregen
116 install: install_runtime install_dev
119 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
121 # Installs header files.
123 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
124 if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
125 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
129 tar -chf - include --exclude .svn $$extra_exclude \
130 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
131 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ssp-internal.h
132 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
133 ifneq ($(UCLIBC_HAS_FLOATS),y)
134 # Remove floating point related headers since float support is disabled.
135 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
136 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
137 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
138 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
139 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
140 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
142 ifneq ($(UCLIBC_HAS_WCHAR),y)
143 # Remove wide char headers since wide char support is disabled.
144 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
145 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
147 ifneq ($(UCLIBC_HAS_LOCALE),y)
148 # Remove iconv header since locale support is disabled.
149 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
151 ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
152 # Remove printf header since custom print specifier support is disabled.
153 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
155 ifneq ($(UCLIBC_HAS_XLOCALE),y)
156 # Remove xlocale header since extended locale support is disabled.
157 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
159 ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
160 # Remove libintl header since gettext support is disabled.
161 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
163 ifneq ($(UCLIBC_HAS_REGEX),y)
164 # Remove regex headers since regex support is disabled.
165 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
166 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
168 ifneq ($(UCLIBC_HAS_WORDEXP),y)
169 # Remove wordexp header since wordexp support is disabled.
170 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
172 ifneq ($(UCLIBC_HAS_FTW),y)
173 # Remove ftw header since ftw support is disabled.
174 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
176 ifneq ($(UCLIBC_HAS_GLOB),y)
177 # Remove glob header since glob support is disabled.
178 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
180 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
181 # Remove getopt header since gnu getopt support is disabled.
182 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
184 ifneq ($(HAS_SHADOW),y)
185 # Remove shadow header since shadow password support is disabled.
186 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
188 ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
189 # Remove thread_db header since thread debug support is disabled.
190 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
192 ifneq ($(UCLIBC_HAS_THREADS),y)
193 # Remove pthread headers since thread support is disabled.
194 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
195 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
196 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
198 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
199 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
201 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
203 # Installs development library links.
204 install_dev: install_headers
205 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
206 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
207 ifeq ($(HAVE_SHARED),y)
208 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
209 sed -e 's/lib\///'` ; do \
210 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
211 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
213 if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
214 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
215 sed -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
216 -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
217 -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
218 $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
220 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
221 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
222 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
225 # # If we build shared libraries then the static libs are PIC...
226 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
227 if [ -d lib ] ; then \
228 for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
229 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
230 | sed -e 's/\.a$$/_pic.a/'`; \
236 # Installs run-time libraries
238 ifeq ($(HAVE_SHARED),y)
239 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
240 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
241 $(PREFIX)$(RUNTIME_PREFIX)lib
242 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
243 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
246 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
247 $(PREFIX)$(RUNTIME_PREFIX)lib; \
252 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
254 # Installs helper applications, such as 'ldd' and 'ldconfig'
256 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
258 else # ifeq ($(HAVE_DOT_CONFIG),y)
263 @echo "Need to make a config file first, run: make menuconfig"
266 endif # ifeq ($(HAVE_DOT_CONFIG),y)
269 # ---------------------------------------------------------------------------
271 $(MAKE) -C extra/config conf
274 $(MAKE) -C extra/config ncurses mconf
276 menuconfig: extra/config/mconf
277 $(RM) -r include/bits
278 $(INSTALL) -d include/bits
279 @./extra/config/mconf extra/Configs/Config.in
282 config: extra/config/conf
283 $(RM) -r include/bits
284 $(INSTALL) -d include/bits
285 @./extra/config/conf extra/Configs/Config.in
287 oldconfig: extra/config/conf
288 $(RM) -r include/bits
289 $(INSTALL) -d include/bits
290 @./extra/config/conf -o extra/Configs/Config.in
292 randconfig: extra/config/conf
293 $(RM) -r include/bits
294 $(INSTALL) -d include/bits
295 @./extra/config/conf -r extra/Configs/Config.in
297 allyesconfig: extra/config/conf
298 $(RM) -r include/bits
299 $(INSTALL) -d include/bits
300 @./extra/config/conf -y extra/Configs/Config.in
301 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
302 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
303 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
304 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
305 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
306 @./extra/config/conf -o extra/Configs/Config.in
308 allnoconfig: extra/config/conf
309 $(RM) -r include/bits
310 $(INSTALL) -d include/bits
311 @./extra/config/conf -n extra/Configs/Config.in
313 defconfig: extra/config/conf
314 $(RM) -r include/bits
315 $(INSTALL) -d include/bits
316 @./extra/config/conf -d extra/Configs/Config.in
319 @$(RM) -r lib include/bits
320 $(RM) lib*/*.a ldso/*/*.a libpthread/*/*.a
321 $(RM) include/fpu_control.h include/dl-osinfo.h
322 $(MAKE) -C extra/locale clean
323 $(MAKE) headers_clean-y
324 $(MAKE) -C test clean
325 $(MAKE) -C utils clean
327 for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
328 $(RM) include/sys/$$i; \
330 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
331 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
332 $(RM) include/sys/$$i; \
335 @$(RM) include/linux include/asm*
336 -find . \( -name \*.o -o -name \*.os -o -name \*.oS \) -exec $(RM) {} \;
339 -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
340 $(RM) .config .config.old .config.cmd
341 $(RM) extra/locale/*.txt
342 $(MAKE) -C extra clean
346 $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.gz
347 svn -q export . ../uClibc-$(VERSION)
348 tar czf ../uClibc-$(VERSION).tar.gz -C .. uClibc-$(VERSION)
349 du -b ../uClibc-$(VERSION).tar.gz