]> Git Repo - uclibc-ng.git/blame - Makefile
oops. I forgot to commit this...
[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
e356ea32 34DIRS = extra ldso libc libcrypt libresolv libutil libm libpthread
f0da4aa1 35
ad255d2d 36all: headers uClibc_config 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
e356ea32 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
ad255d2d 67 @- find include -type l -exec rm -f {} \;
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; \
ad255d2d
EA
74 elif [ $(TARGET_ARCH) = "mipsel" ];then \
75 ln -fs $(KERNEL_SOURCE)/include/asm-mips include/asm; \
76 cd $(PWD)/libc/sysdeps/linux; \
77 ln -fs mips mipsel; \
78 cd $(PWD)/ldso/ldso; \
79 ln -fs mips mipsel; \
8dc1d08d
EA
80 elif [ $(TARGET_ARCH) = "h8300" ];then \
81 ln -fs $(KERNEL_SOURCE)/include/asm-h8300 include/asm; \
ee810856 82 else \
0d85794e 83 if [ $(HAS_MMU) != "true" ]; then \
ffc7bb39 84 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
0d85794e 85 else \
ffc7bb39 86 ln -fs $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
0d85794e 87 fi; \
ee810856 88 fi;
76eab266 89 @if [ ! -f include/asm/unistd.h ] ; then \
f605da2f 90 set -e; \
abdc3e4d 91 echo " "; \
163df9f2 92 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
abdc3e4d
EA
93 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
94 echo "correctly. Please edit \`Config' and fix these settings."; \
95 echo " "; \
a7b5c376
EA
96 /bin/false; \
97 fi;
ad255d2d 98 @if [ $(HAS_MMU) != "true" -a $(TARGET_ARCH) = "i386" ] ; then \
f605da2f 99 set -e; \
330a3515
EA
100 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
101 echo " malloc and friends won't work unless you fix \`Config'"; \
102 echo " "; \
103 sleep 10; \
104 fi;
ffc7bb39 105 @ln -fs $(KERNEL_SOURCE)/include/linux include/linux
ad255d2d
EA
106 rm -rf include/bits
107 mkdir -p include/bits
108 @cd include/bits; \
109 for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
110 ln -fs $$i .; \
111 done; \
112 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits ] ; then \
113 for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h` ; do \
114 ln -fs $$i .; \
115 done; \
116 fi
117 @cd include/sys; \
118 for i in ../../libc/sysdeps/linux/common/sys/*.h ; do \
119 ln -fs $$i .; \
120 done; \
121 if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
122 for i in ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h ; do \
123 ln -fs $$i .; \
124 done; \
125 fi
0a4aa6c3 126 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
ec265314 127
ad255d2d
EA
128uClibc_config: Makefile Config
129 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > include/bits/uClibc_config.h
130 @echo "#if !defined __FEATURES_H && !defined __need_include/bits/uClibc_config.h" >> include/bits/uClibc_config.h
131 @echo "#error Never include <bits/include/bits/uClibc_config.h> directly; use <features.h> instead." >> include/bits/uClibc_config.h
132 @echo "#endif" >> include/bits/uClibc_config.h
133 @echo "#define linux 1" >> include/bits/uClibc_config.h
134 @echo "#define __linux__ 1" >> include/bits/uClibc_config.h
8f6ad301 135 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
ad255d2d 136 echo "#define __UCLIBC_HAS_IPV6__ 1" >> include/bits/uClibc_config.h ; \
8f6ad301 137 else \
ad255d2d 138 echo "#undef __UCLIBC_HAS_IPV6__" >> include/bits/uClibc_config.h ; \
8f6ad301 139 fi
f7457980 140 @if [ "$(HAS_MMU)" = "true" ] ; then \
ad255d2d 141 echo "#define __UCLIBC_HAS_MMU__ 1" >> include/bits/uClibc_config.h ; \
f7457980 142 else \
ad255d2d 143 echo "#undef __UCLIBC_HAS_MMU__" >> include/bits/uClibc_config.h ; \
f7457980 144 fi
eba708a6 145 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
ad255d2d 146 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> include/bits/uClibc_config.h ; \
f7457980 147 else \
ad255d2d 148 echo "#undef __UCLIBC_HAS_FLOATS__" >> include/bits/uClibc_config.h ; \
f7457980
MNI
149 fi
150 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
ad255d2d 151 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> include/bits/uClibc_config.h ; \
f7457980 152 else \
ad255d2d 153 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> include/bits/uClibc_config.h ; \
f7457980
MNI
154 fi
155 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
ad255d2d
EA
156 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> include/bits/uClibc_config.h ; \
157 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> include/bits/uClibc_config.h ; \
f7457980 158 else \
ad255d2d 159 echo "#undef __UCLIBC_HAS_LOCALE__" >> include/bits/uClibc_config.h ; \
e2f6ebd3 160 fi
92773db4 161 @if [ "$(HAVE_ELF)" = "false" ] ; then \
ad255d2d 162 echo "#undef HAVE_ELF" >> include/bits/uClibc_config.h ; \
e2f6ebd3 163 else \
ad255d2d 164 echo "#define HAVE_ELF 1" >> include/bits/uClibc_config.h ; \
e2f6ebd3 165 fi
08e0c24b 166 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
ad255d2d 167 echo "#undef HAVE_SHARED" >> include/bits/uClibc_config.h ; \
08e0c24b 168 else \
ad255d2d 169 echo "#define HAVE_SHARED 1" >> include/bits/uClibc_config.h ; \
08e0c24b 170 fi
e2f6ebd3 171 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
ad255d2d 172 echo "#define NO_UNDERSCORES 1" >> include/bits/uClibc_config.h ; \
e2f6ebd3 173 else \
ad255d2d 174 echo "#undef NO_UNDERSCORES" >> include/bits/uClibc_config.h ; \
f7457980 175 fi
e6f7f47c 176 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
ad255d2d 177 echo "#define __UCLIBC_HAS_RPC__ 1" >> include/bits/uClibc_config.h ; \
e6f7f47c 178 else \
ad255d2d 179 echo "#undef __UCLIBC_HAS_RPC__" >> include/bits/uClibc_config.h ; \
e6f7f47c 180 fi
e53f70e1 181 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
ad255d2d 182 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> include/bits/uClibc_config.h ; \
e53f70e1 183 else \
ad255d2d 184 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> include/bits/uClibc_config.h ; \
e53f70e1 185 fi
ad255d2d 186 @echo "#define C_SYMBOL_PREFIX "\""$(C_SYMBOL_PREFIX)"\" >> include/bits/uClibc_config.h
cad937c1 187 @if [ "$(DOLFS)" = "true" ] ; then \
ad255d2d 188 echo "#define __UCLIBC_HAVE_LFS__ 1" >> include/bits/uClibc_config.h ; \
cad937c1 189 else \
ad255d2d 190 echo "#undef __UCLIBC_HAVE_LFS__" >> include/bits/uClibc_config.h ; \
cad937c1 191 fi
e356ea32 192 @if [ "$(INCLUDE_THREADS)" = "true" ] ; then \
ad255d2d
EA
193 echo "#define __UCLIBC_HAS_THREADS__ 1" >> include/bits/uClibc_config.h ; \
194 else \
195 echo "#undef __UCLIBC_HAS_THREADS__" >> include/bits/uClibc_config.h ; \
196 fi
197 @if [ "$(INCLUDE_REGEX)" = "true" ] ; then \
198 echo "#define __UCLIBC_HAS_REGEX__ 1" >> include/bits/uClibc_config.h ; \
e356ea32 199 else \
ad255d2d 200 echo "#undef __UCLIBC_HAS_REGEX__" >> include/bits/uClibc_config.h ; \
e356ea32 201 fi
ad3d96f8 202 @if [ "$(UNIX98PTY_ONLY)" = "true" ] ; then \
ad255d2d 203 echo "#define UNIX98PTY_ONLY 1" >> include/bits/uClibc_config.h ; \
ad3d96f8 204 else \
ad255d2d 205 echo "#undef UNIX98PTY_ONLY" >> include/bits/uClibc_config.h ; \
ad3d96f8
EA
206 fi
207 @if [ "$(ASSUME_DEVPTS)" = "true" ] ; then \
ad255d2d 208 echo "#define ASSUME_DEVPTS 1" >> include/bits/uClibc_config.h ; \
ad3d96f8 209 else \
ad255d2d 210 echo "#undef ASSUME_DEVPTS" >> include/bits/uClibc_config.h ; \
ad3d96f8 211 fi
f7457980 212
f0da4aa1
EA
213subdirs: $(patsubst %, _dir_%, $(DIRS))
214
215$(patsubst %, _dir_%, $(DIRS)) : dummy
216 $(MAKE) -C $(patsubst _dir_%, %, $@)
217
218tags:
219 ctags -R
220
34436c09 221install: install_dev install_runtime install_toolchain install_utils finished2
f0da4aa1 222
96277cfc
EA
223
224# Installs header files and development library links.
225install_dev:
226 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
96277cfc 227 install -d $(PREFIX)$(DEVEL_PREFIX)/usr/lib
a078da48 228 install -d $(PREFIX)$(DEVEL_PREFIX)/include
03f7612a 229 install -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)/lib/
171c8941 230 tar -chf - include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX);
6a461519
EA
231 -@for i in `find $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
232 chmod -f 755 $$i; chmod -f 644 $$i/*.h; \
233 done;
8841a5a7 234 -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1.\2/'` $(PREFIX)$(DEVEL_PREFIX)
96277cfc
EA
235ifeq ($(strip $(HAVE_SHARED)),true)
236 find lib/ -type l -name '*.so' -exec cp -a {} $(PREFIX)$(DEVEL_PREFIX)/lib ';'
ffc7bb39
EA
237endif
238
96277cfc
EA
239
240# Installs run-time libraries and helper apps onto the host system
241# allowing cross development. If you want to deploy to a target
242# system, use the "install_target" target instead...
ffc7bb39 243install_runtime:
96277cfc
EA
244ifeq ($(strip $(HAVE_SHARED)),true)
245 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
246 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
247 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib
248 cp -a lib/*.so.* $(PREFIX)$(DEVEL_PREFIX)/lib
f605da2f
EA
249 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
250 set -x -e; \
96277cfc 251 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(DEVEL_PREFIX)/lib; \
3c735763
EA
252 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
253 ln -s $(DEVEL_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
202f0c6a 254 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
96277cfc 255 fi;
dd43462e
EA
256endif
257
258install_toolchain:
03f7612a
EA
259 install -d $(PREFIX)$(DEVEL_PREFIX)/lib
260 install -d $(PREFIX)$(DEVEL_PREFIX)/bin
261 install -d $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin
262 $(MAKE) -C extra/gcc-uClibc install
e788a838
EA
263
264install_utils:
03f7612a 265ifeq ($(strip $(HAVE_SHARED)),true)
158af736 266 @$(MAKE) -C ldso utils
dd43462e 267 install -m 755 ldso/util/ldd $(PREFIX)$(DEVEL_PREFIX)/bin
dd43462e 268 ln -fs $(DEVEL_PREFIX)/bin/ldd $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldd
53c4df14
EA
269 # For now, don't bother with readelf since surely the host
270 # system has binutils, or we couldn't have gotten this far...
271 #install -m 755 ldso/util/readelf $(PREFIX)$(DEVEL_PREFIX)/bin
272 #ln -fs $(DEVEL_PREFIX)/bin/readelf $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-readelf
f605da2f
EA
273 @if [ -x ldso/util/ldconfig ] ; then \
274 set -x -e; \
96277cfc
EA
275 install -d $(PREFIX)$(DEVEL_PREFIX)/etc; \
276 install -m 755 ldso/util/ldconfig $(PREFIX)$(DEVEL_PREFIX)/bin; \
24700c28 277 ln -fs $(DEVEL_PREFIX)/sbin/ldconfig $(PREFIX)$(SYSTEM_DEVEL_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ldconfig; \
c3bbc0ea 278 fi;
03f7612a 279endif
f0da4aa1 280
96277cfc
EA
281# Installs run-time libraries and helper apps in preparation for
282# deploying onto a target system, but installed below wherever
283# $PREFIX is set to, allowing you to package up the result for
284# deployment onto your target system.
285install_target:
286ifeq ($(strip $(HAVE_SHARED)),true)
11ebbd76
EA
287 install -d $(PREFIX)$(TARGET_PREFIX)/lib
288 install -d $(PREFIX)$(TARGET_PREFIX)/sbin
289 install -d $(PREFIX)$(TARGET_PREFIX)/usr/bin
290 install -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib
291 cp -a lib/*.so.* $(PREFIX)$(TARGET_PREFIX)/lib
f605da2f
EA
292 @if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so ] ; then \
293 set -x -e; \
11ebbd76 294 install -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so $(PREFIX)$(TARGET_PREFIX)/lib; \
3c735763
EA
295 mkdir -p $(PREFIX)$(SHARED_LIB_LOADER_PATH); \
296 ln -s $(TARGET_PREFIX)/lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).so \
297 $(PREFIX)$(SHARED_LIB_LOADER_PATH)/$(UCLIBC_LDSO) || true; \
96277cfc 298 fi;
e788a838
EA
299endif
300
301install_target_utils:
302ifeq ($(strip $(HAVE_SHARED)),true)
303 install -m 755 ldso/util/ldd.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/ldd
304 install -m 755 ldso/util/readelf.target $(PREFIX)$(TARGET_PREFIX)/usr/bin/readelf
305 @if [ -x ldso/util/ldconfig.target ] ; then \
f605da2f 306 set -x -e; \
11ebbd76 307 install -d $(PREFIX)$(TARGET_PREFIX)/etc; \
e788a838 308 install -m 755 ldso/util/ldconfig.target $(PREFIX)$(TARGET_PREFIX)/sbin/ldconfig; \
96277cfc
EA
309 fi;
310endif
311
34436c09
EA
312finished2:
313 @echo
314 @echo Finished installing...
315 @echo
316
317
c784f765 318distclean clean:
ad255d2d 319 @rm -rf tmp lib include/bits libc/tmp _install
86cffec4 320 - find include -type l -exec rm -f {} \;
96277cfc 321 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core -o -name .\#\* \) -exec rm -f {} \;
c784f765 322 $(MAKE) -C test clean
0a4aa6c3 323 $(MAKE) -C ldso clean
b52e867b 324 $(MAKE) -C libc/unistd clean
cb546530 325 $(MAKE) -C libc/sysdeps/linux/common clean
16d35014
DS
326 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
327 $(MAKE) -C extra/gcc-uClibc clean
ad255d2d 328 find . -name mipsel -exec rm -rf {} \;
f0da4aa1 329
c784f765
EA
330dist release: distclean
331 cd ..; \
332 rm -rf uClibc-$(VERSION); \
333 cp -a uClibc uClibc-$(VERSION); \
53c4df14
EA
334 find uClibc-$(VERSION)/ -type d \
335 -name CVS -exec rm -rf {} \; ; \
336 find uClibc-$(VERSION)/ -type d \
337 -name .\#* -exec rm -rf {} \; ; \
c784f765
EA
338 \
339 tar -cvzf uClibc-$(VERSION).tar.gz --exclude CVS uClibc-$(VERSION)/;
340
9325f0b9 341.PHONY: dummy subdirs
64bc6412 342
This page took 0.160685 seconds and 4 git commands to generate.