[PATCHv2] soft-fp: Automatically create KF files from TF ones
Commit Message
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
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.
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!
@@ -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' $< > $@