Makefile.in 3.5 KB

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