Makefile.in 4.6 KB

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