Makefile.in 20 KB

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