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