Makefile.in 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. CFLAGS-utils := \
  8. $(SSP_ALL_CFLAGS) \
  9. -I$(top_srcdir)ldso/include \
  10. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  11. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  12. -I$(top_srcdir)/$(KERNEL_HEADERS) \
  13. -DNOT_IN_libc \
  14. -B$(top_builddir)lib \
  15. -Wl,-rpath-link,$(top_builddir)lib
  16. ifeq ($(UCLIBC_BUILD_PIE),y)
  17. CFLAGS-utils-shared := $(PIEFLAG) $(LDPIEFLAG)
  18. else
  19. CFLAGS-utils-shared :=
  20. endif
  21. CFLAGS-ldconfig :=
  22. ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
  23. CFLAGS-ldconfig += -static
  24. else
  25. CFLAGS-ldconfig += $(CFLAGS-utils-shared)
  26. endif
  27. CFLAGS-ldd := $(CFLAGS-utils-shared)
  28. CFLAGS-readelf := $(CFLAGS-utils-shared)
  29. # Need CFLAGS-utils explicitly, because the source file is not located in utils
  30. CFLAGS-iconv := $(CFLAGS-utils) \
  31. $(CFLAGS-utils-shared) \
  32. -DL_iconv_main \
  33. CFLAGS-locale := $(CFLAGS-utils)
  34. # "make hostutils" flags
  35. ifeq ($(LDSO_CACHE_SUPPORT),y)
  36. LDSO_CACHE_SUPPORT := -D__LDSO_CACHE_SUPPORT__=1
  37. endif
  38. BUILD_CFLAGS-utils := \
  39. -include $(top_srcdir)include/elf.h \
  40. -I$(top_srcdir)ldso/include \
  41. -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
  42. -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
  43. $(LDSO_CACHE_SUPPORT)
  44. BUILD_CFLAGS-ldconfig.host := $(BUILD_CFLAGS-utils)
  45. BUILD_CFLAGS-ldd.host := $(BUILD_CFLAGS-utils)
  46. BUILD_CFLAGS-readelf.host := $(BUILD_CFLAGS-utils)
  47. # Rules
  48. utils_DIR := $(top_srcdir)utils
  49. utils_OUT := $(top_builddir)utils
  50. DEPS-ldconfig := $(utils_DIR)/chroot_realpath.c
  51. DEPS-ldconfig.host := $(DEPS-ldconfig)
  52. utils_OBJ := readelf
  53. ifeq ($(HAVE_SHARED),y)
  54. utils_OBJ += ldconfig ldd
  55. endif
  56. utils_ICONV_OBJ :=
  57. utils_LOCALE_OBJ :=
  58. ifeq ($(UCLIBC_HAS_LOCALE),y)
  59. utils_ICONV_OBJ := $(utils_OUT)/iconv
  60. utils_LOCALE_OBJ := $(utils_OUT)/locale
  61. endif
  62. utils_OBJ := $(patsubst %,$(utils_OUT)/%,$(utils_OBJ))
  63. hostutils_OBJ := $(patsubst %,%.host,$(utils_OBJ))
  64. utils: $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_LOCALE_OBJ)
  65. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  66. $(utils_OBJ): $(utils_OUT)/% : $(utils_DIR)/%.c | $(libc)
  67. $(compile.u)
  68. $(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc)
  69. $(compile.u)
  70. $(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc)
  71. $(compile.u)
  72. hostutils: $(hostutils_OBJ)
  73. $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c
  74. $(hcompile.u)
  75. install-y += utils_install
  76. # This installs both utils and hostutils, so doesn't depend on either.
  77. utils_install: $(addsuffix $(DOTHOST), $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_LOCALE_OBJ))
  78. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/readelf$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/readelf
  79. ifeq ($(HAVE_SHARED),y)
  80. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/ldd
  81. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  82. endif
  83. ifeq ($(UCLIBC_HAS_LOCALE),y)
  84. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/iconv
  85. $(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/locale
  86. endif
  87. objclean-y += utils_clean
  88. utils_clean:
  89. $(do_rm) $(addprefix $(utils_OUT)/, ldconfig ldd readelf iconv locale *.host)
  90. # This is a hack..
  91. $(Q)$(RM) $(utils_OUT)/.*.dep