OSDN Git Service

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