Makefile.in 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #
  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. # This installs both utils and hostutils, so doesn't depend on either.
  58. utils_install:
  59. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/readelf$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)bin/readelf
  60. ifeq ($(HAVE_SHARED),y)
  61. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)bin/ldd
  62. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  63. endif
  64. ifeq ($(UCLIBC_HAS_LOCALE),y)
  65. $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)bin/iconv
  66. $(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)bin/locale
  67. endif
  68. objclean-y += utils_clean
  69. utils_clean:
  70. $(do_rm) $(addprefix $(utils_OUT)/, ldconfig ldd readelf iconv locale *.host)
  71. # This is a hack..
  72. $(Q)$(RM) $(utils_OUT)/.*.dep