Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. TOPDIR=../
  22. include $(TOPDIR)Rules.mak
  23. LIBM=libm.a
  24. LIBM_SHARED=libm.so
  25. LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).so
  26. DIRS=
  27. ifeq ($(strip $(HAS_LIBM_FLOAT)),true)
  28. DIRS+=float
  29. endif
  30. ifeq ($(strip $(HAS_LIBM_DOUBLE)),true)
  31. DIRS+=double
  32. endif
  33. ifeq ($(strip $(HAS_LIBM_LONG_DOUBLE)),true)
  34. DIRS+=ldouble
  35. endif
  36. ALL_SUBDIRS = float double ldouble
  37. all: $(LIBM)
  38. $(LIBM): subdirs
  39. @if [ -f $(LIBM) ] ; then \
  40. install -d $(TOPDIR)lib; \
  41. rm -f $(TOPDIR)lib/$(LIBM); \
  42. install -m 644 $(LIBM) $(TOPDIR)lib; \
  43. fi;
  44. tags:
  45. ctags -R
  46. shared: all
  47. if [ -f $(LIBM) ] ; then \
  48. $(TARGET_CC) $(TARGET_LDFLAGS) -nostdlib -shared -o $(LIBM_SHARED_FULLNAME) \
  49. -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive $(LIBM) -lc; \
  50. install -d $(TOPDIR)lib; \
  51. rm -f $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION); \
  52. install -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib; \
  53. (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED)); \
  54. (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED).$(MAJOR_VERSION)); \
  55. fi;
  56. subdirs: $(patsubst %, _dir_%, $(DIRS))
  57. subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
  58. $(patsubst %, _dir_%, $(DIRS)) : dummy
  59. $(MAKE) -C $(patsubst _dir_%, %, $@)
  60. $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
  61. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  62. clean: subdirs_clean
  63. rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM_SHARED_FULLNAME)*
  64. .PHONY: dummy