OSDN Git Service

I wasn't building the libdl shared lib anymore. Make each lib install a
[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 TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
29
30 DIRS=
31 ifeq ($(strip $(HAS_FLOATS)),true)
32         DIRS+=float
33 endif
34 ifeq ($(strip $(HAS_DOUBLE)),true)
35         DIRS+=double
36 endif
37 ifeq ($(strip $(HAS_LONG_DOUBLE)),true)
38         DIRS+=ldouble
39 endif
40 ALL_SUBDIRS = float double ldouble
41
42 all: $(LIBM)
43
44 $(LIBM): subdirs
45         @if [ -f $(LIBM) ] ; then \
46                 install -d $(TOPDIR)lib; \
47                 rm -f $(TOPDIR)lib/$(LIBM); \
48                 install -m 644 $(LIBM) $(TOPDIR)lib; \
49         fi;
50
51 tags:
52         ctags -R
53         
54 shared: all
55         if [ -f $(LIBM) ] ; then \
56                 $(TARGET_CC) $(LDFLAGS) -shared -o $(LIBM_SHARED_FULLNAME) \
57                     -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive \
58                     $(LIBM) $(TOPDIR)lib/$(SHARED_FULLNAME); \
59                 install -d $(TOPDIR)lib; \
60                 rm -f $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION); \
61                 install -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib; \
62                 (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED)); \
63                 (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED).$(MAJOR_VERSION)); \
64         fi;
65
66 subdirs: $(patsubst %, _dir_%, $(DIRS))
67 subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
68
69 $(patsubst %, _dir_%, $(DIRS)) : dummy
70         $(MAKE) -C $(patsubst _dir_%, %, $@)
71
72 $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
73         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
74
75 clean: subdirs_clean
76         rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM_SHARED_FULLNAME)*
77
78 .PHONY: dummy
79
80