]> Git Repo - uclibc-ng.git/blame - Makefile
Use uClibc's ldd, not the system one which is probably broken
[uclibc-ng.git] / Makefile
CommitLineData
2c8e931c 1# Makefile for uClibc
eb2ecd0b 2#
249cb00d
EA
3# Copyright (C) 2000, 2001 by Lineo, inc.
4# Written by Erik Andersen <[email protected]>, <[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
eb2ecd0b
EA
19#
20# Derived in part from the Linux-8086 C library, the GNU C Library, and several
21# other sundry sources. Files within this library are copyright by their
22# respective copyright holders.
23
a99617fe
EA
24#--------------------------------------------------------
25#
330a3515 26#There are a number of configurable options in "Config"
a99617fe
EA
27#
28#--------------------------------------------------------
29
91307a36 30TOPDIR=./
cf4328b1 31include Rules.mak
a99617fe 32
34d61933 33DIRS = extra ldso libc libcrypt libresolv libutil libm
f0da4aa1 34
dd4d42c2
MNI
35ifndef $(TARGET_PREFIX)
36 TARGET_PREFIX = `pwd`/_install
37endif
38
f0da4aa1
EA
39all: headers uClibc_config.h subdirs $(DO_SHARED) done
40
ac191d55
DS
41Config:
42 @echo
43 @echo "You didn't read the README, did you... =)"
44 @echo "Choose a configuration file in extras/Config/ and copy it to ./Config."
45 @echo
46 @exit 1
47
f0da4aa1
EA
48shared:
49 @$(MAKE) -C libc shared
34d61933 50 @$(MAKE) -C ldso/util
eb8bb573 51ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
f0da4aa1 52 @$(MAKE) -C ldso shared
eb8bb573 53endif
bebf39c4 54 @$(MAKE) -C libcrypt shared
64cdebe1 55 @$(MAKE) -C libutil shared
1077fa4d 56 @$(MAKE) -C libm shared
d07c40c9 57 @$(MAKE) -C libresolv shared
8eaff69d 58
f0da4aa1 59done: $(DO_SHARED)
42ee0791
EA
60 @echo
61 @echo Finally finished compiling...
62 @echo
64bc6412 63
eb2ecd0b 64headers: dummy
31c580aa 65 @rm -f include/asm include/linux include/bits
ee810856
DS
66 @if [ $(TARGET_ARCH) = "powerpc" ];then \
67 ln -s $(KERNEL_SOURCE)/include/asm-ppc include/asm; \
68 else \
0d85794e
DM
69 if [ $(HAS_MMU) != "true" ]; then \
70 ln -s $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH)nommu include/asm;\
71 else \
72 ln -s $(KERNEL_SOURCE)/include/asm-$(TARGET_ARCH) include/asm; \
73 fi; \
ee810856 74 fi;
76eab266 75 @if [ ! -f include/asm/unistd.h ] ; then \
abdc3e4d 76 echo " "; \
163df9f2 77 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
abdc3e4d
EA
78 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
79 echo "correctly. Please edit \`Config' and fix these settings."; \
80 echo " "; \
a7b5c376
EA
81 /bin/false; \
82 fi;
330a3515
EA
83 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
84 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
85 echo " malloc and friends won't work unless you fix \`Config'"; \
86 echo " "; \
87 sleep 10; \
88 fi;
8c29d069 89 @ln -s $(KERNEL_SOURCE)/include/linux include/linux
f0da4aa1
EA
90 @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
91 (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
0a4aa6c3 92 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
ec265314 93
08e0c24b 94uClibc_config.h: Makefile Config
f7457980
MNI
95 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
96 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
97 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
98 @echo "#endif" >> uClibc_config.h
3a1407ff 99 @echo "#define linux 1" >> uClibc_config.h
b4043369 100 @echo "#define __linux__ 1" >> uClibc_config.h
8f6ad301
EA
101 @if [ "$(INCLUDE_IPV6)" = "true" ] ; then \
102 echo "#define __UCLIBC_HAS_IPV6__ 1" >> uClibc_config.h ; \
103 else \
104 echo "#undef __UCLIBC_HAS_IPV6__" >> uClibc_config.h ; \
105 fi
f7457980
MNI
106 @if [ "$(HAS_MMU)" = "true" ] ; then \
107 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
108 else \
e2f6ebd3 109 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
f7457980 110 fi
eba708a6 111 @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
f7457980
MNI
112 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
113 else \
e2f6ebd3 114 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
f7457980 115 fi
eba708a6
MNI
116 @if [ "$(HAS_LIBM_FLOAT)" = "true" ] ; then \
117 echo "#define __UCLIBC_HAS_LIBM_FLOAT__ 1" >> uClibc_config.h ; \
1077fa4d 118 else \
eba708a6 119 echo "#undef __UCLIBC_HAS_LIBM_FLOAT__" >> uClibc_config.h ; \
1077fa4d 120 fi
eba708a6
MNI
121 @if [ "$(HAS_LIBM_DOUBLE)" = "true" ] ; then \
122 echo "#define __UCLIBC_HAS_LIBM_DOUBLE__ 1" >> uClibc_config.h ; \
1077fa4d 123 else \
eba708a6
MNI
124 echo "#undef __UCLIBC_HAS_LIBM_DOUBLE__" >> uClibc_config.h ; \
125 fi
126 @if [ "$(HAS_LIBM_LONG_DOUBLE)" = "true" ] ; then \
127 echo "#define __UCLIBC_HAS_LIBM_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
128 else \
129 echo "#undef __UCLIBC_HAS_LIBM_LONG_DOUBLE__" >> uClibc_config.h ; \
1077fa4d 130 fi
f7457980
MNI
131 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
132 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
133 else \
e2f6ebd3 134 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
f7457980
MNI
135 fi
136 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
137 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
138 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
139 else \
e2f6ebd3
EA
140 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
141 fi
92773db4
EA
142 @if [ "$(HAVE_ELF)" = "false" ] ; then \
143 echo "#undef HAVE_ELF" >> uClibc_config.h ; \
e2f6ebd3 144 else \
92773db4 145 echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
e2f6ebd3 146 fi
08e0c24b
EA
147 @if [ "$(HAVE_SHARED)" = "false" ] ; then \
148 echo "#undef HAVE_SHARED" >> uClibc_config.h ; \
149 else \
150 echo "#define HAVE_SHARED 1" >> uClibc_config.h ; \
151 fi
e2f6ebd3
EA
152 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
153 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
154 else \
155 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
f7457980 156 fi
e6f7f47c
EA
157 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
158 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
159 else \
160 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
161 fi
e53f70e1
MNI
162 @if [ "$(UNIFIED_SYSCALL)" = "true" ] ; then \
163 echo "#define __UCLIBC_USE_UNIFIED_SYSCALL__ 1" >> uClibc_config.h ; \
164 else \
165 echo "#undef __UCLIBC_USE_UNIFIED_SYSCALL__" >> uClibc_config.h ; \
166 fi
f7457980 167
f0da4aa1
EA
168subdirs: $(patsubst %, _dir_%, $(DIRS))
169
170$(patsubst %, _dir_%, $(DIRS)) : dummy
171 $(MAKE) -C $(patsubst _dir_%, %, $@)
172
173tags:
174 ctags -R
175
dd4d42c2 176install: install_dev
f0da4aa1 177
dd4d42c2
MNI
178# Installs shared libraries for a target.
179install_target:
180ifeq ($(DO_SHARED),shared)
181 install -d $(TARGET_PREFIX)$(ROOT_DIR)/lib
182 cp -fa lib/*.so* $(TARGET_PREFIX)$(ROOT_DIR)/lib;
63fbd32b
MNI
183 install -d $(TARGET_PREFIX)$(ROOT_DIR)/etc
184 install -d $(TARGET_PREFIX)$(ROOT_DIR)/sbin
185 install -d $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
47c1983b
MNI
186 cp -f ldso/util/ldd $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
187 cp -f ldso/util/ldconfig $(TARGET_PREFIX)$(ROOT_DIR)/sbin
92773db4
EA
188ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
189 -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
190endif
63fbd32b 191endif
f0da4aa1
EA
192
193# Installs development library and headers
194# This is done with the assumption that it can blow away anything
dd4d42c2 195# in $(DEVEL_PREFIX)$(ROOT_DIR)/include. Probably true only if you're using
f0da4aa1
EA
196# a packaging system.
197install_dev:
92773db4
EA
198 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib
199 cp -fa lib/*.[ao] $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib;
75b012d7 200ifeq ($(DO_SHARED),shared)
dd4d42c2
MNI
201 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/lib
202 cp -fa lib/*.so* $(DEVEL_PREFIX)$(ROOT_DIR)/lib;
63fbd32b
MNI
203 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
204 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
205 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
47c1983b
MNI
206 cp -f ldso/util/ldd $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
207 cp -f ldso/util/ldconfig $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
92773db4
EA
208ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
209 -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
210endif
63fbd32b 211endif
dd4d42c2
MNI
212 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
213 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include
214 install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits
215 rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
216 rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
217 ln -s $(KERNEL_SOURCE)/include/asm $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
218 ln -s $(KERNEL_SOURCE)/include/linux $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
f0da4aa1 219 find include/ -type f -depth -not -path "*CVS*" -exec install \
dd4d42c2 220 -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
f0da4aa1 221 find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
dd4d42c2
MNI
222 -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
223 install -m 644 include/bits/uClibc_config.h $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits/
f0da4aa1
EA
224 $(MAKE) -C extra/gcc-uClibc install
225
226clean:
92773db4 227 @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h
86cffec4 228 - find include -type l -exec rm -f {} \;
f0da4aa1 229 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
0a4aa6c3 230 $(MAKE) -C ldso clean
b52e867b 231 $(MAKE) -C libc/unistd clean
cb546530 232 $(MAKE) -C libc/sysdeps/linux/common clean
16d35014
DS
233 $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) clean
234 $(MAKE) -C extra/gcc-uClibc clean
f0da4aa1 235
9325f0b9 236.PHONY: dummy subdirs
64bc6412 237
This page took 0.070161 seconds and 4 git commands to generate.