OSDN Git Service

Re-establish pattern rules for %_generic.c; (cf. issue #2175)
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 27 Jan 2014 22:13:35 +0000 (22:13 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 27 Jan 2014 22:13:35 +0000 (22:13 +0000)
--HG--
rename : src/libcrt/math/asinh.c => src/libcrt/math/asinh_generic.c

ChangeLog
Makefile.in
src/libcrt/math/asinh_generic.c [moved from src/libcrt/math/asinh.c with 99% similarity]
src/libcrt/math/lround.c [deleted file]
src/libcrt/math/lround_generic.c
src/libcrt/math/lroundf.c [deleted file]
src/libcrt/math/lroundl.c [deleted file]
src/libcrt/math/round.c [deleted file]
src/libcrt/math/round_generic.c
src/libcrt/math/roundf.c [deleted file]
src/libcrt/math/roundl.c [deleted file]

index 655f5f2..25310fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2014-01-27  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Re-establish pattern rules for %_generic.c; (cf. issue #2175)
+
+       * src/libcrt/math/round.c: Delete it; this kludgey stub isn't needed.
+       * src/libcrt/math/roundf.c src/libcrt/math/roundl.c: Likewise.
+       * src/libcrt/math/lround.c src/libcrt/math/lroundf.c: Likewise.
+       * src/libcrt/math/lroundl.c: Likewise.
+
+       * src/libcrt/math/asinh.c: Rename to...
+       * src/libcrt/math/asinh_generic.c: ...this; compliance with the
+       math_generic.c naming convention is imperative.
+
+       * src/libcrt/math/round_generic.c: Reinstate author attribution.
+       * src/libcrt/math/lround_generic.c: Likewise.
+
+       * Makefile.in (math_SOURCES): Remove references to deleted files; add
+       references to corresponding %_generic.c sources, in their place.
+       (libmingwex_a_OBJECTS): Filter %_generic references, to generate the
+       corresponding %.o, %f.o, and %l.o references; append llround%.o set.
+       Adjust pattern rules to build each set of three; add a static pattern
+       rule, to accommodate special requirements of the llround% set.
+
 2014-01-22  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Reinstate complex math functions; (cf. issue #2174)
index f22c8d8..f1637df 100644 (file)
@@ -364,7 +364,7 @@ math_SOURCES := \
   $(SRCDIR)/acoshl.c \
   $(SRCDIR)/acosl.c \
   $(SRCDIR)/asinf.c \
-  $(SRCDIR)/asinh.c \
+  $(SRCDIR)/asinh_generic.c \
   $(SRCDIR)/asinl.c \
   $(SRCDIR)/atan2f.c \
   $(SRCDIR)/atan2l.c \
@@ -454,9 +454,7 @@ math_SOURCES := \
   $(SRCDIR)/lrint.c \
   $(SRCDIR)/lrintf.c \
   $(SRCDIR)/lrintl.c \
-  $(SRCDIR)/lround.c \
-  $(SRCDIR)/lroundl.c \
-  $(SRCDIR)/lroundf.c \
+  $(SRCDIR)/lround_generic.c \
   $(SRCDIR)/modff.c \
   $(SRCDIR)/modfl.c \
   $(SRCDIR)/nearbyint.S \
@@ -481,9 +479,7 @@ math_SOURCES := \
   $(SRCDIR)/rint.c \
   $(SRCDIR)/rintf.c \
   $(SRCDIR)/rintl.c \
-  $(SRCDIR)/round.c \
-  $(SRCDIR)/roundf.c \
-  $(SRCDIR)/roundl.c \
+  $(SRCDIR)/round_generic.c \
   $(MSRCDIR)/s_erf.c \
   $(SRCDIR)/scalbn.S \
   $(SRCDIR)/scalbnf.S \
@@ -620,11 +616,13 @@ libmingwex_a_SOURCES := \
   $(wchar_SOURCES) \
   $(wctype_SOURCES)
 libmingwex_a_OBJECTS := $(libmingwex_a_SOURCES:.c=.o)
-libmingwex_a_OBJECTS := $(libmingwex_a_OBJECTS:.S=.o)
-
-SRCDIR := src/libcrt/math
-libmingwex_a_OBJECTS := $(libmingwex_a_OBJECTS) $(SRCDIR)/asinhl.o
-libmingwex_a_OBJECTS := $(libmingwex_a_OBJECTS) $(SRCDIR)/asinhf.o
+libmingwex_a_OBJECTS := $(libmingwex_a_OBJECTS:.S=.o) \
+  src/libcrt/math/llround_generic.o
+libmingwex_a_generic_objects := $(filter %_generic.o,$(libmingwex_a_OBJECTS))
+libmingwex_a_OBJECTS := $(libmingwex_a_OBJECTS:%_generic.o=%.o) \
+  $(libmingwex_a_generic_objects:%_generic.o=%f.o) \
+  $(libmingwex_a_generic_objects:%_generic.o=%l.o)
+libmingwex_a_OBJECTS := $(sort $(libmingwex_a_OBJECTS))
 
 SRCDIR := misc/src/libdinput
 libdinput_a_SOURCES := \
@@ -755,14 +753,30 @@ lib%.a: src/lib%/%.o
        $(MKDIR_P) $(@D)
        $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
 
+# For the math sources, we support the convention that a single
+# quux_generic.c source file will produce three objects: quux.o,
+# quuxf.o, and quuxl.o; since a change in the common source file
+# will require all three objects to be recompiled, we may handle
+# this with a single, multiple target, pattern rule.
+#
 SRCDIR := src/libcrt/math
-$(SRCDIR)/%f.o: $(SRCDIR)/%.c
+$(SRCDIR)/%.o $(SRCDIR)/%f.o $(SRCDIR)/%l.o: $(SRCDIR)/%_generic.c
        $(MKDIR_P) $(@D)
-       $(CC) -c -D FUNCTION=$(@F:.o=) $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
-
-$(SRCDIR)/%l.o: $(SRCDIR)/%.c
+       $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $(@D)/$*.o $<
+       $(CC) -c -D FUNCTION=$*f $(CPPFLAGS) $(ALL_CFLAGS) -o $(@D)/$*f.o $<
+       $(CC) -c -D FUNCTION=$*l $(CPPFLAGS) $(ALL_CFLAGS) -o $(@D)/$*l.o $<
+
+# The llround.o, llroundf.o, and llroundl.o variants are a special
+# case of the preceding rule; (the source is lround_generic.c rather
+# than llround_generic.c).  We can handle this using the following
+# static pattern rule, (again, compiling all three objects).
+#
+$(SRCDIR)/llroundf.o $(SRCDIR)/llroundl.o: $(SRCDIR)/llround.o
+$(SRCDIR)/llround.o: $(SRCDIR)/%.o: $(SRCDIR)/lround_generic.c
        $(MKDIR_P) $(@D)
-       $(CC) -c -D FUNCTION=$(@F:.o=) $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
+       $(CC) -c -D FUNCTION=$* $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $<
+       $(CC) -c -D FUNCTION=$*f $(CPPFLAGS) $(ALL_CFLAGS) -o $(@D)/$*f.o $<
+       $(CC) -c -D FUNCTION=$*l $(CPPFLAGS) $(ALL_CFLAGS) -o $(@D)/$*l.o $<
 
 SRCDIR := src/libcrt/crt
 $(SRCDIR)/crt2.o $(SRCDIR)/dllcrt2.o:
similarity index 99%
rename from src/libcrt/math/asinh.c
rename to src/libcrt/math/asinh_generic.c
index cffc318..f892997 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * @file asinh.c
+ * @file asinh_generic.c
  * Copyright 2012, 2013 MinGW.org project
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
diff --git a/src/libcrt/math/lround.c b/src/libcrt/math/lround.c
deleted file mode 100644 (file)
index d2cecd8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file lround.c
- * Copyright 2012, 2013 MinGW.org project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#define FUNCTION lround
-#include "lround_generic.c"
index 1a9ee1b..72a4a00 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * @file lround_generic.c
- * Copyright 2012, 2013 MinGW.org project
+ * Copyright 2008, 2012-2014 MinGW.org Project
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-
 /*
+ * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+ *
+ *
  * Provides a generic implementation for the `lround()', `lroundf()',
  * `lroundl()', `llround()', `llroundf()' and `llroundl()' functions;
  * compile with `-D FUNCTION=name', with `name' set to each of these
  * six in turn, to create separate object files for each of the six
  * functions.
+ *
  */
 #ifndef FUNCTION
 /*
diff --git a/src/libcrt/math/lroundf.c b/src/libcrt/math/lroundf.c
deleted file mode 100644 (file)
index 3ae8b76..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file lroundf.c
- * Copyright 2012, 2013 MinGW.org project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#define FUNCTION lroundf
-#include "lround_generic.c"
diff --git a/src/libcrt/math/lroundl.c b/src/libcrt/math/lroundl.c
deleted file mode 100644 (file)
index a4d476f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file lroundl.c
- * Copyright 2012, 2013 MinGW.org project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#define FUNCTION lroundl
-#include "lround_generic.c"
diff --git a/src/libcrt/math/round.c b/src/libcrt/math/round.c
deleted file mode 100644 (file)
index 639e143..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file round.c
- * Copyright 2012, 2013 MinGW.org project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#define FUNCTION round
-#include "round_generic.c"
index fe95724..068dc06 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * @file round_generic.c
- * Copyright 2012, 2013 MinGW.org project
+ * Copyright 2008, 2012-2014 MinGW.org Project
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-
 /*
+ * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
+ *
+ *
  * Provides a generic implementation for the `round()', `roundf()'
  * and `roundl()' functions; compile with `-D FUNCTION=name', with
  * `name' set to each of these three in turn, to create separate
  * object files for each of the three functions.
+ *
  */
 #ifndef FUNCTION
 /*
diff --git a/src/libcrt/math/roundf.c b/src/libcrt/math/roundf.c
deleted file mode 100644 (file)
index 668943e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file roundf.c
- * Copyright 2012, 2013 MinGW.org project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#define FUNCTION roundf
-#include "round_generic.c"
diff --git a/src/libcrt/math/roundl.c b/src/libcrt/math/roundl.c
deleted file mode 100644 (file)
index d47d2ca..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * @file roundl.c
- * Copyright 2012, 2013 MinGW.org project
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- * 
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-#define FUNCTION roundl
-#include "round_generic.c"