]> Git Repo - uclibc-ng.git/blame - Makefile
Add a test from Stefan Soucek for pthread_cond_timedwait(). On
[uclibc-ng.git] / Makefile
CommitLineData
2c8e931c 1# Makefile for uClibc
eb2ecd0b 2#
5a653498 3# Copyright (C) 2000 by Lineo, inc.
03f7612a 4# Copyright (C) 2000,2001,2002 Erik Andersen <[email protected]>
eb2ecd0b
EA
5#
6# This program is free software; you can redistribute it and/or modify it under
7# the terms of the GNU Library General Public License as published by the Free
8# Software Foundation; either version 2 of the License, or (at your option) any
9# later version.
10#
11# This program is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
91102e0d 13# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
eb2ecd0b
EA
14# details.
15#
fc38ee6b
EA
16# You should have received a copy of the GNU Library General Public License
17# along with this program; if not, write to the Free Software Foundation, Inc.,
18# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5a653498 19# Makefile for uClibc
eb2ecd0b
EA
20#
21# Derived in part from the Linux-8086 C library, the GNU C Library, and several
22# other sundry sources. Files within this library are copyright by their
23# respective copyright holders.
24
a99617fe
EA
25#--------------------------------------------------------
26#
330a3515 27#There are a number of configurable options in "Config"
a99617fe
EA
28#
29#--------------------------------------------------------
30
91307a36 31TOPDIR=./
cf4328b1 32include Rules.mak
a99617fe 33
a078da48 34DIRS = extra ldso libc libcrypt libresolv libutil libm #libpthread
f0da4aa1 35
34436c09 36all: headers uClibc_config.h subdirs shared finished
f0da4aa1 37
ac191d55
DS
38Config:
39 @echo
40 @echo "You didn't read the README, did you... =)"
ec8e0128
EA
41 @echo "Choose a configuration file in extras/Config/ and then run"
42 @echo " ln -s ./extra/Configs/Config.<arch> ./Config"
ac191d55
DS
43 @echo
44 @exit 1
45
f0da4aa1 46shared:
96277cfc 47ifeq ($(strip $(HAVE_SHARED)),true)
f0da4aa1 48 @$(MAKE) -C libc shared
96277cfc 49 @$(MAKE) -C ldso shared
bebf39c4 50 @$(MAKE) -C libcrypt shared
a078da48 51 @$(MAKE) -C libresolv shared
64cdebe1 52 @$(MAKE) -C libutil shared
1077fa4d 53 @$(MAKE) -C libm shared
a078da48 54 #@$(MAKE) -C libpthread shared
96277cfc
EA
55else
56 @echo
57 @echo Not building shared libraries...
58 @echo
59endif
8eaff69d 60
34436c09 61finished: shared
42ee0791
EA
62 @echo
63 @echo Finally finished compiling...
64 @echo
64bc6412 65
eb2ecd0b 66headers: dummy
31c580aa 67 @rm -f include/asm include/linux include/bits
ee810856 68 @if [ $(TARGET_ARCH) = "powerpc" ];then \
ffc7bb39 69 ln -fs $(KERNEL_SOURCE)/include/asm-ppc include/asm; \
5c12c8ee
EA
70 elif [ $(TARGET_ARCH) = "v850" ];then \
71 ln -fs $(KERNEL_SOURCE)/include/asm-v850 include/asm; \
59c9d20a 72 elif [ $(TARGET_ARCH) = "mips" ];then \
2ad28ec7 73 ln -fs $(KERNEL_SOURCE)/include/asm-mips include/asm; \
8dc1d08d
EA
74 elif [ $(TARGET_ARCH) = "h8300" ];then \
75 ln -fs $(KERNEL_SOURCE)/include/asm-h8300 include/asm; \
ee810856 76 else \
0d85794e 77 if [ $(HAS_MMU) != "true" ]; then \
ffc7bb39 78 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
0d85794e 79 else \
ffc7bb39 80 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
0d85794e 81 fi; \
ee810856 82 fi;
76eab266 83 @if [ ! -f include/asm/unistd.h ] ; then \
f605da2f 84 set -e; \
abdc3e4d 85 echo " "; \
163df9f2 86 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
abdc3e4d
EA
87 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
88 echo "correctly. Please edit \`Config' and fix these settings."; \
89 echo " "; \
a7b5c376
EA
90 /bin/false; \
91 fi;
330a3515 92 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
f605da2f 93 set -e; \
330a3515
EA
94 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
95 echo " malloc and friends won't work unless you fix \`Config'"; \
96 echo " "; \
97 sleep 10; \
98 fi;
ffc7bb39
EA
99 @ln -fs $(KERNEL_SOURCE)/include/linux include/linux
100 @ln -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
01d1ae37 101 (cd include/bits && ln -sf ../../../../../uClibc_config.h uClibc_config.h)
0a4aa6c3 102 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
ec265314 103
08e0c24b 104uClibc_config.h: Makefile Config
f7457980
MNI
105 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
106 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
107 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
108 @echo "#endif" >> uClibc_config.h
3a1407ff 109 @echo "#define linux 1" >> uClibc_config.h
b4043369 110 @echo "#define __linux__ 1" >> uClibc_config.h
8f6ad301
EA
111 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
112 echo "#define __UCLIBC_HAS_IPV6__ 1" >> uClibc_config.h ; \
113 else \
114 echo "#undef __UCLIBC_HAS_IPV6__" >> uClibc_config.h ; \
115 fi
f7457980
MNI
116 @if [ "$(HAS_MMU)" = "true" ] ; then \
117 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
118 else \
e2f6ebd3 119 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
f7457980 120 fi
eba708a6 121 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
f7457980
MNI
122 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
123 else \
e2f6ebd3 124 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
f7457980
MNI
125 fi
126 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
127 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
128 else \
e2f6ebd3 129 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
f7457980
MNI
130 fi
131 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
132 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
133 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
134 else \
e2f6ebd3
EA
135 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
136 fi
92773db4
EA
137 @if [ "$(HAVE_ELF)" = "false" ] ; then \
138 echo "#undef HAVE_ELF" >> uClibc_config.h ; \
e2f6ebd3 139 else \
92773db4 140 echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
e2f6ebd3 141 fi
08e0c24b
EA
142 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
143 echo "#undef HAVE_SHARED" >> uClibc_config.h ; \
144 else \
145 echo "#define HAVE_SHARED 1" >> uClibc_config.h ; \
146 fi
e2f6ebd3
EA
147 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
148 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
149 else \
150 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
f7457980 151 fi
e6f7f47c
EA
152 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
153 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
154 else \
155 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
156 fi
e53f70e1
MNI
157 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
158 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> uClibc_config.h ; \
159 else \
160 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> uClibc_config.h ; \
161 fi
5c12c8ee 162 @echo "#define C_SYMBOL_PREFIX "\""$(C_SYMBOL_PREFIX)"\" >> uClibc_config.h
cad937c1
EA
163 @if [ "$(DOLFS)" = "true" ] ; then \
164 echo "#define __UCLIBC_HAVE_LFS__ 1" >> uClibc_config.h ; \
165 else \
166 echo "#undef __UCLIBC_HAVE_LFS__" >> uClibc_config.h ; \
167 fi
ad3d96f8
EA
168 @if [ "$(UNIX98PTY_ONLY)" = "true" ] ; then \
169 echo "#define UNIX98PTY_ONLY 1" >> uClibc_config.h ; \
170 else \
171 echo "#undef UNIX98PTY_ONLY" >> uClibc_config.h ; \
172 fi
173 @if [ "$(ASSUME_DEVPTS)" = "true" ] ; then \
174 echo "#define ASSUME_DEVPTS 1" >> uClibc_config.h ; \
175 else \
176 echo "#undef ASSUME_DEVPTS" >> uClibc_config.h ; \
177 fi
f7457980 178
f0da4aa1
EA
179subdirs: $(patsubst %, _dir_%, $(DIRS))
180
181$(patsubst %, _dir_%, $(DIRS)) : dummy
182 $(MAKE) -C $(patsubst _dir_%, %, $@)
183
184tags:
185 ctags -R
186
34436c09 187install: install_dev install_runtime install_toolchain install_utils finished2
f0da4aa1 188
96277cfc
EA
189
190# Installs header files and development library links.
191install_dev:
192 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
96277cfc 193 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/lib
a078da48 194 install -d $(PREFIX)$(DEVEL_PREFIX)/include
03f7612a 195 install -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)/lib/
4dd4bdd3 196 tar -chO include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX);
6a461519
EA
197 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
198 chmod -f 755 $$i; chmod -f 644 $$i/*.h; \
199 done;
8841a5a7 200 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1.\2/'` $(PREFIX)$(DEVEL_PREFIX)
96277cfc
EA
201ifeq ($(strip $(HAVE_SHARED)),true)
202 find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';'
ffc7bb39
EA
203endif
204
96277cfc
EA
205
206# Installs run-time libraries and helper apps onto the host system
207# allowing cross development. If you want to deploy to a target
208# system, use the "install_target" target instead...
ffc7bb39 209install_runtime:
96277cfc
EA
210ifeq ($(strip $(HAVE_SHARED)),true)
211 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
212 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
213 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib
214 cp -a lib/*.so.* $(PREFIX)$(DEVEL_PREFIX)/lib
f605da2f
EA
215 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
216 set -x -e; \
96277cfc 217 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib; \
3c735763
EA
218 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
219 ln -s $(DEVEL_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
202f0c6a 220 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
96277cfc 221 fi;
dd43462e
EA
222endif
223
224install_toolchain:
03f7612a
EA
225 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
226 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
227 install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin
228 $(MAKE) -C extra/gcc-uClibc install
e788a838
EA
229
230install_utils:
03f7612a 231ifeq ($(strip $(HAVE_SHARED)),true)
158af736 232 @$(MAKE) -C ldso utils
dd43462e 233 install -m 755 ldso/util/ldd $(PREFIX)$(DEVEL_PREFIX)/bin
dd43462e 234 ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
53c4df14
EA
235 # For now, don't bother with readelf since surely the host
236 # system has binutils, or we couldn't have gotten this far...
237 #install -m 755 ldso/util/readelf $(PREFIX)$(DEVEL_PREFIX)/bin
238 #ln -fs $(DEVEL_PREFIX)/bin/readelf $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-readelf
f605da2f
EA
239 @if [ -x ldso/util/ldconfig ] ; then \
240 set -x -e; \
96277cfc
EA
241 install -d $(PREFIX)$(DEVEL_PREFIX)/etc; \
242 install -m 755 ldso/util/ldconfig $(PREFIX)$(DEVEL_PREFIX)/bin; \
24700c28 243 ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldconfig; \
c3bbc0ea 244 fi;
03f7612a 245endif
f0da4aa1 246
96277cfc
EA
247# Installs run-time libraries and helper apps in preparation for
248# deploying onto a target system, but installed below wherever
249# $PREFIX is set to, allowing you to package up the result for
250# deployment onto your target system.
251install_target:
252ifeq ($(strip $(HAVE_SHARED)),true)
11ebbd76
EA
253 install -d $(PREFIX)$(TARGET_PREFIX)/lib
254 install -d $(PREFIX)$(TARGET_PREFIX)/sbin
255 install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin
256 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib
257 cp -a lib/*.so.* $(PREFIX)$(TARGET_PREFIX)/lib
f605da2f
EA
258 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
259 set -x -e; \
11ebbd76 260 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib; \
3c735763
EA
261 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
262 ln -s $(TARGET_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
263 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
96277cfc 264 fi;
e788a838
EA
265endif
266
267install_target_utils:
268ifeq ($(strip $(HAVE_SHARED)),true)
269 install -m 755 ldso/util/ldd.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/ldd
270 install -m 755 ldso/util/readelf.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/readelf
271 @if [ -x ldso/util/ldconfig.target ] ; then \
f605da2f 272 set -x -e; \
11ebbd76 273 install -d $(PREFIX)$(TARGET_PREFIX)/etc; \
e788a838 274 install -m 755 ldso/util/ldconfig.target $(PREFIX)$(TARGET_PREFIX)/sbin/ldconfig; \
96277cfc
EA
275 fi;
276endif
277
34436c09
EA
278finished2:
279 @echo
280 @echo Finished installing...
281 @echo
282
283
c784f765 284distclean clean:
29f7a710 285 @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h libc/tmp
86cffec4 286 - find include -type l -exec rm -f {} \;
96277cfc 287 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \;
c784f765 288 $(MAKE) -C test clean
0a4aa6c3 289 $(MAKE) -C ldso clean
b52e867b 290 $(MAKE) -C libc/unistd clean
cb546530 291 $(MAKE) -C libc/sysdeps/linux/common clean
16d35014
DS
292 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
293 $(MAKE) -C extra/gcc-uClibc clean
f0da4aa1 294
c784f765
EA
295dist release: distclean
296 cd ..; \
297 rm -rf uClibc-$(VERSION); \
298 cp -a uClibc uClibc-$(VERSION); \
53c4df14
EA
299 find uClibc-$(VERSION)/ -type d \
300 -name CVS -exec rm -rf {} \; ; \
301 find uClibc-$(VERSION)/ -type d \
302 -name .\#* -exec rm -rf {} \; ; \
c784f765
EA
303 \
304 tar -cvzf uClibc-$(VERSION).tar.gz --exclude CVS uClibc-$(VERSION)/;
305
9325f0b9 306.PHONY: dummy subdirs
64bc6412 307
This page took 0.116072 seconds and 4 git commands to generate.