]> Git Repo - uclibc-ng.git/blame - Makefile
Renamed script to create_makefiles.sh, copy instead of link (to allow cygwin users...
[uclibc-ng.git] / Makefile
CommitLineData
2c8e931c 1# Makefile for uClibc
eb2ecd0b 2#
d8168686 3# Copyright (C) 2000-2005 Erik Andersen <[email protected]>
eb2ecd0b 4#
d8168686 5# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
eb2ecd0b 6#
a99617fe 7
6737908f
EA
8#--------------------------------------------------------------
9# You shouldn't need to mess with anything beyond this point...
10#--------------------------------------------------------------
11noconfig_targets := menuconfig config oldconfig randconfig \
12 defconfig allyesconfig allnoconfig clean distclean \
d8168686 13 release dist tags
91307a36 14TOPDIR=./
124af9f4 15include Rules.mak
a99617fe 16
a5caac62
PM
17RTLD_DIR =
18ifeq ($(HAVE_SHARED),y)
19RTLD_DIR = ldso
20endif
21# need to have libc built, before we can build the others
22PRE_DIRS = $(RTLD_DIR) libc
23DIRS = $(RTLD_DIR) libcrypt libresolv libnsl libutil librt
3a7ac9c7 24ifeq ($(UCLIBC_HAS_FLOATS),y)
9431826d
PM
25 DIRS += libm
26endif
3a7ac9c7 27ifeq ($(UCLIBC_HAS_THREADS),y)
9431826d
PM
28 DIRS += libpthread
29endif
3a7ac9c7 30ifeq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
037a01de
MNI
31 DIRS += libintl
32endif
f0da4aa1 33
3a7ac9c7 34ifeq ($(HAVE_DOT_CONFIG),y)
f0da4aa1 35
f70602be 36all: finished
6737908f
EA
37
38# In this section, we need .config
39-include .config.cmd
ac191d55 40
f70602be 41finished: subdirs
e5760ee3
MF
42 $(SECHO)
43 $(SECHO) Finally finished compiling ...
44 $(SECHO)
64bc6412 45
6737908f 46include/bits/uClibc_config.h: .config
51da40e7 47 @if [ ! -x ./extra/config/conf ] ; then \
1b156699 48 $(MAKE) -C extra/config conf; \
2b4bc63f 49 fi
dd3fb0f8 50 $(RM) -r include/bits
49f0dd0f 51 $(INSTALL) -d include/bits
f8a3fa02 52 @./extra/config/conf -o extra/Configs/Config.in
6737908f 53
214557d8
MF
54# For the moment, we have to keep re-running this target
55# because the fix includes scripts rely on pre-processers
56# in order to generate the headers correctly :(. That
57# means we can't use the $(HOSTCC) in order to get the
58# correct output.
3a7ac9c7 59ifeq ($(ARCH_HAS_MMU),y)
e5760ee3 60export header_extra_args =
f71b544e 61else
e5760ee3 62export header_extra_args = -n
f71b544e 63endif
e5760ee3
MF
64headers: include/bits/uClibc_config.h
65 @$(SHELL_SET_X); \
66 ./extra/scripts/fix_includes.sh \
67 -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
68 $(header_extra_args)
ad255d2d 69 @cd include/bits; \
b8c417a5 70 set -e; \
ad255d2d 71 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
ff23ecf6 72 $(LN) -fs $$i .; \
ad255d2d
EA
73 done; \
74 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
75 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
ff23ecf6 76 $(LN) -fs $$i .; \
ad255d2d
EA
77 done; \
78 fi
79 @cd include/sys; \
b8c417a5 80 set -e; \
7589fd62 81 for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
ff23ecf6 82 $(LN) -fs $$i .; \
ad255d2d
EA
83 done; \
84 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
7589fd62 85 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
ff23ecf6 86 $(LN) -fs $$i .; \
ad255d2d
EA
87 done; \
88 fi
54a833f9 89 @cd $(TOPDIR); \
e5760ee3
MF
90 set -e; \
91 $(SHELL_SET_X); \
7a83a9f1 92 TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
654b5ef1
EA
93 if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
94 $(RM) include/bits/sysnum.h.new; \
95 else \
96 mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
97 fi
3a7ac9c7 98ifeq ($(UCLIBC_HAS_THREADS),y)
b402fab3 99 $(MAKE) -C libpthread headers
9186977b 100endif
7bda1856 101 $(MAKE) -C libc/sysdeps/linux/common headers
0a4aa6c3 102 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
ec265314 103
86be4f7e
EA
104# Command used to download source code
105WGET:=wget --passive-ftp
106
2ed8ea7e
MNI
107LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
108
86be4f7e 109pregen: headers
3a7ac9c7 110ifeq ($(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA),y)
86be4f7e 111 (cd extra/locale; \
2ed8ea7e
MNI
112 if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
113 $(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
2b4bc63f 114 fi )
86be4f7e 115endif
3a7ac9c7 116ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
2ed8ea7e 117 (cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
1b156699 118 $(MAKE) -C extra/locale pregen
86be4f7e
EA
119endif
120
f70602be
PM
121pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS))
122$(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen
123 $(MAKE) -C $(patsubst _pre_dir_%, %, $@)
86be4f7e 124
f0da4aa1 125subdirs: $(patsubst %, _dir_%, $(DIRS))
f70602be 126$(patsubst %, _dir_%, $(DIRS)): pre_subdirs
f0da4aa1
EA
127 $(MAKE) -C $(patsubst _dir_%, %, $@)
128
129tags:
130 ctags -R
131
f0de7b23 132install: install_runtime install_dev finished2
f0da4aa1 133
96277cfc 134
909c7fda
EA
135RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
136
6042a50c
PM
137# Installs header files.
138install_headers:
4a321ff4 139 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
08a9752c
MF
140 if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
141 extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
142 else \
143 extra_exclude="" ; \
144 fi ; \
ef7d6458 145 tar -chf - include --exclude .svn $$extra_exclude \
8196d433 146 | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
593d5a15 147 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ssp-internal.h
237277e9 148 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
3a7ac9c7 149ifneq ($(UCLIBC_HAS_FLOATS),y)
24b3f737 150 # Remove floating point related headers since float support is disabled.
4a321ff4
EA
151 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
152 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
153 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
154 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
155 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
0576579a 156 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
24b3f737 157endif
3a7ac9c7 158ifneq ($(UCLIBC_HAS_WCHAR),y)
8be2cd04 159 # Remove wide char headers since wide char support is disabled.
4a321ff4
EA
160 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
161 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
037a01de 162endif
3a7ac9c7 163ifneq ($(UCLIBC_HAS_LOCALE),y)
8be2cd04 164 # Remove iconv header since locale support is disabled.
4a321ff4 165 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
037a01de 166endif
3a7ac9c7 167ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
24b3f737 168 # Remove printf header since custom print specifier support is disabled.
4a321ff4 169 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
24b3f737 170endif
3a7ac9c7 171ifneq ($(UCLIBC_HAS_XLOCALE),y)
8be2cd04 172 # Remove xlocale header since extended locale support is disabled.
4a321ff4 173 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
037a01de 174endif
3a7ac9c7 175ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
8be2cd04 176 # Remove libintl header since gettext support is disabled.
4a321ff4 177 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
72d74d71 178endif
3a7ac9c7 179ifneq ($(UCLIBC_HAS_REGEX),y)
8be2cd04 180 # Remove regex headers since regex support is disabled.
4a321ff4
EA
181 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
182 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
72d74d71 183endif
3a7ac9c7 184ifneq ($(UCLIBC_HAS_WORDEXP),y)
8be2cd04 185 # Remove wordexp header since wordexp support is disabled.
4a321ff4 186 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
72d74d71 187endif
3a7ac9c7 188ifneq ($(UCLIBC_HAS_FTW),y)
8be2cd04 189 # Remove ftw header since ftw support is disabled.
4a321ff4 190 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
72d74d71 191endif
3a7ac9c7 192ifneq ($(UCLIBC_HAS_GLOB),y)
8be2cd04 193 # Remove glob header since glob support is disabled.
4a321ff4 194 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
f2239854 195endif
3a7ac9c7 196ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
f2239854 197 # Remove getopt header since gnu getopt support is disabled.
4a321ff4 198 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
9f77c8c4 199endif
3a7ac9c7 200ifneq ($(HAS_SHADOW),y)
99daa24b 201 # Remove shadow header since shadow password support is disabled.
9f77c8c4 202 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
0576579a 203endif
3a7ac9c7 204ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
0576579a
PM
205 # Remove thread_db header since thread debug support is disabled.
206 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
207endif
3a7ac9c7 208ifneq ($(UCLIBC_HAS_THREADS),y)
0576579a
PM
209 # Remove pthread headers since thread support is disabled.
210 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
211 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
212 $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
037a01de 213endif
6a461519 214 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
3a546d13 215 chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
2b4bc63f
PM
216 done
217 -find $(PREFIX)$(DEVEL_PREFIX) -name .svn | xargs $(RM) -r
7df4fc5e 218 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)
6042a50c
PM
219
220# Installs development library links.
221install_dev: install_headers
222 $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
223 -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
3a7ac9c7 224ifeq ($(HAVE_SHARED),y)
71f89684
EA
225 for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
226 sed -e 's/lib\///'` ; do \
909c7fda 227 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
71f89684 228 $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
e8138701 229 done
6042a50c 230 if [ -f $(TOPDIR)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
e8138701 231 $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
ed7cf0fe
PM
232 sed -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
233 -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
234 -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
235 $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
f70602be 236 fi
3a7ac9c7 237ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
6716bc70 238 $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
71f89684
EA
239 $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
240endif
241# # If we build shared libraries then the static libs are PIC...
242# # Make _pic.a symlinks to make mklibs.py and similar tools happy.
c12b5f41 243 if [ -d lib ] ; then \
f70602be
PM
244 for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
245 $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
246 | sed -e 's/\.a$$/_pic.a/'`; \
247 done ; \
c12b5f41 248 fi
ffc7bb39
EA
249endif
250
ad8d1eb4 251# Installs run-time libraries
cffc73df 252install_runtime:
3a7ac9c7 253ifeq ($(HAVE_SHARED),y)
27c01b77 254 $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
49f0dd0f 255 $(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
27c01b77 256 $(PREFIX)$(RUNTIME_PREFIX)lib
9d003b25 257 cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
58bd16ab 258 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
e5760ee3
MF
259 set -e; \
260 $(SHELL_SET_X); \
49f0dd0f 261 $(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
27c01b77 262 $(PREFIX)$(RUNTIME_PREFIX)lib; \
2b4bc63f 263 fi
dd43462e
EA
264endif
265
f0de7b23 266utils:
92dbe108 267 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
2cf23b8b 268
ad8d1eb4 269# Installs helper applications, such as 'ldd' and 'ldconfig'
2cf23b8b 270install_utils: utils
92dbe108 271 $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
96277cfc 272
34436c09 273finished2:
e5760ee3
MF
274 $(SECHO)
275 $(SECHO) Finished installing ...
276 $(SECHO)
34436c09 277
3a7ac9c7 278else # ifeq ($(HAVE_DOT_CONFIG),y)
6737908f
EA
279
280all: menuconfig
281
6737908f
EA
282# configuration
283# ---------------------------------------------------------------------------
f8a3fa02 284extra/config/conf:
1b156699 285 $(MAKE) -C extra/config conf
3056fc1a 286
f8a3fa02 287extra/config/mconf:
1b156699 288 $(MAKE) -C extra/config ncurses mconf
3056fc1a 289
6737908f 290menuconfig: extra/config/mconf
dd3fb0f8 291 $(RM) -r include/bits
49f0dd0f 292 $(INSTALL) -d include/bits
f8a3fa02 293 @./extra/config/mconf extra/Configs/Config.in
b3db5549 294 $(MAKE) headers
6737908f
EA
295
296config: extra/config/conf
dd3fb0f8 297 $(RM) -r include/bits
49f0dd0f 298 $(INSTALL) -d include/bits
f8a3fa02 299 @./extra/config/conf extra/Configs/Config.in
6737908f
EA
300
301oldconfig: extra/config/conf
dd3fb0f8 302 $(RM) -r include/bits
49f0dd0f 303 $(INSTALL) -d include/bits
f8a3fa02 304 @./extra/config/conf -o extra/Configs/Config.in
6737908f
EA
305
306randconfig: extra/config/conf
dd3fb0f8 307 $(RM) -r include/bits
49f0dd0f 308 $(INSTALL) -d include/bits
f8a3fa02 309 @./extra/config/conf -r extra/Configs/Config.in
6737908f
EA
310
311allyesconfig: extra/config/conf
dd3fb0f8 312 $(RM) -r include/bits
49f0dd0f 313 $(INSTALL) -d include/bits
f8a3fa02 314 @./extra/config/conf -y extra/Configs/Config.in
6e112da9
EA
315 sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
316 sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
317 sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
318 sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
319 sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
320 @./extra/config/conf -o extra/Configs/Config.in
6737908f
EA
321
322allnoconfig: extra/config/conf
dd3fb0f8 323 $(RM) -r include/bits
49f0dd0f 324 $(INSTALL) -d include/bits
f8a3fa02 325 @./extra/config/conf -n extra/Configs/Config.in
6737908f
EA
326
327defconfig: extra/config/conf
dd3fb0f8 328 $(RM) -r include/bits
49f0dd0f 329 $(INSTALL) -d include/bits
f8a3fa02 330 @./extra/config/conf -d extra/Configs/Config.in
6737908f 331
68a33eaf 332clean:
9186977b 333 @$(RM) -r lib include/bits
75e3be2c 334 $(RM) libc/*.a libc/obj.* libc/nonshared_obj.*
68a33eaf 335 $(RM) libc/misc/internals/interp.c
75e3be2c 336 $(RM) ldso/libdl/*.a
237277e9 337 $(RM) include/fpu_control.h include/dl-osinfo.h
2c35b786 338 $(MAKE) -C extra/locale clean
75e3be2c
PM
339 $(MAKE) -C ldso headers_clean
340 $(MAKE) -C libpthread headers_clean
68a33eaf
PM
341 $(MAKE) -C test clean
342 $(MAKE) -C utils clean
6c514226
EA
343 @set -e; \
344 for i in `(cd $(TOPDIR)/libc/sysdeps/linux/common/sys; ls *.h)` ; do \
dd3fb0f8 345 $(RM) include/sys/$$i; \
6c514226
EA
346 done; \
347 if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
348 for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
dd3fb0f8 349 $(RM) include/sys/$$i; \
6c514226 350 done; \
2b4bc63f 351 fi
935b2624 352 @$(RM) include/linux include/asm*
96749a76
EA
353 @if [ -d libc/sysdeps/linux/$(TARGET_ARCH) ]; then \
354 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean; \
2b4bc63f 355 fi
4583f84a 356 -find . \( -name \*.o -o -name \*.os \) -exec $(RM) {} \;
f0da4aa1 357
6737908f 358distclean: clean
a3f19caf 359 -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
dd3fb0f8 360 $(RM) .config .config.old .config.cmd
a29321c6 361 $(RM) extra/locale/*.txt
dec2c57b 362 $(MAKE) -C extra clean
6737908f 363
d8168686
MF
364dist release:
365 $(MAKE) -s distclean
366 $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.gz
367 svn -q export . ../uClibc-$(VERSION)
368 tar czf ../uClibc-$(VERSION).tar.gz -C .. uClibc-$(VERSION)
369 du -b ../uClibc-$(VERSION).tar.gz
c784f765 370
3a7ac9c7 371endif # ifeq ($(HAVE_DOT_CONFIG),y)
6737908f 372
7d664310
MF
373check:
374 $(MAKE) -C test
375
d8168686 376.PHONY: dummy subdirs release dist distclean clean config oldconfig menuconfig utils
This page took 0.216104 seconds and 4 git commands to generate.