Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Makefile for uClibc's math library
  2. #
  3. # Copyright (C) 2001 by Lineo, inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify it under
  6. # the terms of the GNU Library General Public License as published by the Free
  7. # Software Foundation; either version 2 of the License, or (at your option) any
  8. # later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Library General Public License
  16. # along with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  20. # other sundry sources. Files within this library are copyright by their
  21. # respective copyright holders.
  22. TOPDIR=../
  23. include $(TOPDIR)Rules.mak
  24. LIBM=libm.a
  25. LIBM_SHARED=libm.so
  26. LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).so
  27. TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
  28. DIRS=
  29. ifeq ($(strip $(HAS_FLOATS)),true)
  30. DIRS+=float
  31. endif
  32. ifeq ($(strip $(HAS_DOUBLE)),true)
  33. DIRS+=double
  34. endif
  35. ifeq ($(strip $(HAS_LONG_DOUBLE)),true)
  36. DIRS+=ldouble
  37. endif
  38. ALL_SUBDIRS = float double ldouble
  39. all: $(LIBM)
  40. $(LIBM): subdirs
  41. @if [ -f $(LIBM) ] ; then \
  42. install -d $(TOPDIR)lib; \
  43. rm -f $(TOPDIR)lib/$(LIBM); \
  44. install -m 644 $(LIBM) $(TOPDIR)lib; \
  45. fi;
  46. tags:
  47. ctags -R
  48. shared: all
  49. @if [ -f $(LIBM) ] ; then \
  50. $(TARGET_CC) $(LDFLAGS) -shared -o $(LIBM_SHARED_FULLNAME) \
  51. -Wl,-soname,$(LIBM_SHARED).$(MAJOR_VERSION) $(OBJS) $(TOPDIR)$(SHARED_FULLNAME); \
  52. install -d $(TOPDIR)lib; \
  53. rm -f $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION); \
  54. install -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib; \
  55. (cd $(TOPDIR)lib; ln -sf $(LIBM_SHARED_FULLNAME) $(LIBM_SHARED).$(MAJOR_VERSION)); \
  56. fi;
  57. subdirs: $(patsubst %, _dir_%, $(DIRS))
  58. subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
  59. $(patsubst %, _dir_%, $(DIRS)) : dummy
  60. $(MAKE) -C $(patsubst _dir_%, %, $@)
  61. $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
  62. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  63. clean: subdirs_clean
  64. rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM_SHARED_FULLNAME)*
  65. .PHONY: dummy