Makefile.in 21 KB

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