OSDN Git Service

One last structural change. Install header files to INSTALLDIR/usr/include
[uclinux-h8/uClibc.git] / Makefile
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000, 2001 by Lineo, inc.
4 # Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
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
13 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
14 # details.
15 #
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
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
24 #--------------------------------------------------------
25 #
26 #There are a number of configurable options in "Config"
27 #
28 #--------------------------------------------------------
29
30 TOPDIR=./
31 include Rules.mak
32
33 ifeq ($(DO_SHARED),shared)
34     LDSO_DIR = ldso
35 endif
36 DIRS = extra $(LDSO_DIR) libc libcrypt libresolv libutil libm  
37
38 all: headers uClibc_config.h subdirs $(DO_SHARED) done
39
40 shared:
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
46
47 done: $(DO_SHARED)
48         @echo
49         @echo Finally finished compiling...
50         @echo
51
52 headers: dummy
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 \
56             echo " "; \
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."; \
60             echo " "; \
61             /bin/false; \
62         fi;
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'"; \
66             echo " "; \
67             sleep 10; \
68         fi;
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)
72
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 ; \
82         else \
83             echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
84         fi
85         @if [ "$(HAS_FLOATS)" = "true" ] ; then \
86             echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
87         else \
88             echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
89         fi
90         @if [ "$(HAS_DOUBLE)" = "true" ] ; then \
91             echo "#define __UCLIBC_HAS_DOUBLE__ 1" >> uClibc_config.h ; \
92         else \
93             echo "#undef __UCLIBC_HAS_DOUBLE__" >> uClibc_config.h ; \
94         fi
95         @if [ "$(HAS_LONG_DOUBLE)" = "true" ] ; then \
96             echo "#define __UCLIBC_HAS_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
97         else \
98             echo "#undef __UCLIBC_HAS_LONG_DOUBLE__" >> uClibc_config.h ; \
99         fi
100         @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
101             echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
102         else \
103             echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
104         fi
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 ; \
108         else \
109             echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
110         fi
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 ; \
117             fi; \
118         else \
119             echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
120         fi
121         @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
122             echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
123         else \
124             echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
125         fi
126         @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
127             echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
128         else \
129             echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
130         fi
131
132 subdirs: $(patsubst %, _dir_%, $(DIRS))
133
134 $(patsubst %, _dir_%, $(DIRS)) : dummy
135         $(MAKE) -C $(patsubst _dir_%, %, $@)
136
137 tags:
138         ctags -R
139
140 install: install_runtime install_dev
141
142 # Installs shared library
143 install_runtime:
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
149         ldso/util/ldconfig
150 #endif
151
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.
156 install_dev:
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
169
170 clean:
171         @rm -rf tmp lib
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 {} \;
174
175 .PHONY: dummy subdirs
176