OSDN Git Service

libdl.c: hide dl_cleanup
[uclinux-h8/uClibc.git] / Makefile.in
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
4 #
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 #
7
8 #--------------------------------------------------------------
9 # You shouldn't need to mess with anything beyond this point...
10 #--------------------------------------------------------------
11 clean_targets := clean realclean distclean \
12         objclean-y headers_clean-y CLEAN_utils
13 noconfig_targets := menuconfig config oldconfig silentoldconfig randconfig \
14         defconfig allyesconfig allnoconfig \
15         release dist tags help
16
17 include $(top_srcdir)Rules.mak
18 sub_headers := headers
19 ifndef KCONFIG_CONFIG
20 KCONFIG_CONFIG := $(top_builddir).config
21 endif
22 export KCONFIG_CONFIG
23
24 ifeq ($(HAVE_DOT_CONFIG),y)
25
26 all: pregen libs
27 libs: pregen
28
29 # In this section, we need .config
30 -include $(top_builddir).config.cmd
31
32 else # ifeq ($(HAVE_DOT_CONFIG),y)
33
34 all: menuconfig
35
36 headers:
37         @echo "Need to make a config file first, run: make menuconfig"
38         @false
39
40 endif # ifeq ($(HAVE_DOT_CONFIG),y)
41
42 include $(top_srcdir)ldso/Makefile.in
43 include $(top_srcdir)libcrypt/Makefile.in
44 include $(top_srcdir)libintl/Makefile.in
45 include $(top_srcdir)libm/Makefile.in
46 include $(top_srcdir)libnsl/Makefile.in
47 include $(top_srcdir)libresolv/Makefile.in
48 include $(top_srcdir)libutil/Makefile.in
49 include $(top_srcdir)libpthread/Makefile.in
50 include $(top_srcdir)librt/Makefile.in
51 include $(top_srcdir)libubacktrace/Makefile.in
52 include $(top_srcdir)extra/locale/Makefile.in
53
54 # last included to catch all the objects added by others (locales/threads)
55 include $(top_srcdir)libc/Makefile.in
56
57 conf := $(top_builddir)extra/config/conf
58 mconf := $(top_builddir)extra/config/mconf
59
60 ifeq ($(HAVE_DOT_CONFIG),y)
61 # If the .config changes then we have to make sure that our includes are
62 # updated properly. This would normally work by saying that the headers
63 # have uClibc_config.h as prerequisite but since we _symlink_ the headers
64 # and do not (?) want to rely on 'make -L' we better update them right here,
65 # on spot to save us from alot of hazzle.
66 $(top_builddir)include/bits/uClibc_config.h: $(conf) $(KCONFIG_CONFIG) $(top_srcdir)extra/scripts/conf-header.sh | $(top_builddir)include/bits $(top_builddir)include/config
67         @$(disp_gen)
68         $(Q)@$< -s $(top_srcdir)extra/Configs/Config.in
69         $(Q)$(top_srcdir)extra/scripts/conf-header.sh $(KCONFIG_CONFIG) > $@
70         $(Q)$(MAKE) headers-y
71
72 # The above doesn't work for threads, though. Just using check-symlinks for now.
73 # XXX: FIXME: this is ugly
74 MAKEFLAGS += -L
75
76 $(top_builddir)include/config/linuxthreads/old.h $(top_builddir)include/config/linuxthreads/new.h:
77         @true
78
79 # For the moment, we have to keep re-running this target
80 # because the fix includes scripts rely on pre-processers
81 # in order to generate the headers correctly :(.  That
82 # means we can't use the $(HOSTCC) in order to get the
83 # correct output.
84 ifeq ($(ARCH_USE_MMU),y)
85 export header_extra_args =
86 else
87 export header_extra_args = -n
88 endif
89 HEADERS_BITS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/bits/*.h))
90 HEADERS_BITS_ARCH   := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h))
91 HEADERS_BITS_SUBARCH :=
92 ifneq ($(TARGET_SUBARCH),)
93 HEADERS_BITS_SUBARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/*.h))
94 endif
95 ifneq ($(HEADERS_BITS_PTHREAD),)
96 HEADERS_BITS_ARCH   := $(filter-out $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_ARCH))
97 HEADERS_BITS_SUBARCH:= $(filter-out $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_SUBARCH))
98 endif
99 HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_ARCH) $(HEADERS_BITS_SUBARCH) $(HEADERS_BITS_PTHREAD),$(HEADERS_BITS_COMMON))
100
101 HEADERS_SYS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/sys/*.h))
102 HEADERS_SYS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h))
103 HEADERS_SYS_COMMON := $(filter-out $(HEADERS_SYS_ARCH),$(HEADERS_SYS_COMMON))
104
105 ALL_HEADERS_COMMON       := $(top_builddir)include/fpu_control.h \
106                                 $(top_builddir)include/jmpbuf-offsets.h \
107                                 $(top_builddir)include/jmpbuf-unwind.h \
108                                 $(top_builddir)include/dl-osinfo.h \
109                                 $(top_builddir)include/hp-timing.h
110 ALL_HEADERS_BITS_COMMON  := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_COMMON))
111 ALL_HEADERS_BITS_ARCH    := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_ARCH))
112 ifneq ($(TARGET_SUBARCH),)
113 ALL_HEADERS_BITS_SUBARCH := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_SUBARCH))
114 else
115 ALL_HEADERS_BITS_SUBARCH :=
116 endif
117 ALL_HEADERS_SYS_COMMON   := $(addprefix $(top_builddir)include/sys/,$(HEADERS_SYS_COMMON))
118 ALL_HEADERS_SYS_ARCH     := $(addprefix $(top_builddir)include/sys/,$(HEADERS_SYS_ARCH))
119
120 target-headers-sysdep := \
121         $(ALL_HEADERS_COMMON) \
122         $(ALL_HEADERS_BITS_COMMON) \
123         $(ALL_HEADERS_BITS_ARCH) \
124         $(ALL_HEADERS_BITS_SUBARCH) \
125         $(ALL_HEADERS_SYS_COMMON) \
126         $(ALL_HEADERS_SYS_ARCH) \
127         $(ALL_HEADERS_BITS_PTHREAD)
128
129 $(top_builddir)include/fpu_control.h $(top_builddir)include/jmpbuf-offsets.h $(top_builddir)include/jmpbuf-unwind.h:
130         @$(disp_ln)
131         $(Q)[ -r $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) ] && \
132                 $(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(@F) $@ || \
133                 $(LN) -fs $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@
134
135 $(top_builddir)include/dl-osinfo.h $(top_builddir)include/hp-timing.h:
136         $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/$(@F) $@
137
138 $(ALL_HEADERS_BITS_COMMON):
139         $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/bits/$(@F) $@
140
141 $(ALL_HEADERS_BITS_ARCH):
142         $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(@F) $@
143
144 ifneq ($(TARGET_SUBARCH),)
145 $(ALL_HEADERS_BITS_SUBARCH):
146         $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/$(@F) $@
147 endif
148
149 ifneq ($(strip $(ALL_HEADERS_SYS_COMMON)),)
150 $(ALL_HEADERS_SYS_COMMON):
151         $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/common/sys/$(@F) $@
152 endif
153
154 ifneq ($(strip $(ALL_HEADERS_SYS_ARCH)),)
155 $(ALL_HEADERS_SYS_ARCH):
156         $(do_ln) $(call rel_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/sys/$(@F) $@
157 endif
158
159 $(target-headers-sysdep) $(pregen-headers-y): | $(top_builddir)include/bits $(top_builddir)include/sys
160
161 HEADERCLEAN_common:
162         $(do_rm) $(ALL_HEADERS_COMMON)
163 headers_clean-y += HEADERCLEAN_common
164
165 # The headers. Arch specific headers are specified via ARCH_HEADERS in
166 # libc/sysdeps/linux/$(TARGET_ARCH)/Makefile.arch which appends those via
167 # libc/sysdeps/linux/Makefile.commonarch to headers-y
168 headers-y += $(target-headers-sysdep)
169
170 headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
171 subdirs: $(addprefix $(top_builddir),$(subdirs))
172 pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y)
173 pregen: headers pregen-headers
174         $(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
175
176 $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits
177         @$(disp_gen)
178         $(Q)set -e; \
179         tmp=`mktemp $(top_builddir)include/bits/sysnum.h.XXXXXX 2>/dev/null || true`; \
180         [ -z "$$tmp" ] && tmp='$(top_builddir)include/bits/sysnum.h.new'; \
181         KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir="$(top_builddir)" CC="$(CC) $(CPU_CFLAGS)" $(SHELL) $< > $$tmp; \
182         if cmp $(top_builddir)include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
183                 $(RM) $$tmp; \
184         else \
185                 mv -f $$tmp $(top_builddir)include/bits/sysnum.h; \
186         fi
187         @# Ugly linux specific hack..
188         $(Q)if grep -q __NR_ $@; then true; else \
189                 rm -f $@; \
190                 echo "ERROR: Could not generate syscalls."; \
191                 echo "Make sure that you have proper kernel headers."; \
192                 echo "Your .config in KERNEL_HEADERS=\"\" was set to:"; \
193                 echo "${KERNEL_HEADERS}"; \
194                 exit 1; \
195         fi
196
197 .PHONY: $(LOCAL_INSTALL_PATH)
198 $(LOCAL_INSTALL_PATH):
199         $(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX=/ \
200         DEVEL_PREFIX=/usr/ \
201         HOSTCC="$(HOSTCC)" \
202         install
203
204 install: install_runtime install_dev
205
206
207 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)$(MULTILIB_DIR) $(RUNTIME_PREFIX)$(MULTILIB_DIR))
208
209 startfiles: $(crt-y)
210
211 $(top_builddir)extra/scripts/unifdef: |$(top_builddir)extra/scripts
212 $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
213         $(hcompile.u)
214
215 # Installs header files.
216 # a "y" here means the feature is enabled and so we should *not* rm it.
217 # if the option expands to nothing though, we can punt the headers.
218 HEADERS_RM- := \
219         internal \
220         dl-osinfo.h \
221         jmpbuf-offsets.h \
222         jmpbuf-unwind.h \
223         hp-timing.h \
224         _lfs_64.h \
225         bits/uClibc_arch_features.h \
226         bits/kernel_sigaction.h \
227         bits/kernel_stat.h \
228         bits/kernel_types.h \
229         bits/libc-lock.h \
230         bits/stdio-lock.h \
231         bits/syscalls.h \
232         bits/syscalls-common.h \
233         bits/uClibc_fpmax.h \
234         bits/uClibc_pthread.h \
235         bits/uClibc_uintmaxtostr.h \
236         bits/uClibc_uwchar.h \
237         bits/uClibc_va_copy.h \
238         bits/sigcontextinfo.h \
239         bits/stackinfo.h \
240         tls.h \
241         rpc/des_crypt.h \
242         rpc/key_prot.h \
243         rpc/rpc_des.h
244 ifeq ($(UCLIBC_STRICT_HEADERS),y)
245 HEADERS_RM- += sgtty.h
246 endif
247 HEADERS_RM-$(HAVE_SHARED)                    += dlfcn.h bits/dlfcn.h
248 HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT)         += thread_db.h
249 HEADERS_RM-$(UCLIBC_HAS_BSD_ERR)             += err.h
250 HEADERS_RM-$(UCLIBC_HAS_CRYPT)               += crypt.h
251 HEADERS_RM-$(UCLIBC_HAS_EPOLL)               += sys/epoll.h
252 HEADERS_RM-$(UCLIBC_HAS_FENV)                += fenv.h bits/fenv.h bits/fenvinline.h
253 HEADERS_RM-$(UCLIBC_HAS_FLOATS)              += complex.h fpu_control.h ieee754.h \
254         math.h \
255         tgmath.h \
256         bits/math*.h
257 HEADERS_RM-$(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW))  += ftw.h
258 HEADERS_RM-$(UCLIBC_HAS_FTS)                 += fts.h
259 HEADERS_RM-$(UCLIBC_HAS_GETTEXT_AWARENESS)   += libintl.h
260 HEADERS_RM-$(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF) += printf.h
261 HEADERS_RM-$(UCLIBC_HAS_GLOB)                += glob.h
262 HEADERS_RM-$(UCLIBC_HAS_GNU_ERROR)           += error.h
263 HEADERS_RM-$(UCLIBC_HAS_GNU_GETOPT)$(UCLIBC_HAS_GETOPT_LONG) += getopt.h
264 HEADERS_RM-$(UCLIBC_HAS_IPV6)                += netinet/ip6.h netinet/icmp6.h
265 HEADERS_RM-$(UCLIBC_HAS_BACKTRACE)           += execinfo.h
266 HEADERS_RM-$(UCLIBC_HAS_LOCALE)              += iconv.h bits/uClibc_ctype.h
267 HEADERS_RM-$(UCLIBC_HAS_PTY)                 += pty.h
268 HEADERS_RM-$(UCLIBC_HAS_REALTIME)            += mqueue.h bits/mqueue.h sched.h \
269         bits/sched.h \
270         semaphore.h
271 HEADERS_RM-$(UCLIBC_HAS_REGEX)               += regex.h regexp.h
272 HEADERS_RM-$(UCLIBC_HAS_RPC)                 += rpc
273 HEADERS_RM-$(UCLIBC_HAS_SHADOW)              += shadow.h
274 HEADERS_RM-$(UCLIBC_HAS_SOCKET)              += sys/socket.h bits/socket.h sys/socketvar.h
275 HEADERS_RM-$(UCLIBC_HAS_SYSLOG)              += syslog.h sys/syslog.h bits/syslog*.h
276 HEADERS_RM-$(UCLIBC_HAS_THREADS)             += *thread*.h semaphore.h \
277         bits/*thread*.h \
278         bits/initspin.h
279 HEADERS_RM-$(UCLIBC_HAS_THREADS_NATIVE)      += atomic.h bits/atomic.h
280 HEADERS_RM-$(UCLIBC_HAS_UTMPX)               += bits/utmpx.h utmpx.h
281 HEADERS_RM-$(UCLIBC_HAS_WCHAR)               += wchar.h wctype.h
282 HEADERS_RM-$(UCLIBC_HAS_WORDEXP)             += wordexp.h
283 HEADERS_RM-$(UCLIBC_HAS_XATTR)               += sys/xattr.h
284 HEADERS_RM-$(UCLIBC_HAS_XLOCALE)             += xlocale.h
285 HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC)          += sys/eventfd.h sys/fsuid.h \
286         bits/inotify.h \
287         sys/inotify.h \
288         sys/kdaemon.h \
289         sys/perm.h \
290         sys/personality.h \
291         sys/prctl.h \
292         sys/reboot.h \
293         sys/sendfile.h \
294         bits/signalfd.h \
295         sys/signalfd.h \
296         bits/statfs.h \
297         sys/statfs.h \
298         sys/swap.h \
299         sys/sysctl.h \
300         sys/sysinfo.h \
301         bits/timerfd.h \
302         sys/timerfd.h \
303         sys/vfs.h
304 HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG)   += ifaddrs.h
305 HEADERS_RM-$(UCLIBC_SV4_DEPRECATED)          += ustat.h sys/ustat.h bits/ustat.h
306 HEADERS_RM-$(UCLIBC_SUSV3_LEGACY)            += sys/timeb.h regexp.h
307 HEADERS_RM-$(UCLIBC_SUSV4_LEGACY)            += utime.h ucontext.h
308 HEADERS_RM-$(UCLIBC_HAS_ADVANCED_REALTIME)   += spawn.h
309
310 ifneq ($(findstring install,$(MAKECMDGOALS)),)
311 $(addprefix $(PREFIX)$(DEVEL_PREFIX),include $(MULTILIB_DIR)):
312         $(do_mkdir)
313 # avoid warning about duplicate targets in rule or overrides
314 ifneq ($(abspath $(RUNTIME_PREFIX)$(MULTILIB_DIR)),$(abspath $(DEVEL_PREFIX)$(MULTILIB_DIR)))
315 $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR):
316         $(do_mkdir)
317 endif
318 endif
319 install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)include
320         @$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)include")
321         $(Q)top_builddir=$(top_builddir) \
322         $(top_srcdir)extra/scripts/install_headers.sh \
323         include $(PREFIX)$(DEVEL_PREFIX)include
324 ifneq ($(O),) # only run this step in O is set i.e. make O=/my/builddir/ ..
325         @$(call disp_install,"$(top_builddir)/include -> $(PREFIX)$(DEVEL_PREFIX)include")
326         $(Q)top_builddir=$(top_builddir) \
327         $(top_srcdir)extra/scripts/install_headers.sh \
328         $(top_builddir)/include $(PREFIX)$(DEVEL_PREFIX)include
329 endif
330         $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -r $(HEADERS_RM-)
331 ifeq ($(UCLIBC_HAS_WCHAR),)
332         $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && mv -f wchar-stub.h wchar.h
333 else
334         $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -f wchar-stub.h
335 endif
336
337 # Installs startfiles
338 install_startfiles: startfiles | $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)
339         -$(INSTALL) -m 644 $(startfiles) $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
340
341 # Installs development library links.
342 install_dev: install_headers install_runtime install_startfiles | $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)
343         -$(INSTALL) -m 644 $(top_builddir)lib/*.a $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
344 ifeq ($(HAVE_SHARED),y)
345         for i in `cd $(top_builddir) && find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
346         $(SED) -e 's/lib\///'` ; do \
347                 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(ABI_VERSION) \
348                 $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/$$i; \
349         done
350 ifeq ($(HARDWIRED_ABSPATH),y)
351         if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_LIBNAME) ] ; then \
352                 $(RM) $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
353                 $(SED) -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)$(MULTILIB_DIR)/$(NONSHARED_LIBNAME):' \
354                     -e 's:$(SHARED_LIBNAME):$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_LIBNAME):' \
355                     -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO):' \
356                     -e 's:$(UBACKTRACE_DSO):$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UBACKTRACE_DSO):' \
357                     $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
358                 $(SED) -i -e 's://:/:g' $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
359         fi
360 else
361         -$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
362 endif
363 ifeq ($(UCLIBC_HAS_THREADS),y)
364 ifneq ($(LINUXTHREADS_OLD),y)
365 ifeq ($(HARDWIRED_ABSPATH),y)
366         if [ -f $(top_builddir)lib/libpthread.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/libpthread.so.$(ABI_VERSION) ] ; then \
367                 $(RM) $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \
368                 cp $(top_srcdir)extra/scripts/format.lds $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \
369                 echo "GROUP ( $(RUNTIME_PREFIX)$(MULTILIB_DIR)/libpthread.so.$(ABI_VERSION) $(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread_nonshared.a )" \
370                         >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \
371                 $(SED) -i -e 's://:/:g' $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \
372         fi
373 else
374         -$(INSTALL) -m 755 $(top_builddir)lib/libpthread.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
375 endif
376 endif
377 endif
378 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
379         $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
380                 $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libthread_db.so
381 endif
382 ifeq ($(DOPIC),y)
383 #       # If we build shared libraries then the static libs are PIC...
384 #       # Make _pic.a symlinks to make mklibs.py and similar tools happy.
385         if [ -d $(top_builddir)lib ] ; then \
386                 for i in `cd $(top_builddir) && find lib/ -type f -name 'lib*.a' | $(SED) -e 's/lib\///'` ; do \
387                         $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/`echo $$i \
388                                 | $(SED) -e 's/\.a$$/_pic.a/'`; \
389                 done ; \
390         fi
391 endif
392 endif
393 ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
394         for file in $(top_builddir)lib/lib*.gdb; do \
395                 if test -f $$file; then \
396                         $(INSTALL) -m 755 $$file $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR); \
397                         $(INSTALL) -m 755 `echo $$file | $(SED) 's/\.gdb$$//'` \
398                           $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR); \
399                 fi; \
400         done
401 endif
402
403 # Installs run-time libraries
404 install_runtime: all | $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
405 ifeq ($(HAVE_SHARED),y)
406         $(INSTALL) -m 755 $(top_builddir)lib/lib*-$(VERSION).so \
407                 $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
408         (cd $(top_builddir)lib && $(TAR) --exclude=$(UCLIBC_LDSO_NAME).so.lds -cf - *.so.*) \
409         | $(TAR) -xf - -C $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)
410         @if [ -x $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so ] ; then \
411                 set -e; \
412                 $(SHELL_SET_X); \
413                 $(INSTALL) -m 755 $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so \
414                         $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR); \
415         fi
416 endif
417
418 utils: | pregen
419         $(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" -C utils $@
420
421 # Installs helper applications, such as 'ldd' and 'ldconfig'
422 install_utils: utils
423         $(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" -C utils utils_install
424
425 endif # ifeq ($(HAVE_DOT_CONFIG),y)
426
427 hostutils: | pregen
428         $(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils $@
429
430 install_hostutils: hostutils
431         $(Q)$(MAKE) CROSS_COMPILE="$(CROSS_COMPILE)" CC="$(CC)" HOSTCC="$(HOSTCC)" DOTHOST=.host -C utils utils_install
432
433 $(addprefix $(top_builddir),include include/bits include/sys include/config lib extra/config/lxdialog extra/locale extra/scripts $(subdirs)):
434         $(do_mkdir)
435
436 # configuration
437 # ---------------------------------------------------------------------------
438 $(conf) $(mconf): | $(top_builddir)include/config $(top_builddir)extra/config/lxdialog
439         $(Q)$(MAKE) -C extra/config $(@F)
440
441 arch-defconfigs := $(notdir $(wildcard $(top_srcdir)extra/Configs/defconfigs/$(ARCH)/*_defconfig))
442
443 menuconfig: $(mconf)
444         $(Q)$< extra/Configs/Config.in
445
446 config: $(conf)
447         $(Q)$< extra/Configs/Config.in
448
449 oldconfig: $(conf)
450         $(Q)$< -o extra/Configs/Config.in
451
452 silentoldconfig: $(conf)
453         $(Q)$< -s extra/Configs/Config.in
454
455 randconfig: $(conf)
456         $(Q)$< -r extra/Configs/Config.in
457
458 allyesconfig: $(conf)
459         $(Q)$< -y extra/Configs/Config.in
460         $(SED) -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" \
461                 -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" \
462                 -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" \
463                 -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" \
464                 -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" \
465                 $(KCONFIG_CONFIG)
466         $(Q)$< -o extra/Configs/Config.in
467
468 allnoconfig: $(conf)
469         $(Q)$< -n extra/Configs/Config.in
470
471 cmd_defconfig = $(Q)$< -D extra/Configs/defconfigs/$(ARCH)/$@ extra/Configs/Config.in
472 defconfig: $(conf)   ; $(cmd_defconfig)
473 %_defconfig: $(conf) ; $(cmd_defconfig)
474
475 menuconfig-clean-y:
476         $(Q)$(MAKE) -C extra/config CLEAN_extra/config
477
478 # The find here should continue to work as long as we are only symlinking
479 # headers in to include/.  I don't see this changing to anything else, so
480 # it should be fine.
481 include_clean:
482         $(SECHO) "  CLEAN include"
483         $(Q)$(RM) -r $(top_builddir)include/bits
484         $(Q)find $(top_builddir)include/ -type l -exec rm -f {} +
485
486 clean: include_clean
487         $(Q)$(RM) -r $(top_builddir)lib
488         @$(MAKE) -C utils CLEAN_utils
489         +$(MAKE) -s -C test clean
490         $(Q)$(RM) $(top_builddir)extra/scripts/unifdef
491         $(Q)$(RM) -r $(LOCAL_INSTALL_PATH)
492
493 distclean: clean
494         -find . \( -name core -o -name \*.orig -o -name \*~ -o -name .\*.dep \) -exec $(RM) {} \;
495         $(RM) $(top_builddir).config $(top_builddir).config.old $(top_builddir).config.cmd
496         $(RM) $(top_builddir)extra/locale/*.tgz
497         $(MAKE) -C extra/config distclean
498
499 dist release:
500         $(RM) ../uClibc-$(VERSION).tar
501         git archive --format=tar --prefix=uClibc-$(VERSION)/ HEAD \
502                 > ../uClibc-$(VERSION).tar
503         cat ../uClibc-$(VERSION).tar | bzip2 -c9 > ../uClibc-$(VERSION).tar.bz2
504         cat ../uClibc-$(VERSION).tar | xz -e -c8 > ../uClibc-$(VERSION).tar.xz
505         du -b ../uClibc-$(VERSION).tar.{bz2,xz}
506
507 test check: test_compile
508         $(Q)$(MAKE) -C test
509
510 test_compile: $(LOCAL_INSTALL_PATH)
511         $(Q)$(MAKE) -C test compile