OSDN Git Service

Remove clean target in extra/locale and use locale_clean
[uclinux-h8/uClibc.git] / Makefile.in
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
8 #--------------------------------------------------------------
9 # You shouldn't need to mess with anything beyond this point...
10 #--------------------------------------------------------------
11 noconfig_targets := menuconfig config oldconfig randconfig \
12         defconfig allyesconfig allnoconfig clean distclean \
13         release dist tags
14
15 include $(top_builddir)Rules.mak
16
17 ifeq ($(HAVE_DOT_CONFIG),y)
18
19 all: pregen libs
20
21 # In this section, we need .config
22 -include .config.cmd
23
24 include $(top_srcdir)ldso/Makefile.in
25 include $(top_srcdir)libcrypt/Makefile.in
26 include $(top_srcdir)libintl/Makefile.in
27 include $(top_srcdir)libm/Makefile.in
28 include $(top_srcdir)libnsl/Makefile.in
29 include $(top_srcdir)libresolv/Makefile.in
30 include $(top_srcdir)librt/Makefile.in
31 include $(top_srcdir)libutil/Makefile.in
32 include $(top_srcdir)libpthread/Makefile.in
33 include $(top_srcdir)extra/locale/Makefile.in
34
35 # last included to catch all the objects added by others (locales/threads)
36 include $(top_srcdir)libc/Makefile.in
37
38 include/bits/uClibc_config.h: .config
39         $(INSTALL) -d include/bits
40         @if [ ! -x extra/config/conf ] ; then \
41             $(MAKE) -C extra/config conf; \
42         fi
43         @extra/config/conf -o $(top_srcdir)extra/Configs/Config.in
44
45 # For the moment, we have to keep re-running this target 
46 # because the fix includes scripts rely on pre-processers 
47 # in order to generate the headers correctly :(.  That 
48 # means we can't use the $(HOSTCC) in order to get the 
49 # correct output.
50 ifeq ($(ARCH_HAS_MMU),y)
51 export header_extra_args = 
52 else
53 export header_extra_args = -n
54 endif
55 headers: include/bits/uClibc_config.h
56         $(MAKE) headers-y
57         @$(SHELL_SET_X); \
58         $(top_srcdir)extra/scripts/fix_includes.sh \
59                 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
60                 $(header_extra_args)
61         if [ -f libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h ] ; then \
62                 $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h include/ ; \
63         else \
64                 $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \
65         fi
66         $(LN) -fs ../libc/sysdeps/linux/common/dl-osinfo.h include/
67         @cd include/bits; \
68         set -e; \
69         for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
70                 $(LN) -fs $$i .; \
71         done; \
72         if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
73                 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
74                         $(LN) -fs $$i .; \
75                 done; \
76         fi
77         @cd include/sys; \
78         set -e; \
79         for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
80                 $(LN) -fs $$i .; \
81         done; \
82         if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
83                 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
84                         $(LN) -fs $$i .; \
85                 done; \
86         fi
87         @cd $(top_builddir); \
88         set -e; \
89         $(SHELL_SET_X); \
90         top_builddir=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
91         if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
92                 $(RM) include/bits/sysnum.h.new; \
93         else \
94                 $(RM) include/bits/sysnum.h; \
95                 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
96         fi
97
98 pregen: headers
99
100 install: install_runtime install_dev
101
102
103 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
104
105 # Installs header files.
106 install_headers:
107         $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
108         if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
109                 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
110         else \
111                 extra_exclude="" ; \
112         fi ; \
113         tar -chf - --exclude .svn $$extra_exclude include \
114                 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
115         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ssp-internal.h
116         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
117 ifneq ($(UCLIBC_HAS_FLOATS),y)
118         # Remove floating point related headers since float support is disabled.
119         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
120         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
121         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
122         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
123         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
124         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
125 endif
126 ifneq ($(UCLIBC_HAS_WCHAR),y)
127         # Remove wide char headers since wide char support is disabled.
128         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
129         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
130 endif
131 ifneq ($(UCLIBC_HAS_LOCALE),y)
132         # Remove iconv header since locale support is disabled.
133         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
134 endif
135 ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
136         # Remove printf header since custom print specifier support is disabled.
137         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
138 endif
139 ifneq ($(UCLIBC_HAS_XLOCALE),y)
140         # Remove xlocale header since extended locale support is disabled.
141         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
142 endif
143 ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
144         # Remove libintl header since gettext support is disabled.
145         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
146 endif
147 ifneq ($(UCLIBC_HAS_REGEX),y)
148         # Remove regex headers since regex support is disabled.
149         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
150         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
151 endif
152 ifneq ($(UCLIBC_HAS_WORDEXP),y)
153         # Remove wordexp header since wordexp support is disabled.
154         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
155 endif
156 ifneq ($(UCLIBC_HAS_FTW),y)
157         # Remove ftw header since ftw support is disabled.
158         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
159 endif
160 ifneq ($(UCLIBC_HAS_GLOB),y)
161         # Remove glob header since glob support is disabled.
162         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
163 endif
164 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
165         # Remove getopt header since gnu getopt support is disabled.
166         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
167 endif
168 ifneq ($(HAS_SHADOW),y)
169         # Remove shadow header since shadow password support is disabled.
170         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
171 endif
172 ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
173         # Remove thread_db header since thread debug support is disabled.
174         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
175 endif
176 ifneq ($(UCLIBC_HAS_THREADS),y)
177         # Remove pthread headers since thread support is disabled.
178         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
179         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
180         $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
181 endif
182         -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
183             chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
184         done
185         -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
186
187 # Installs development library links.
188 install_dev: install_headers
189         $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
190         -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
191 ifeq ($(HAVE_SHARED),y)
192         for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
193         sed -e 's/lib\///'` ; do \
194                 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
195                 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
196         done
197         if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
198                 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
199                 sed     -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
200                         -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
201                         -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
202                         $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
203         fi
204 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
205         $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
206                 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
207 endif
208 ifeq ($(DOPIC),y)
209 #       # If we build shared libraries then the static libs are PIC...
210 #       # Make _pic.a symlinks to make mklibs.py and similar tools happy.
211         if [ -d lib ] ; then \
212                 for i in `find lib/  -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
213                         $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
214                                 | sed -e 's/\.a$$/_pic.a/'`; \
215                 done ; \
216         fi
217 endif
218 endif
219
220 # Installs run-time libraries
221 install_runtime:
222 ifeq ($(HAVE_SHARED),y)
223         $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
224         $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
225                 $(PREFIX)$(RUNTIME_PREFIX)lib
226         cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
227         @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
228             set -e; \
229                 $(SHELL_SET_X); \
230             $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
231                         $(PREFIX)$(RUNTIME_PREFIX)lib; \
232         fi
233 endif
234
235 utils:
236         $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
237
238 # Installs helper applications, such as 'ldd' and 'ldconfig'
239 install_utils: utils
240         $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
241
242 else # ifeq ($(HAVE_DOT_CONFIG),y)
243
244 all: menuconfig
245
246 headers:
247         @echo "Need to make a config file first, run: make menuconfig"
248         @false
249
250 endif # ifeq ($(HAVE_DOT_CONFIG),y)
251
252 # configuration
253 # ---------------------------------------------------------------------------
254 extra/config/conf:
255         $(MAKE) -C extra/config conf
256
257 extra/config/mconf:
258         $(MAKE) -C extra/config ncurses mconf
259
260 menuconfig: extra/config/mconf
261         $(RM) -r include/bits
262         $(INSTALL) -d include/bits
263         @./extra/config/mconf extra/Configs/Config.in
264         $(MAKE) headers
265
266 config: extra/config/conf
267         $(RM) -r include/bits
268         $(INSTALL) -d include/bits
269         @./extra/config/conf extra/Configs/Config.in
270
271 oldconfig: extra/config/conf
272         $(RM) -r include/bits
273         $(INSTALL) -d include/bits
274         @./extra/config/conf -o extra/Configs/Config.in
275
276 randconfig: extra/config/conf
277         $(RM) -r include/bits
278         $(INSTALL) -d include/bits
279         @./extra/config/conf -r extra/Configs/Config.in
280
281 allyesconfig: extra/config/conf
282         $(RM) -r include/bits
283         $(INSTALL) -d include/bits
284         @./extra/config/conf -y extra/Configs/Config.in
285         sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
286         sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
287         sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
288         sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
289         sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
290         @./extra/config/conf -o extra/Configs/Config.in
291
292 allnoconfig: extra/config/conf
293         $(RM) -r include/bits
294         $(INSTALL) -d include/bits
295         @./extra/config/conf -n extra/Configs/Config.in
296
297 defconfig: extra/config/conf
298         $(RM) -r include/bits
299         $(INSTALL) -d include/bits
300         @./extra/config/conf -d extra/Configs/Config.in
301
302 clean:
303         @$(RM) -r lib include/bits
304         $(RM) lib*/*.a ldso/*/*.a libpthread/*/*.a
305         $(RM) include/fpu_control.h include/dl-osinfo.h
306         $(MAKE) -C extra/locale locale_clean
307         $(MAKE) headers_clean-y
308         $(MAKE) -C test clean
309         $(MAKE) -C utils clean
310         @set -e; \
311         for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
312                 $(RM) include/sys/$$i; \
313         done; \
314         if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
315                 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
316                         $(RM) include/sys/$$i; \
317                 done; \
318         fi
319         @$(RM) include/linux include/asm*
320         -find . \( -name \*.o -o -name \*.os -o -name \*.oS \) -exec $(RM) {} \;
321
322 distclean: clean
323         -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
324         $(RM) .config .config.old .config.cmd
325         $(RM) extra/locale/*.tgz
326         $(MAKE) -C extra/config clean
327
328 dist release:
329         $(MAKE) -s distclean
330         $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.gz
331         svn -q export . ../uClibc-$(VERSION)
332         tar czf ../uClibc-$(VERSION).tar.gz -C .. uClibc-$(VERSION)
333         du -b ../uClibc-$(VERSION).tar.gz
334
335 check:
336         $(MAKE) -C test