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/Makefile.in
25 include $(top_srcdir)libcrypt/Makefile.in
26 include $(top_srcdir)libintl/Makefile.in
27 include $(top_srcdir)libm/Makefile.in
28 include $(top_srcdir)libnsl/Makefile.in
29 include $(top_srcdir)libresolv/Makefile.in
30 include $(top_srcdir)librt/Makefile.in
31 include $(top_srcdir)libutil/Makefile.in
32 include $(top_srcdir)libpthread/Makefile.in
33 include $(top_srcdir)extra/locale/Makefile.in
35 # last included to catch all the objects added by others (locales/threads)
36 include $(top_srcdir)libc/Makefile.in
38 include/bits/uClibc_config.h: extra/config/conf .config
39 $(INSTALL) -d $(dir $@)
40 @$< -o $(top_srcdir)extra/Configs/Config.in
42 # For the moment, we have to keep re-running this target
43 # because the fix includes scripts rely on pre-processers
44 # in order to generate the headers correctly :(. That
45 # means we can't use the $(HOSTCC) in order to get the
47 ifeq ($(ARCH_HAS_MMU),y)
48 export header_extra_args =
50 export header_extra_args = -n
52 headers: include/bits/uClibc_config.h
55 $(top_srcdir)extra/scripts/fix_includes.sh \
56 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
58 if [ -f libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h ] ; then \
59 $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h include/ ; \
61 $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \
63 for f in dl-osinfo.h hp-timing.h ; do \
64 $(LN) -fs ../libc/sysdeps/linux/common/$$f include/ ; \
68 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
71 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
72 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
78 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
81 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
82 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
86 @cd $(top_builddir); \
89 top_builddir=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
90 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
91 $(RM) include/bits/sysnum.h.new; \
93 $(RM) include/bits/sysnum.h; \
94 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
99 install: install_runtime install_dev
102 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
104 # Installs header files.
106 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
107 if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
108 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
112 tar -chf - --exclude .svn $$extra_exclude include \
113 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
114 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
115 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_uintmaxtostr.h
116 ifneq ($(UCLIBC_HAS_FLOATS),y)
117 # Remove floating point related headers since float support is disabled.
118 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
119 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
120 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
121 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
122 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
123 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
125 ifneq ($(UCLIBC_HAS_WCHAR),y)
126 # Remove wide char headers since wide char support is disabled.
127 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
128 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
130 ifneq ($(UCLIBC_HAS_LOCALE),y)
131 # Remove iconv header since locale support is disabled.
132 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
134 ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
135 # Remove printf header since custom print specifier support is disabled.
136 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
138 ifneq ($(UCLIBC_HAS_XLOCALE),y)
139 # Remove xlocale header since extended locale support is disabled.
140 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
142 ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
143 # Remove libintl header since gettext support is disabled.
144 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
146 ifneq ($(UCLIBC_HAS_REGEX),y)
147 # Remove regex headers since regex support is disabled.
148 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
149 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
151 ifneq ($(UCLIBC_HAS_WORDEXP),y)
152 # Remove wordexp header since wordexp support is disabled.
153 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
155 ifneq ($(UCLIBC_HAS_FTW),y)
156 # Remove ftw header since ftw support is disabled.
157 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
159 ifneq ($(UCLIBC_HAS_GLOB),y)
160 # Remove glob header since glob support is disabled.
161 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
163 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
164 # Remove getopt header since gnu getopt support is disabled.
165 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
167 ifneq ($(HAS_SHADOW),y)
168 # Remove shadow header since shadow password support is disabled.
169 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
171 ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
172 # Remove thread_db header since thread debug support is disabled.
173 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
175 ifneq ($(UCLIBC_HAS_THREADS),y)
176 # Remove pthread headers since thread support is disabled.
177 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
178 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
179 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
181 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
182 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
184 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
186 # Installs development library links.
187 install_dev: install_headers
188 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
189 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
190 ifeq ($(HAVE_SHARED),y)
191 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
192 sed -e 's/lib\///'` ; do \
193 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
194 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
196 if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
197 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
198 sed -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
199 -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
200 -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
201 $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
203 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
204 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
205 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
208 # # If we build shared libraries then the static libs are PIC...
209 # # Make _pic.a symlinks to make mklibs.py and similar tools happy.
210 if [ -d lib ] ; then \
211 for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
212 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
213 | sed -e 's/\.a$$/_pic.a/'`; \
219 # Installs run-time libraries
221 ifeq ($(HAVE_SHARED),y)
222 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
223 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
224 $(PREFIX)$(RUNTIME_PREFIX)lib
225 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
226 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
229 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
230 $(PREFIX)$(RUNTIME_PREFIX)lib; \
235 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
237 # Installs helper applications, such as 'ldd' and 'ldconfig'
239 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils utils_install
241 else # ifeq ($(HAVE_DOT_CONFIG),y)
246 @echo "Need to make a config file first, run: make menuconfig"
249 endif # ifeq ($(HAVE_DOT_CONFIG),y)
252 # ---------------------------------------------------------------------------
253 extra/config/conf extra/config/mconf:
254 $(MAKE) -C extra/config $(notdir $@)
256 menuconfig: extra/config/mconf
257 $(RM) -r include/bits
258 $(INSTALL) -d include/bits
259 @./extra/config/mconf extra/Configs/Config.in
262 config: extra/config/conf
263 $(RM) -r include/bits
264 $(INSTALL) -d include/bits
265 @./extra/config/conf extra/Configs/Config.in
267 oldconfig: extra/config/conf
268 $(RM) -r include/bits
269 $(INSTALL) -d include/bits
270 @./extra/config/conf -o extra/Configs/Config.in
272 randconfig: extra/config/conf
273 $(RM) -r include/bits
274 $(INSTALL) -d include/bits
275 @./extra/config/conf -r extra/Configs/Config.in
277 allyesconfig: extra/config/conf
278 $(RM) -r include/bits
279 $(INSTALL) -d include/bits
280 @./extra/config/conf -y extra/Configs/Config.in
281 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
282 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
283 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
284 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
285 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
286 @./extra/config/conf -o extra/Configs/Config.in
288 allnoconfig: extra/config/conf
289 $(RM) -r include/bits
290 $(INSTALL) -d include/bits
291 @./extra/config/conf -n extra/Configs/Config.in
293 defconfig: extra/config/conf
294 $(RM) -r include/bits
295 $(INSTALL) -d include/bits
296 @./extra/config/conf -d extra/Configs/Config.in
299 @$(RM) -r lib include/bits
300 $(RM) lib*/*.a ldso/*/*.a libpthread/*/*.a
301 $(RM) include/fpu_control.h include/dl-osinfo.h
302 $(MAKE) -C extra/locale locale_clean
303 $(MAKE) headers_clean-y
304 $(MAKE) -C test clean
305 $(MAKE) -C utils utils_clean
307 for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
308 $(RM) include/sys/$$i; \
310 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
311 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
312 $(RM) include/sys/$$i; \
315 @$(RM) include/linux include/asm*
316 -find . \( -name \*.o -o -name \*.os -o -name \*.oS \) -exec $(RM) {} \;
319 -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
320 $(RM) .config .config.old .config.cmd
321 $(RM) extra/locale/*.tgz
322 $(MAKE) -C extra/config config_clean
326 $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.gz
327 svn -q export . ../uClibc-$(VERSION)
328 tar czf ../uClibc-$(VERSION).tar.gz -C .. uClibc-$(VERSION)
329 du -b ../uClibc-$(VERSION).tar.gz