home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / math / Makefile < prev    next >
Encoding:
Makefile  |  1992-07-30  |  3.2 KB  |  112 lines

  1. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License as
  6. # published by the Free Software Foundation; either version 2 of the
  7. # License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. #
  20. #    Makefile for math.
  21. #
  22. subdir    := math
  23.  
  24. headers    := math.h __math.h huge_val.h nan.h
  25.  
  26.  
  27. routines := acos asin atan cos sin tan cosh sinh tanh exp fabs ldexp    \
  28.         log log10 floor sqrt fmod frexp pow atan2 ceil modf        \
  29.         isinf isnan finite infnan copysign scalb drem logb        \
  30.         __isinf __isnan __finite __infnan __copysign __scalb __drem __logb\
  31.         __rint rint hypot cabs cbrt __expm1 expm1 log1p acosh asinh atanh 
  32. tests := test-math
  33. install-lib := libm.a
  34.  
  35.  
  36. include ../Rules
  37.  
  38.  
  39. $(objpfx)libm.a:
  40.     $(AR) cr $@ /dev/null
  41.  
  42.  
  43. ifneq (,)     # the code is now distributed through ../sysdeps/
  44.  
  45. # Other dirs to look for source files (for dist).
  46. export source_dirs = $(filter-out unused,$(shell find bsd -type d -print))
  47.  
  48. include $(objpfx)BSDmath-files
  49. $(objpfx)BSDmath-files:
  50.     (echo define +ansideclificate-bsd;                \
  51.      echo "(echo '#include <ansidecl.h>';                \
  52.             echo '#include \"\$$<\"') > \$$@-tmp;            \
  53.         mv \$$@-tmp \$$@";                    \
  54.      echo endef;                                \
  55.      for dir in $(source_dirs); do                    \
  56.        echo "\$$(objpfx)%.c: $${dir}/%.c;\$$(+ansideclificate-bsd)";\
  57.      done) > $@-tmp
  58.     mv $@-tmp $@
  59.  
  60.  
  61. ifdef bsdmath_dirs
  62.  
  63. override CPPFLAGS := $(CPPFLAGS) -Ibsd $(addprefix -Ibsd/,$(bsdmath_dirs))
  64.  
  65. +bsdpath := $(subst $+ ,:,bsd $(addprefix bsd/,$(bsdmath_dirs)))
  66. vpath %.s $(+bsdpath)
  67. vpath %.h $(+bsdpath)
  68.  
  69. +bsdfiles := $(wildcard $(patsubst %,bsd/%/*.c,$(bsdmath_dirs)))
  70.  
  71. ifdef +bsdfiles
  72.  
  73. # Find all the files which have both BSD and sysdep versions.
  74. +sysdeps := $(notdir $(wildcard \
  75.                $(foreach dir, \
  76.                  $(filter-out %/generic %/stub, \
  77.                           $(+sysdep_dirs)), \
  78.                  $(addprefix $(dir)/, \
  79.                          $(notdir $(+bsdfiles))))))
  80.  
  81. # Filter these out of the list of BSD files.
  82. +bsdfiles := $(filter-out $(addprefix %/,$(+sysdeps)),$(+bsdfiles))
  83.  
  84. ifdef +bsdfiles
  85. # Assert that all the BSD C sources exist in the object directory,
  86. # so VPATH will find them there first.
  87. $(addprefix $(objpfx),$(notdir $(+bsdfiles))):
  88. endif
  89.  
  90. # See how easy this would be in make v4?
  91. ifneq (,)
  92. define bsd-files
  93. $(foreach dir,$(bsdmath_dirs),
  94. $(objpfx)%.c: bsd/$(dir)/%.c
  95.     (echo '#include <ansidecl.h>'; echo '#include "$<") > $@-tmp
  96.     mv $@-tmp $@
  97. endef
  98. $(bsd-files)
  99. endif
  100.  
  101. ifneq ($(findstring gcc,$(CC)),)
  102. # Disable GCC warnings for grody BSD code.
  103. override CFLAGS := $(filter-out -W%,$(CFLAGS))
  104. # In make v4, put "$(+bsdfiles): " in front of that.
  105. endif
  106.  
  107. endif    # +bsdfiles
  108.  
  109. endif    # bsdmath_dirs
  110.  
  111. endif
  112.