Makefile.in 4.0 KB

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