Makefile.in 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. # "make utils" flags
  7. # ldconfig,ldd,readelf had also:
  8. # -Wl,-rpath,/lib
  9. # -Wl,--dynamic-linker,/lib/ld-uClibc.so.0
  10. # -Wl,--hash-style=gnu
  11. ifeq ($(UCLIBC_BUILD_PIE),y)
  12. CFLAGS-utils-shared := $(PIEFLAG) $(LDPIEFLAG)
  13. else
  14. CFLAGS-utils-shared :=
  15. endif
  16. CFLAGS-ldconfig := \
  17. -I$(top_srcdir)ldso/include \
  18. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  19. -DUCLIBC_LDSO=$(UCLIBC_LDSO)
  20. ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
  21. CFLAGS-ldconfig += -static
  22. else
  23. CFLAGS-ldconfig += \
  24. $(CFLAGS-utils-shared) \
  25. -Wl,-rpath-link,$(top_builddir)lib
  26. endif
  27. # Can't just pull in $(CFLAGS), there are bad include paths.
  28. # We want to use "sanitized" headers in LOCAL_INSTALL_PATH.
  29. CFLAGS-ldconfig += \
  30. $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
  31. -nostdinc \
  32. -I $(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
  33. $(CC_INC) \
  34. -B$(top_builddir)lib \
  35. CFLAGS-ldd := \
  36. $(CFLAGS-utils-shared) \
  37. $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
  38. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  39. -nostdinc \
  40. -I$(top_srcdir)ldso/include \
  41. -I$(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
  42. $(CC_INC) \
  43. -B$(top_builddir)lib \
  44. -Wl,-rpath-link,$(top_builddir)lib \
  45. CFLAGS-readelf := \
  46. $(CFLAGS-utils-shared) \
  47. $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
  48. -nostdinc \
  49. -I $(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
  50. $(CC_INC) \
  51. -B$(top_builddir)lib \
  52. -Wl,-rpath-link,$(top_builddir)lib \
  53. # iconv and locale use non-sanitized headers by just pulling in $(CFLAGS)
  54. CFLAGS-iconv := \
  55. $(CFLAGS) $(CFLAGS-utils-shared) \
  56. -DNOT_IN_libc \
  57. -DL_iconv_main \
  58. -I$(top_srcdir)/$(KERNEL_HEADERS) \
  59. -B$(top_builddir)lib \
  60. -Wl,-rpath-link,$(top_builddir)lib \
  61. CFLAGS-locale := \
  62. $(CFLAGS) $(CFLAGS-utils-shared) \
  63. -DNOT_IN_libc \
  64. -B$(top_builddir)lib \
  65. -Wl,-rpath-link,$(top_builddir)lib \
  66. # "make hostutils" flags
  67. ifeq ($(LDSO_CACHE_SUPPORT),y)
  68. LDSO_CACHE_SUPPORT := -D__LDSO_CACHE_SUPPORT__=1
  69. endif
  70. BUILD_CFLAGS-ldconfig.host := -Wl,-s \
  71. -include $(top_srcdir)include/elf.h \
  72. -I$(top_srcdir)ldso/include \
  73. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  74. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  75. $(LDSO_CACHE_SUPPORT) \
  76. BUILD_CFLAGS-ldd.host := -Wl,-s \
  77. -include $(top_srcdir)include/elf.h \
  78. -I$(top_srcdir)ldso/include \
  79. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  80. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  81. $(LDSO_CACHE_SUPPORT) \
  82. BUILD_CFLAGS-readelf.host := -Wl,-s \
  83. -include $(top_srcdir)include/elf.h \
  84. # Rules
  85. utils_DIR := $(top_srcdir)utils
  86. utils_OUT := $(top_builddir)utils
  87. DEPS-ldconfig := $(utils_DIR)/chroot_realpath.c
  88. DEPS-ldconfig.host := $(DEPS-ldconfig)
  89. utils_OBJ := readelf
  90. ifeq ($(HAVE_SHARED),y)
  91. utils_OBJ += ldconfig ldd
  92. endif
  93. utils_ICONV_OBJ :=
  94. utils_LOCALE_OBJ :=
  95. ifeq ($(UCLIBC_HAS_LOCALE),y)
  96. utils_ICONV_OBJ := $(utils_OUT)/iconv
  97. utils_LOCALE_OBJ := $(utils_OUT)/locale
  98. endif
  99. utils_OBJ := $(patsubst %,$(utils_OUT)/%,$(utils_OBJ))
  100. hostutils_OBJ := $(patsubst %,%.host,$(utils_OBJ))
  101. utils: $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_LOCALE_OBJ)
  102. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  103. $(utils_OBJ): $(utils_OUT)/% : $(utils_DIR)/%.c | $(libc)
  104. $(compile.u)
  105. $(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc)
  106. $(compile.u)
  107. $(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc)
  108. $(compile.u)
  109. # Instruct make to install uclibc locally before buiding target utils
  110. $(utils_OBJ): | $(top_builddir)/$(LOCAL_INSTALL_PATH)
  111. $(utils_OUT)/iconv: | $(top_builddir)/$(LOCAL_INSTALL_PATH)
  112. $(utils_OUT)/locale: | $(top_builddir)/$(LOCAL_INSTALL_PATH)
  113. $(top_builddir)/$(LOCAL_INSTALL_PATH):
  114. $(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH)
  115. hostutils: $(hostutils_OBJ)
  116. $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c
  117. $(hcompile.u)
  118. install-y += utils_install
  119. # This installs both utils and hostutils, so doesn't depend on either.
  120. utils_install: $(addsuffix $(DOTHOST), $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_LOCALE_OBJ))
  121. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/readelf$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/readelf
  122. ifeq ($(HAVE_SHARED),y)
  123. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/ldd
  124. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  125. endif
  126. ifeq ($(UCLIBC_HAS_LOCALE),y)
  127. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/iconv
  128. $(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/locale
  129. endif
  130. objclean-y += utils_clean
  131. utils_clean:
  132. $(do_rm) $(addprefix $(utils_OUT)/, ldconfig ldd readelf iconv locale *.host)
  133. # This is a hack..
  134. $(Q)$(RM) $(utils_OUT)/.*.dep