[PATCHv2] soft-fp: Automatically create KF files from TF ones

Message ID 1445889660-24640-1-git-send-email-tuliom@linux.vnet.ibm.com
State Not applicable
Delegated to: Joseph Myers
Headers

Commit Message

Tulio Magno Quites Machado Filho Oct. 26, 2015, 8:01 p.m. UTC
  Joseph Myers <joseph@codesourcery.com> writes:

> Even in GCC, creating generated files like that in the source directory 
> would be wrong.  If you can create them with a sed script, you can do so 
> at build time and put the files in the build directory, not the source 
> directory (which should be able to be on a read-only filesystem).

Ack.  What about this new version?

----8<----

Use a sed script to automatically generate KF files based on their
respective TF.

2015-10-26  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
            Michael Meissner  <meissner@linux.vnet.ibm.com>

	* soft-fp/Makefile: Generate KF files from TF.
---
 soft-fp/Makefile | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
  

Comments

Joseph Myers Oct. 26, 2015, 10:31 p.m. UTC | #1
On Mon, 26 Oct 2015, Tulio Magno Quites Machado Filho wrote:

> Joseph Myers <joseph@codesourcery.com> writes:
> 
> > Even in GCC, creating generated files like that in the source directory 
> > would be wrong.  If you can create them with a sed script, you can do so 
> > at build time and put the files in the build directory, not the source 
> > directory (which should be able to be on a read-only filesystem).
> 
> Ack.  What about this new version?

I still say this belongs in the libgcc makefiles, not in glibc at all.
  
Tulio Magno Quites Machado Filho Oct. 27, 2015, 11:20 a.m. UTC | #2
Joseph Myers <joseph@codesourcery.com> writes:

> On Mon, 26 Oct 2015, Tulio Magno Quites Machado Filho wrote:
>
>> Joseph Myers <joseph@codesourcery.com> writes:
>> 
>> > Even in GCC, creating generated files like that in the source directory 
>> > would be wrong.  If you can create them with a sed script, you can do so 
>> > at build time and put the files in the build directory, not the source 
>> > directory (which should be able to be on a read-only filesystem).
>> 
>> Ack.  What about this new version?
>
> I still say this belongs in the libgcc makefiles, not in glibc at all.

OK.  I thought you were referring only to the other patch.

Thanks!
  

Patch

diff --git a/soft-fp/Makefile b/soft-fp/Makefile
index 28f9f0c..f5ea630 100644
--- a/soft-fp/Makefile
+++ b/soft-fp/Makefile
@@ -37,4 +37,22 @@  gcc-quad-routines := negtf2 addtf3 subtf3 multf3 divtf3 eqtf2 \
 	fixunstfdi floatditf extendsftf2 trunctfsf2 extenddftf2 \
 	trunctfdf2 sqrttf2 floatunsitf floatunditf
 
+# Auto-generate KF routines list, removing unused files.
+gcc-kf-routines-auto := $(subst tf,kf,\
+                          $(filter-out sqrttf2,$(gcc-quad-routines)))
+gcc-kf-routines-auto-files := $(addprefix $(objpfx),\
+                                          $(addsuffix .c,\
+                                                      $(gcc-kf-routines-auto)))
+
+generate-routines: $(gcc-kf-routines-auto-files)
+
+clean:
+	-rm -f $(gcc-kf-routines-auto-files)
+
 include ../Rules
+
+.SECONDEXPANSION:
+$(gcc-kf-routines-auto-files): $$(subst kf,tf,$$(@F))
+	@mkdir -p $(objpfx)
+	@sed -e 's/\(__[a-z]\+\)tf\([a-z0-9]*\)/\1kf\2/g' \
+	     -e 's/quad[.]h/quad-float128.h/g' $< > $@