3 # Copyright (C) 2000-2009 Erik Andersen <andersen@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
13 -I
$(top_srcdir
)ldso
/ldso
/$(TARGET_ARCH
) \
14 -I
$(top_srcdir
)ldso
/include \
15 -DUCLIBC_RUNTIME_PREFIX
=\"$(RUNTIME_PREFIX
)\" \
16 -DUCLIBC_LDSO
=\"$(UCLIBC_LDSO
)\" \
17 -I
$(top_srcdir
)/$(KERNEL_HEADERS
) \
19 -B
$(top_builddir
)lib \
20 -Wl
,-rpath-link
,$(top_builddir
)lib
22 ifeq ($(UCLIBC_BUILD_PIE
),y
)
23 CFLAGS-utils-shared
:= $(PIEFLAG
) $(LDPIEFLAG
)
25 CFLAGS-utils-shared
:=
28 ifneq ($(HAVE_SHARED
),y
)
29 CFLAGS-utils
+= -static
32 CFLAGS-ldconfig
:= -DBUILDING_LINKAGE
33 ifeq ($(UCLIBC_STATIC_LDCONFIG
),y
)
34 CFLAGS-ldconfig
+= -static
36 CFLAGS-ldconfig
+= $(CFLAGS-utils-shared
)
39 CFLAGS-ldd
:= $(CFLAGS-utils-shared
) -DBUILDING_LINKAGE
41 # Need CFLAGS-utils explicitly, because the source file is not located in utils
42 CFLAGS-iconv
:= $(CFLAGS-utils
) \
43 $(CFLAGS-utils-shared
) \
44 -I
$(top_srcdir
)libc
/misc
/wchar
46 CFLAGS-locale
:= $(CFLAGS-utils
)
47 CFLAGS-getconf
:=$(CFLAGS-utils
) \
48 -DGETCONF_DIR
='"$(CURDIR)"'
50 # "make hostutils" flags
52 UTILS_CONFIG_FLAGS-y
:=
53 UTILS_CONFIG_FLAGS-
$(LDSO_CACHE_SUPPORT
) += -D__LDSO_CACHE_SUPPORT__
54 UTILS_CONFIG_FLAGS-
$(LDSO_LDD_SUPPORT
) += -D__LDSO_LDD_SUPPORT__
55 UTILS_CONFIG_FLAGS-
$(LDSO_STANDALONE_SUPPORT
) += -D__LDSO_STANDALONE_SUPPORT__
57 BUILD_CFLAGS-utils
:= \
58 -DUCLIBC_RUNTIME_PREFIX
=\"$(RUNTIME_PREFIX
)\" \
59 -DUCLIBC_LDSO
=\"$(UCLIBC_LDSO
)\" \
60 -DARCH_NATIVE_BIT
=$(ARCH_NATIVE_BIT
) \
61 $(UTILS_CONFIG_FLAGS-y
)
62 BUILD_CFLAGS-ldconfig.host
:= \
64 -I
$(top_srcdir
)ldso
/ldso
/$(TARGET_ARCH
) \
65 -I
$(top_srcdir
)ldso
/include
66 BUILD_CFLAGS-ldd.host
:= \
68 -I
$(top_srcdir
)ldso
/ldso
/$(TARGET_ARCH
) \
69 -I
$(top_srcdir
)ldso
/include \
70 -include $(top_srcdir
)include/elf.h
71 BUILD_CFLAGS-iconv.host
:= \
72 -include $(top_builddir
)extra
/locale
/c8tables.h \
73 -I
$(top_srcdir
)libc
/misc
/wchar
-DL_iconv_main
75 BUILD_CFLAGS-getconf.host
:= \
76 -DGETCONF_DIR
='"$(CURDIR)"'
80 utils_DIR
:= $(top_srcdir
)utils
81 utils_OUT
:= $(top_builddir
)utils
83 DEPS-ldconfig
:= $(utils_DIR
)/chroot_realpath.c
84 DEPS-ldconfig.host
:= $(DEPS-ldconfig
)
87 ifeq ($(HAVE_SHARED
),y
)
88 utils_OBJ
+= ldconfig ldd
92 ifeq ($(UCLIBC_HAS_LOCALE
),y
)
94 utils_LOCALE_OBJ
+= $(utils_OUT
)/locale
97 utils_OBJ
:= $(patsubst %,$(utils_OUT
)/%,$(utils_OBJ
))
99 hostutils_OBJ
:= $(patsubst %,%.host
,$(utils_OBJ
))
101 utils
: $(utils_OBJ
) $(utils_LOCALE_OBJ
)
103 # NOTE: We build the utils AFTER we have a uClibc-targeted toolchain.
105 $(utils_OBJ
): $(utils_OUT
)/% : $(utils_DIR
)/%.c |
$(libc
)
108 $(utils_OUT
)/locale
: $(top_srcdir
)extra
/locale
/programs
/locale.c |
$(libc
)
111 hostutils
: $(hostutils_OBJ
)
113 $(hostutils_OBJ
): $(utils_OUT
)/%.host
: $(utils_DIR
)/%.c
117 install-y
+= utils_install
119 # This installs both utils and hostutils, so doesn't depend on either.
120 $(PREFIX
)$(DEVEL_PREFIX
)bin
$(PREFIX
)$(RUNTIME_PREFIX
)sbin
:
123 utils_install
: $(PREFIX
)$(DEVEL_PREFIX
)bin
124 ifeq ($(HAVE_SHARED
),y
)
125 utils_install
: $(PREFIX
)$(RUNTIME_PREFIX
)sbin
128 utils_install
: $(addsuffix $(DOTHOST
), $(utils_OBJ
) $(utils_LOCALE_OBJ
))
129 $(Q
)$(INSTALL
) -m
755 $(utils_OUT
)/getconf
$(DOTHOST
) $(PREFIX
)$(DEVEL_PREFIX
)bin
/getconf
130 ifeq ($(HAVE_SHARED
),y
)
131 $(Q
)$(INSTALL
) -m
755 $(utils_OUT
)/ldd
$(DOTHOST
) $(PREFIX
)$(DEVEL_PREFIX
)bin
/ldd
132 $(Q
)$(INSTALL
) -m
755 $(utils_OUT
)/ldconfig
$(DOTHOST
) $(PREFIX
)$(RUNTIME_PREFIX
)sbin
/ldconfig
134 ifeq ($(UCLIBC_HAS_LOCALE
),y
)
135 $(Q
)$(INSTALL
) -m
755 $(utils_OUT
)/iconv
$(DOTHOST
) $(PREFIX
)$(DEVEL_PREFIX
)bin
/iconv
136 $(Q
)$(INSTALL
) -m
755 $(utils_OUT
)/locale
$(DOTHOST
) $(PREFIX
)$(DEVEL_PREFIX
)bin
/locale
140 objclean-y
+= CLEAN_utils
143 $(do_rm
) $(addprefix $(utils_OUT
)/, getconf iconv ldconfig ldd locale
*.host
)
144 $(Q
)# This is a hack..
145 $(Q
)$(RM
) $(utils_OUT
)/.
*.dep