sys/time.h: sync with GNU C library
[uclibc-ng.git] / utils / Makefile.in
blob461e953c350b1a86f2a20c5368e41a723a033481
1 # Makefile for uClibc
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.
7 subdirs += utils
9 # "make utils" flags
11 CFLAGS-utils := \
12 $(SSP_ALL_CFLAGS) \
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) \
18 -DNOT_IN_libc \
19 -B$(top_builddir)lib \
20 -Wl,-rpath-link,$(top_builddir)lib
22 ifeq ($(UCLIBC_BUILD_PIE),y)
23 CFLAGS-utils-shared := $(PIEFLAG) $(LDPIEFLAG)
24 else
25 CFLAGS-utils-shared :=
26 endif
28 ifneq ($(HAVE_SHARED),y)
29 CFLAGS-utils += -static
30 endif
32 CFLAGS-ldconfig := -DBUILDING_LINKAGE
33 ifeq ($(UCLIBC_STATIC_LDCONFIG),y)
34 CFLAGS-ldconfig += -static
35 else
36 CFLAGS-ldconfig += $(CFLAGS-utils-shared)
37 endif
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 := \
63 -DBUILDING_LINKAGE \
64 -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) \
65 -I$(top_srcdir)ldso/include
66 BUILD_CFLAGS-ldd.host := \
67 -DBUILDING_LINKAGE \
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)"'
78 # Rules
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)
86 utils_OBJ := getconf
87 ifeq ($(HAVE_SHARED),y)
88 utils_OBJ += ldconfig ldd
89 endif
91 utils_LOCALE_OBJ :=
92 ifeq ($(UCLIBC_HAS_LOCALE),y)
93 utils_OBJ += iconv
94 utils_LOCALE_OBJ += $(utils_OUT)/locale
95 endif
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)
106 $(compile.u)
108 $(utils_OUT)/locale: $(top_srcdir)extra/locale/programs/locale.c | $(libc)
109 $(compile.u)
111 hostutils: $(hostutils_OBJ)
113 $(hostutils_OBJ): $(utils_OUT)/%.host : $(utils_DIR)/%.c
114 $(hcompile.u)
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:
121 $(do_mkdir)
123 utils_install: $(PREFIX)$(DEVEL_PREFIX)bin
124 ifeq ($(HAVE_SHARED),y)
125 utils_install: $(PREFIX)$(RUNTIME_PREFIX)sbin
126 endif
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
133 endif
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
137 endif
140 objclean-y += CLEAN_utils
142 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