Makefile.in 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. CFLAGS-utils := -DNOT_IN_libc $(SSP_ALL_CFLAGS) -B$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
  8. CFLAGS-utils-common := -I$(top_srcdir)ldso/include -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO)
  9. CFLAGS-utils-shared := $(PIEFLAG) $(LDPIEFLAG)
  10. CFLAGS-ldconfig := $(CFLAGS-utils-common)
  11. ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
  12. CFLAGS-ldconfig += -static
  13. else
  14. CFLAGS-ldconfig += $(CFLAGS-utils-shared)
  15. endif
  16. CFLAGS-ldd := $(CFLAGS-utils-common) $(CFLAGS-utils-shared)
  17. # needs CFLAGS-utils explicitely, because the source file is not located in utils
  18. CFLAGS-iconv := $(CFLAGS-utils) $(CFLAGS-utils-shared) -DL_iconv_main
  19. CFLAGS-readelf := $(CFLAGS-utils-shared)
  20. CFLAGS-locale := $(CFLAGS-utils)
  21. BUILD_CFLAGS-utils := -include $(top_srcdir)include/elf.h
  22. BUILD_CFLAGS-utils-common := $(CFLAGS-utils-common)
  23. ifeq ($(LDSO_CACHE_SUPPORT),y)
  24. BUILD_CFLAGS-utils-common += -D__LDSO_CACHE_SUPPORT__=1
  25. endif
  26. BUILD_CFLAGS-ldconfig.host := $(BUILD_CFLAGS-utils-common)
  27. BUILD_CFLAGS-ldd.host := $(BUILD_CFLAGS-utils-common)
  28. BUILD_LDFLAGS-utils := -Wl,-s
  29. utils_DIR := $(top_srcdir)utils
  30. utils_OUT := $(top_builddir)utils
  31. DEPS-ldconfig := $(utils_DIR)/chroot_realpath.c
  32. DEPS-ldconfig.host := $(DEPS-ldconfig)
  33. utils_OBJ := readelf
  34. ifeq ($(HAVE_SHARED),y)
  35. utils_OBJ += ldconfig ldd
  36. endif
  37. utils_ICONV_OBJ =
  38. utils_LOCALE_OBJ =
  39. ifeq ($(UCLIBC_HAS_LOCALE),y)
  40. utils_ICONV_OBJ := $(utils_OUT)/iconv
  41. utils_LOCALE_OBJ := $(utils_OUT)/locale
  42. endif
  43. utils_OBJ := $(patsubst %,$(utils_OUT)/%,$(utils_OBJ))
  44. hostutils_OBJ := $(patsubst %,%.host,$(utils_OBJ))
  45. utils: $(utils_OBJ) $(utils_ICONV_OBJ) $(utils_LOCALE_OBJ)
  46. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  47. $(utils_OBJ): $(utils_OUT)/% : $(utils_DIR)/%.c | $(libc)
  48. $(compile.u)
  49. $(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc)
  50. $(compile.u)
  51. $(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc)
  52. $(compile.u)
  53. hostutils: $(hostutils_OBJ)
  54. $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c
  55. $(hcompile.u)
  56. install-y += utils_install
  57. utils_install: utils
  58. #$(Q)$(INSTALL) -D -m 755 $(utils_OUT)/readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
  59. ifeq ($(HAVE_SHARED),y)
  60. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
  61. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  62. endif
  63. ifeq ($(UCLIBC_HAS_LOCALE),y)
  64. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
  65. $(Q)$(INSTALL) -m 755 $(utils_OUT)/locale $(PREFIX)$(RUNTIME_PREFIX)usr/bin/locale
  66. endif
  67. objclean-y += utils_clean
  68. utils_clean:
  69. $(RM) $(utils_OUT)/{ldconfig,ldd,readelf,iconv,locale,*.host}