]> Git Repo - uclibc-ng.git/blob - Makefile
Fix up naming of ld.so so every uses the same define. The top level
[uclibc-ng.git] / Makefile
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000 by Lineo, inc.
4 #
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #
19 # Derived in part from the Linux-8086 C library, the GNU C Library, and several
20 # other sundry sources.  Files within this library are copyright by their
21 # respective copyright holders.
22
23 #--------------------------------------------------------
24 #
25 #There are a number of configurable options in "Config"
26 #
27 #--------------------------------------------------------
28
29 TOPDIR=./
30 include Rules.mak
31
32 DIRS = extra misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd crypt libutil libm
33
34 ifeq ($(strip $(HAS_MMU)),true)
35         DO_SHARED=shared
36 endif
37
38 all: halfclean headers uClibc_config.h subdirs $(LIBNAME) $(DO_SHARED) done
39
40 $(LIBNAME): subdirs
41         $(CROSS)ranlib $(LIBNAME)
42
43 shared: $(LIBNAME)
44         @rm -rf tmp
45         @mkdir tmp
46         @$(MAKE) -C ld.so-1 ldso
47         @(cd tmp; CC=$(CC) /bin/sh ../extra/scripts/get-needed-libgcc-objects.sh)
48         if [ -s ./tmp/libgcc-need.a ] ; then \
49                 $(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
50                     -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
51                     ./$(LIBNAME) ./tmp/libgcc-need.a \
52                     $(LDSO) ; \
53         else \
54                 $(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
55                     -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
56                     ./$(LIBNAME) $(LDSO) ; \
57         fi
58         @rm -rf tmp
59         ln -sf $(SHARED_FULLNAME) $(SHARED_MAJORNAME)
60         @$(MAKE) -C crypt shared
61         @$(MAKE) -C libutil shared
62         @$(MAKE) -C libm shared
63         @$(MAKE) -C ld.so-1
64
65 done: $(LIBNAME) $(DO_SHARED)
66         @echo
67         @echo Finally finished compiling...
68         @echo
69
70 halfclean:
71         @rm -f $(LIBNAME) crt0.o uClibc_config.h
72         @rm -f $(SHARED_FULLNAME) $(SHARED_MAJORNAME) uClibc-0.* libc.so*
73
74 headers: dummy
75         @rm -f include/asm include/linux include/bits
76         @ln -s $(KERNEL_SOURCE)/include/asm include/asm
77         @if [ ! -f include/asm/unistd.h ] ; then \
78             echo " "; \
79             echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
80             echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
81             echo "correctly.  Please edit \`Config' and fix these settings."; \
82             echo " "; \
83             /bin/false; \
84         fi;
85         @if [ $(HAS_MMU) != "true" ]  && [ $(TARGET_ARCH) = "i386" ] ; then \
86             echo "WARNING: I bet your x86 system really has an MMU, right?"; \
87             echo "         malloc and friends won't work unless you fix \`Config'"; \
88             echo " "; \
89             sleep 10; \
90         fi;
91         @ln -s $(KERNEL_SOURCE)/include/linux include/linux
92         @ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
93         @ln -sf ../../../../uClibc_config.h sysdeps/linux/$(TARGET_ARCH)/bits/uClibc_config.h
94
95
96 tags:
97         ctags -R
98
99 clean: subdirs_clean halfclean
100         @rm -rf tmp
101         rm -f include/asm include/linux include/bits
102         @$(MAKE) -C ld.so-1 clean
103
104 subdirs: $(patsubst %, _dir_%, $(DIRS))
105 subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) test)
106
107 $(patsubst %, _dir_%, $(DIRS)) : dummy
108         $(MAKE) -C $(patsubst _dir_%, %, $@)
109
110 $(patsubst %, _dirclean_%, $(DIRS) test) : dummy
111         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
112
113 install: install_runtime install_dev install_ldso
114
115 # Installs shared library
116 install_runtime:
117         @$(MAKE) -C crypt install
118         @$(MAKE) -C libutil install
119         @$(MAKE) -C libm install
120 ifneq ($(DO_SHARED),)
121         install -d $(INSTALL_DIR)/lib
122         rm -rf $(INSTALL_DIR)/lib/$(SHARED_FULLNAME)
123         rm -rf $(INSTALL_DIR)/lib/$(SHARED_MAJORNAME)
124         rm -rf $(INSTALL_DIR)/lib/libc.so
125         install -m 755 $(SHARED_FULLNAME) $(INSTALL_DIR)/lib/
126         (cd $(INSTALL_DIR)/lib;ln -sf $(SHARED_FULLNAME) $(SHARED_MAJORNAME))
127 # ldconfig is really not necessary, and impossible to cross
128 #ifeq ($(INSTALL_DIR),)
129 #       /sbin/ldconfig -n $(INSTALL_DIR)/lib
130 #endif
131 else
132         echo shared library not installed
133 endif
134
135 # Installs development library and headers
136 # This is done with the assumption that it can blow away anything
137 # in $(INSTALL_DIR)/include.  Probably true only if you're using
138 # a packaging system.
139 install_dev:
140         install -d $(INSTALL_DIR)/include
141         install -d $(INSTALL_DIR)/include/bits
142         rm -f $(INSTALL_DIR)/include/asm
143         rm -f $(INSTALL_DIR)/include/linux
144         ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
145         ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
146         find include/ -type f -depth -not -path "*CVS*" -exec install -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
147         find include/bits/ -type f -depth -not -path "*CVS*" -exec install -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
148         install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
149         install -d $(INSTALL_DIR)/lib
150         rm -f $(INSTALL_DIR)/lib/$(LIBNAME)
151         install -m 644 $(LIBNAME) $(INSTALL_DIR)/lib/
152         @if [ -f crt0.o ] ; then install -m 644 crt0.o $(INSTALL_DIR)/lib/; fi
153         install -d $(INSTALL_DIR)/bin
154         $(MAKE) -C extra/gcc-uClibc install
155
156
157 install_ldso:
158 ifeq ($(strip $(DO_SHARED)),shared)
159         $(MAKE) -C ld.so-1 install
160         install -d $(INSTALL_DIR)/etc
161         $(TOPDIR)ld.so-1/util/ldconfig
162 else
163         @echo "Skipping shared library support"
164 endif
165
166 uClibc_config.h: Config
167         @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
168         @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
169         @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
170         @echo "#endif" >> uClibc_config.h
171         @echo "#define linux 1" >> uClibc_config.h 
172         @echo "#define __linux__ 1" >> uClibc_config.h 
173         @if [ "$(HAS_MMU)" = "true" ] ; then \
174             echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
175         else \
176             echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
177         fi
178         @if [ "$(HAS_FLOATS)" = "true" ] ; then \
179             echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
180         else \
181             echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
182         fi
183         @if [ "$(HAS_DOUBLE)" = "true" ] ; then \
184             echo "#define __UCLIBC_HAS_DOUBLE__ 1" >> uClibc_config.h ; \
185         else \
186             echo "#undef __UCLIBC_HAS_DOUBLE__" >> uClibc_config.h ; \
187         fi
188         @if [ "$(HAS_LONG_DOUBLE)" = "true" ] ; then \
189             echo "#define __UCLIBC_HAS_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
190         else \
191             echo "#undef __UCLIBC_HAS_LONG_DOUBLE__" >> uClibc_config.h ; \
192         fi
193         @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
194             echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
195         else \
196             echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
197         fi
198         @if [ "$(HAS_LOCALE)" = "true" ] ; then \
199             echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
200             echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
201         else \
202             echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
203         fi
204         @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
205             echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
206             if [ `expr match "$(CC)" ".*\(m68k-elf-.*\)"`x = x ]; then \
207                 echo "#define const" >> uClibc_config.h ; \
208                 echo "#define __const" >> uClibc_config.h ; \
209                 echo "#define __extension" >> uClibc_config.h ; \
210             fi; \
211         else \
212             echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
213         fi
214         @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
215             echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
216         else \
217             echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
218         fi
219         @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
220             echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
221         else \
222             echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
223         fi
224
225 .PHONY: dummy subdirs
226
This page took 0.035298 seconds and 4 git commands to generate.