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