2006-02-28 Roland McGrath <roland@redhat.com>
[glibc-ports.git] / sysdeps / m68k / fpu / switch / Makefile
blobc04107163cdd7578708141f5005f82c86096ffcf
1 # Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
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 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
19 ifeq ($(subdir),math)
21 sysdep_routines := $(sysdep_routines) switch
23 # Find all the sources that have 68881 versions.
24 +68881-sources := \
25 $(notdir $(wildcard $(addprefix $(filter %/fpu,$(sysdirs)),$(sources))))
27 # Sysdep directories other than fpu and fpu/switch (this one).
28 +non68881-dirs := $(filter-out %/fpu %/fpu/switch,$(+sysdep_dirs))
30 # Get a non-68881 version of the target.
31 +non68881-version = $(firstword $(wildcard $(addsuffix /$@,$(+non68881-dirs))))
33 # Directory containing 68881 sources.
34 +68881-dir := $(filter %/fpu,$(+sysdep_dirs))
36 # For all the files that have 68881 versions and don't exist already in
37 # the source directory (math), automatically make ones that switch between
38 # 68881 and soft versions.
39 $(addprefix $(objpfx), \
40 $(filter-out $(wildcard $(+68881-sources)),$(+68881-sources))):
41 (echo '#include <68881-sw.h>' ;\
42 echo '#define $* __$*_68881' ;\
43 echo '#include <$(+68881-dir)/$@>' ;\
44 echo '#undef $*' ;\
45 echo '#define $* __$*_soft' ;\
46 echo '#include <$(non68881-version)>' ;\
47 echo '#undef $*' ;\
48 echo 'switching_function($*);') > $@-tmp
49 mv $@-tmp $@
51 endif