OSDN Git Service

Force our child libs to link vs libc
[uclinux-h8/uClibc.git] / libm / Makefile
1 # Makefile for uClibc's math library
2 # Copyright (C) 2001 by Lineo, inc.
3 #
4 # This math library is derived primarily from the Cephes Math Library,
5 # copyright by Stephen L. Moshier <moshier@world.std.com>
6 #
7 # This program is free software; you can redistribute it and/or modify it under
8 # the terms of the GNU Library General Public License as published by the Free
9 # Software Foundation; either version 2 of the License, or (at your option) any
10 # later version.
11 #
12 # This program is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
15 # details.
16 #
17 # You should have received a copy of the GNU Library General Public License
18 # along with this program; if not, write to the Free Software Foundation, Inc.,
19 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #
21
22 TOPDIR=../
23 include $(TOPDIR)Rules.mak
24
25 LIBM=libm.a
26 LIBM_SHARED=libm.so
27 LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).so
28
29 DIRS=
30 ifeq ($(strip $(HAS_LIBM_FLOAT)),true)
31         DIRS+=float
32 endif
33 ifeq ($(strip $(HAS_LIBM_DOUBLE)),true)
34         DIRS+=double
35 endif
36 ifeq ($(strip $(HAS_LIBM_LONG_DOUBLE)),true)
37         DIRS+=ldouble
38 endif
39 ALL_SUBDIRS = float double ldouble
40
41 all: $(LIBM)
42
43 $(LIBM): subdirs
44         @if [ -f $(LIBM) ] ; then \
45                 install -d $(TOPDIR)lib; \
46                 rm -f $(TOPDIR)lib/$(LIBM); \
47                 install -m 644 $(LIBM) $(TOPDIR)lib; \
48         fi;
49
50 tags:
51         ctags -R
52
53 shared: all
54         if [ -f $(LIBM) ] ; then \
55             $(TARGET_CC) $(TARGET_LDFLAGS) -nostdlib -shared -o $(LIBM_SHARED_FULLNAME) \
56                 -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive $(LIBM) -lc; \
57             install -d $(TOPDIR)lib; \
58             rm -f $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION); \
59             install -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib; \
60             (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED)); \
61             (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED).$(MAJOR_VERSION)); \
62         fi;
63
64 subdirs: $(patsubst %, _dir_%, $(DIRS))
65 subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
66
67 $(patsubst %, _dir_%, $(DIRS)) : dummy
68         $(MAKE) -C $(patsubst _dir_%, %, $@)
69
70 $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
71         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
72
73 clean: subdirs_clean
74         rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM_SHARED_FULLNAME)*
75
76 .PHONY: dummy
77
78