]> Git Repo - uclibc-ng.git/blob - Makefile
Ok, this should finish things up
[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 include Rules.mak
30
31 DIRS = misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd extra
32
33 ifeq ($(strip $(HAS_MMU)),true)
34         DO_SHARED=shared
35 endif
36
37 all: $(LIBNAME) $(DO_SHARED) done
38
39 $(LIBNAME): halfclean headers uClibc_config.h subdirs
40         $(CROSS)ranlib $(LIBNAME)
41
42 shared: $(LIBNAME)
43         @rm -rf tmp
44         @mkdir tmp
45         @make -C ld.so-1/d-link
46         @(cd tmp; CC=$(CC) /bin/sh ../extra/scripts/get-needed-libgcc-objects.sh)
47         if [ -s ./tmp/libgcc-need.a ] ; then \
48                 $(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
49                     -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
50                     ./$(LIBNAME) ./tmp/libgcc-need.a \
51                     ld.so-1/d-link/ld-linux-uclibc.so.0; \
52         else \
53                 $(CC) -g $(LDFLAGS) -shared -o $(SHARED_FULLNAME) \
54                     -Wl,-soname,$(SHARED_MAJORNAME) -Wl,--whole-archive \
55                     ./$(LIBNAME) ld.so-1/d-link/ld-linux-uclibc.so.0; \
56         fi
57         @rm -rf tmp
58         ln -sf $(SHARED_FULLNAME) $(SHARED_MAJORNAME)
59         ln -sf $(SHARED_MAJORNAME) libc.so
60         @make -C ld.so-1
61
62 done: $(LIBNAME) $(DO_SHARED)
63         @echo
64         @echo Finally finished compiling...
65         @echo
66
67 halfclean:
68         @rm -f $(LIBNAME) crt0.o uClibc_config.h
69         @rm -f $(SHARED_FULLNAME) $(SHARED_MAJORNAME) libc.so
70
71 headers: dummy
72         @rm -f include/asm include/linux include/bits
73         @ln -s $(KERNEL_SOURCE)/include/asm include/asm
74         @if [ ! -f include/asm/unistd.h ] ; then \
75             echo " "; \
76             echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
77             echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
78             echo "correctly.  Please edit \`Config' and fix these settings."; \
79             echo " "; \
80             /bin/false; \
81         fi;
82         @if [ $(HAS_MMU) != "true" ]  && [ $(TARGET_ARCH) = "i386" ] ; then \
83             echo "WARNING: I bet your x86 system really has an MMU, right?"; \
84             echo "         malloc and friends won't work unless you fix \`Config'"; \
85             echo " "; \
86             sleep 10; \
87         fi;
88         @ln -s $(KERNEL_SOURCE)/include/linux include/linux
89         @ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
90         @ln -sf ../../../../uClibc_config.h sysdeps/linux/$(TARGET_ARCH)/bits/uClibc_config.h
91
92
93 tags:
94         ctags -R
95
96 clean: subdirs_clean halfclean
97         @rm -rf tmp
98         rm -f include/asm include/linux include/bits
99         @make -C ld.so-1 clean
100
101 subdirs: $(patsubst %, _dir_%, $(DIRS))
102 subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) test)
103
104 $(patsubst %, _dir_%, $(DIRS)) : dummy
105         $(MAKE) -C $(patsubst _dir_%, %, $@)
106
107 $(patsubst %, _dirclean_%, $(DIRS) test) : dummy
108         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
109
110 install: install_runtime install_dev install_ldso
111
112 # Installs shared library
113 install_runtime:
114 ifneq ($(DO_SHARED),)
115         install -d $(INSTALL_DIR)/lib
116         rm -rf $(INSTALL_DIR)/lib/$(SHARED_FULLNAME)
117         rm -rf $(INSTALL_DIR)/lib/$(SHARED_MAJORNAME)
118         rm -rf $(INSTALL_DIR)/lib/libc.so
119         install -m 644 $(SHARED_FULLNAME) $(INSTALL_DIR)/lib/
120         (cd $(INSTALL_DIR)/lib;ln -sf $(SHARED_FULLNAME) $(SHARED_MAJORNAME))
121         (cd $(INSTALL_DIR)/lib;ln -sf $(SHARED_MAJORNAME) libc.so)
122 # ldconfig is really not necessary, and impossible to cross
123 #ifeq ($(INSTALL_DIR),)
124 #       /sbin/ldconfig -n $(INSTALL_DIR)/lib
125 #endif
126 else
127         echo shared library not installed
128 endif
129
130 # Installs development library and headers
131 # This is done with the assumption that it can blow away anything
132 # in $(INSTALL_DIR)/include.  Probably true only if you're using
133 # a packaging system.
134 install_dev:
135         install -d $(INSTALL_DIR)/include
136         install -d $(INSTALL_DIR)/include/bits
137         rm -f $(INSTALL_DIR)/include/asm
138         rm -f $(INSTALL_DIR)/include/linux
139         ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
140         ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
141         find include/ -type f -depth -not -path "*CVS*" -exec install -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
142         find include/bits/ -type f -depth -not -path "*CVS*" -exec install -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
143         install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
144         install -d $(INSTALL_DIR)/lib
145         rm -f $(INSTALL_DIR)/lib/$(LIBNAME)
146         install -m 644 $(LIBNAME) $(INSTALL_DIR)/lib/
147         @if [ -f crt0.o ] ; then install -m 644 crt0.o $(INSTALL_DIR)/lib/; fi
148         install -d $(INSTALL_DIR)/bin
149         @if [ -f extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc ] ; then install -m 755 extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc $(INSTALL_DIR)/bin/ ; fi
150
151
152 install_ldso:
153 ifeq ($(strip $(DO_SHARED)),shared)
154         @make -C ld.so-1 install
155 else
156         @echo "Skipping shared library support"
157 endif
158
159 uClibc_config.h: Config
160         @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
161         @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
162         @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
163         @echo "#endif" >> uClibc_config.h
164         @echo "#define linux 1" >> uClibc_config.h 
165         @echo "#define __linux__ 1" >> uClibc_config.h 
166         @if [ "$(HAS_MMU)" = "true" ] ; then \
167             echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
168         else \
169             echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
170         fi
171         @if [ "$(HAS_FLOATS)" = "true" ] ; then \
172             echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
173         else \
174             echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
175         fi
176         @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
177             echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
178         else \
179             echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
180         fi
181         @if [ "$(HAS_LOCALE)" = "true" ] ; then \
182             echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
183             echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
184         else \
185             echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
186         fi
187         @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
188             echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
189             if [ `expr match "$(CC)" ".*\(m68k-elf-.*\)"`x = x ]; then \
190                 echo "#define const" >> uClibc_config.h ; \
191                 echo "#define __const" >> uClibc_config.h ; \
192                 echo "#define __extension" >> uClibc_config.h ; \
193             fi; \
194         else \
195             echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
196         fi
197         @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
198             echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
199         else \
200             echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
201         fi
202
203 .PHONY: dummy
204
This page took 0.035483 seconds and 4 git commands to generate.