Makefile.in 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. BUILD_CFLAGS-utils := -include $(top_srcdir)include/elf.h
  21. BUILD_CFLAGS-utils-common := $(CFLAGS-utils-common)
  22. ifeq ($(LDSO_CACHE_SUPPORT),y)
  23. BUILD_CFLAGS-utils-common += -D__LDSO_CACHE_SUPPORT__=1
  24. endif
  25. BUILD_CFLAGS-ldconfig.host := $(BUILD_CFLAGS-utils-common)
  26. BUILD_CFLAGS-ldd.host := $(BUILD_CFLAGS-utils-common)
  27. BUILD_LDFLAGS-utils := -Wl,-s
  28. utils_DIR := $(top_srcdir)utils
  29. utils_OUT := $(top_builddir)utils
  30. DEPS-ldconfig := $(utils_DIR)/chroot_realpath.c
  31. DEPS-ldconfig.host := $(DEPS-ldconfig)
  32. utils_OBJ := readelf
  33. ifeq ($(HAVE_SHARED),y)
  34. utils_OBJ += ldconfig ldd
  35. endif
  36. utils_ICONV_OBJ =
  37. ifeq ($(UCLIBC_HAS_LOCALE),y)
  38. utils_ICONV_OBJ := $(utils_OUT)/iconv
  39. endif
  40. utils_OBJ := $(patsubst %,$(utils_OUT)/%,$(utils_OBJ))
  41. hostutils_OBJ := $(patsubst %,%.host,$(utils_OBJ))
  42. utils: $(utils_OBJ) $(utils_ICONV_OBJ)
  43. # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
  44. $(utils_OBJ): $(utils_OUT)/% : $(utils_DIR)/%.c | $(libc)
  45. $(compile.u)
  46. $(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc)
  47. $(compile.u)
  48. hostutils: $(hostutils_OBJ)
  49. $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c
  50. $(hcompile.u)
  51. install-y += utils_install
  52. utils_install: utils
  53. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)usr/bin
  54. #$(INSTALL) -m 755 $(utils_OUT)/readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
  55. ifeq ($(HAVE_SHARED),y)
  56. $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)sbin
  57. $(INSTALL) -m 755 $(utils_OUT)/ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
  58. $(INSTALL) -m 755 $(utils_OUT)/ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
  59. endif
  60. ifeq ($(UCLIBC_HAS_LOCALE),y)
  61. $(INSTALL) -m 755 $(utils_OUT)/iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
  62. endif
  63. objclean-y += utils_clean
  64. utils_clean:
  65. $(RM) $(utils_OUT)/{ldconfig,ldd,readelf,iconv,*.host}