OSDN Git Service

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