3 # Copyright (C) 2000, 2001 by Lineo, inc.
4 # Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
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
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
13 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
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
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.
24 #--------------------------------------------------------
26 #There are a number of configurable options in "Config"
28 #--------------------------------------------------------
33 ifeq ($(DO_SHARED),shared)
36 DIRS = extra $(LDSO_DIR) libc libcrypt libresolv libutil libm
38 all: headers uClibc_config.h subdirs $(DO_SHARED) done
41 @$(MAKE) -C libc shared
42 @$(MAKE) -C ldso shared
43 @$(MAKE) -C libcrypt shared
44 @$(MAKE) -C libutil shared
45 @$(MAKE) -C libm shared
49 @echo Finally finished compiling...
53 @rm -f include/asm include/linux include/bits
54 @ln -s $(KERNEL_SOURCE)/include/asm include/asm
55 @if [ ! -f include/asm/unistd.h ] ; then \
57 echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
58 echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
59 echo "correctly. Please edit \`Config' and fix these settings."; \
63 @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
64 echo "WARNING: I bet your x86 system really has an MMU, right?"; \
65 echo " malloc and friends won't work unless you fix \`Config'"; \
69 @ln -s $(KERNEL_SOURCE)/include/linux include/linux
70 @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
71 (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
73 uClibc_config.h: Config
74 @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
75 @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
76 @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
77 @echo "#endif" >> uClibc_config.h
78 @echo "#define linux 1" >> uClibc_config.h
79 @echo "#define __linux__ 1" >> uClibc_config.h
80 @if [ "$(HAS_MMU)" = "true" ] ; then \
81 echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
83 echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
85 @if [ "$(HAS_FLOATS)" = "true" ] ; then \
86 echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
88 echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
90 @if [ "$(HAS_DOUBLE)" = "true" ] ; then \
91 echo "#define __UCLIBC_HAS_DOUBLE__ 1" >> uClibc_config.h ; \
93 echo "#undef __UCLIBC_HAS_DOUBLE__" >> uClibc_config.h ; \
95 @if [ "$(HAS_LONG_DOUBLE)" = "true" ] ; then \
96 echo "#define __UCLIBC_HAS_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
98 echo "#undef __UCLIBC_HAS_LONG_DOUBLE__" >> uClibc_config.h ; \
100 @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
101 echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
103 echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
105 @if [ "$(HAS_LOCALE)" = "true" ] ; then \
106 echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
107 echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
109 echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
111 @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
112 echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
113 if [ `expr match "$(CC)" ".*\(m68k-elf-.*\)"`x = x ]; then \
114 echo "#define const" >> uClibc_config.h ; \
115 echo "#define __const" >> uClibc_config.h ; \
116 echo "#define __extension" >> uClibc_config.h ; \
119 echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
121 @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
122 echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
124 echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
126 @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
127 echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
129 echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
132 subdirs: $(patsubst %, _dir_%, $(DIRS))
134 $(patsubst %, _dir_%, $(DIRS)) : dummy
135 $(MAKE) -C $(patsubst _dir_%, %, $@)
140 install: install_runtime install_dev
142 # Installs shared library
144 install -d $(INSTALL_DIR)/lib
145 cp -fa lib/* $(INSTALL_DIR)/lib;
146 #ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
147 ln -sf $(INSTALL_DIR)/lib/$(UCLIBC_LDSO) /lib/$(UCLIBC_LDSO);
148 install -d $(INSTALL_DIR)/etc
152 # Installs development library and headers
153 # This is done with the assumption that it can blow away anything
154 # in $(INSTALL_DIR)/include. Probably true only if you're using
155 # a packaging system.
157 install -d $(INSTALL_DIR)/usr/include
158 install -d $(INSTALL_DIR)/usr/include/bits
159 rm -f $(INSTALL_DIR)/usr/include/asm
160 rm -f $(INSTALL_DIR)/usr/include/linux
161 ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/usr/include/asm
162 ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/usr/include/linux
163 find include/ -type f -depth -not -path "*CVS*" -exec install \
164 -D -m 644 {} $(INSTALL_DIR)/usr/'{}' ';'
165 find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
166 -D -m 644 {} $(INSTALL_DIR)/usr/'{}' ';'
167 install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/usr/include/bits/
168 $(MAKE) -C extra/gcc-uClibc install
172 rm -f include/asm include/linux include/bits uClibc_config.h
173 - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
175 .PHONY: dummy subdirs