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