summaryrefslogtreecommitdiff
path: root/utils/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'utils/Makefile.in')
-rw-r--r--utils/Makefile.in86
1 files changed, 67 insertions, 19 deletions
diff --git a/utils/Makefile.in b/utils/Makefile.in
index 966821e1f..f9a30af7d 100644
--- a/utils/Makefile.in
+++ b/utils/Makefile.in
@@ -4,11 +4,12 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-
# "make utils" flags
-CFLAGS-utils := -DNOT_IN_libc $(SSP_ALL_CFLAGS) \
- -B$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
+# ldconfig,ldd,readelf had also:
+# -Wl,-rpath,/lib
+# -Wl,--dynamic-linker,/lib/ld-uClibc.so.0
+# -Wl,--hash-style=gnu
ifeq ($(UCLIBC_BUILD_PIE),y)
CFLAGS-utils-shared := $(PIEFLAG) $(LDPIEFLAG)
@@ -16,23 +17,60 @@ else
CFLAGS-utils-shared :=
endif
-CFLAGS-ldconfig := -I$(top_srcdir)ldso/include \
- -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO)
+CFLAGS-ldconfig := \
+ -I$(top_srcdir)ldso/include \
+ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
+ -DUCLIBC_LDSO=$(UCLIBC_LDSO)
ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
CFLAGS-ldconfig += -static
else
-CFLAGS-ldconfig += $(CFLAGS-utils-shared)
+CFLAGS-ldconfig += \
+ $(CFLAGS-utils-shared) \
+ -Wl,-rpath-link,$(top_builddir)lib
endif
-
-CFLAGS-ldd := -I$(top_srcdir)ldso/include \
+# Can't just pull in $(CFLAGS), there are bad include paths.
+# We want to use "sanitized" headers in LOCAL_INSTALL_PATH.
+CFLAGS-ldconfig += \
+ $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
+ -nostdinc \
+ -I $(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
+ $(CC_INC) \
+ -B$(top_builddir)lib \
+
+CFLAGS-ldd := \
+ $(CFLAGS-utils-shared) \
+ $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
- $(CFLAGS-utils-shared)
-
-CFLAGS-readelf := $(CFLAGS-utils-shared)
-
-# Need CFLAGS-utils explicitly, because the source file is not located in utils
-CFLAGS-iconv := $(CFLAGS-utils) $(CFLAGS-utils-shared) -DL_iconv_main
-CFLAGS-locale := $(CFLAGS-utils)
+ -nostdinc \
+ -I$(top_srcdir)ldso/include \
+ -I$(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
+ $(CC_INC) \
+ -B$(top_builddir)lib \
+ -Wl,-rpath-link,$(top_builddir)lib \
+
+CFLAGS-readelf := \
+ $(CFLAGS-utils-shared) \
+ $(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) $(OPTIMIZATION) \
+ -nostdinc \
+ -I $(top_builddir)/$(LOCAL_INSTALL_PATH)/usr/include \
+ $(CC_INC) \
+ -B$(top_builddir)lib \
+ -Wl,-rpath-link,$(top_builddir)lib \
+
+# iconv and locale use non-sanitized headers by just pulling in $(CFLAGS)
+CFLAGS-iconv := \
+ $(CFLAGS) $(CFLAGS-utils-shared) \
+ -DNOT_IN_libc \
+ -DL_iconv_main \
+ -I$(top_srcdir)/$(KERNEL_HEADERS) \
+ -B$(top_builddir)lib \
+ -Wl,-rpath-link,$(top_builddir)lib \
+
+CFLAGS-locale := \
+ $(CFLAGS) $(CFLAGS-utils-shared) \
+ -DNOT_IN_libc \
+ -B$(top_builddir)lib \
+ -Wl,-rpath-link,$(top_builddir)lib \
# "make hostutils" flags
@@ -44,13 +82,15 @@ endif
BUILD_CFLAGS-ldconfig.host := -Wl,-s \
-include $(top_srcdir)include/elf.h \
-I$(top_srcdir)ldso/include \
- -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
+ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
+ -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
$(LDSO_CACHE_SUPPORT) \
BUILD_CFLAGS-ldd.host := -Wl,-s \
-include $(top_srcdir)include/elf.h \
-I$(top_srcdir)ldso/include \
- -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
+ -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
+ -DUCLIBC_LDSO=$(UCLIBC_LDSO) \
$(LDSO_CACHE_SUPPORT) \
BUILD_CFLAGS-readelf.host := -Wl,-s \
@@ -70,8 +110,8 @@ ifeq ($(HAVE_SHARED),y)
utils_OBJ += ldconfig ldd
endif
-utils_ICONV_OBJ =
-utils_LOCALE_OBJ =
+utils_ICONV_OBJ :=
+utils_LOCALE_OBJ :=
ifeq ($(UCLIBC_HAS_LOCALE),y)
utils_ICONV_OBJ := $(utils_OUT)/iconv
utils_LOCALE_OBJ := $(utils_OUT)/locale
@@ -94,6 +134,14 @@ $(utils_OUT)/iconv: $(top_srcdir)libc/misc/wchar/wchar.c | $(libc)
$(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc)
$(compile.u)
+# Instruct make to install uclibc locally before buiding target utils
+$(utils_OBJ): | $(top_builddir)/$(LOCAL_INSTALL_PATH)
+$(utils_OUT)/iconv: | $(top_builddir)/$(LOCAL_INSTALL_PATH)
+$(utils_OUT)/locale: | $(top_builddir)/$(LOCAL_INSTALL_PATH)
+
+$(top_builddir)/$(LOCAL_INSTALL_PATH):
+ $(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH)
+
hostutils: $(hostutils_OBJ)
$(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c