diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-16 06:58:49 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-16 06:58:49 -0700 |
commit | 655399cf16db0cf931fffc05d9b0de9e6c48183d (patch) | |
tree | 9eaed089e457cb606afe445e30657576d323522d /Makefile | |
parent | c80fe85807b4f5b66815a195c629bc22be4ee69c (diff) | |
download | txr-655399cf16db0cf931fffc05d9b0de9e6c48183d.tar.gz txr-655399cf16db0cf931fffc05d9b0de9e6c48183d.tar.bz2 txr-655399cf16db0cf931fffc05d9b0de9e6c48183d.zip |
build: remove dubious license header from y.tab.c.
The GNU Bison parser has a GPL header in the parser skeleton
which gets copied to the generated parser. The GPL asserts
that the entire file falls under the GPL (but as a special
exception, it may be used in any manner whatsoever in a
program, as long as it isn't used as the skeleton of a parser
generator). The GPL assertion is false; the file is not
entirely derived from the skeleton but contains code directly
copied from parser.y, as well as tables generated from
parser.y's original grammar. Since we are definitely not using
this as a parser skeleton for a parser generator and are thus
allowed to do whatever we want such as compiling this into
proprietary object files, I'm removing the copyright header as
a build step. You never know; someone could package up a built
directory of TXR containing a Bison-generated y.tab.c, and
then it looks like there is a GPL-ed file in the project.
* Makefile (CM): New variable, needed for interpolating
literal commas into macro calls.
(BS_LIC_FROM, BS_LIC_TO): New variables.
(y.tab.c): Filter y.tab.c to remove GPL comment.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -241,6 +241,8 @@ define NL endef +CM := , + define DEP $(1): $(2) @@ -259,6 +261,9 @@ $(eval $(foreach item,lex.yy.o txr.o match.o parser.o,\ $(eval $(foreach item,y.tab.c y.tab.h lex.yy.c,\ $(call DEP,$(item),config.make config.h))) +BS_LIC_FROM := ^[/][*] Bison impl +BS_LIC_TO := Bison. [*][/] + lex.yy.c: $(top_srcdir)parser.l $(call ABBREV,LEX) $(call SH,rm -f $@) @@ -286,6 +291,11 @@ y.tab.c: $(top_srcdir)parser.y $(call SH,rm -f y.tab.c) $(call SH, \ if $(TXR_YACC) -v -d $< ; then \ + grep -qs '$(BS_LIC_FROM)' y.tab.c && \ + grep -qs '$(BS_LIC_TO)' y.tab.c && \ + sed -e '/$(BS_LIC_FROM)/$(CM)/$(BS_LIC_TO)/d' \ + < y.tab.c > y.tab.c.tmp && \ + mv y.tab.c.tmp y.tab.c ; \ chmod a-w y.tab.c ; \ sed -e '/yyparse/d' < y.tab.h > y.tab.h.tmp && \ mv y.tab.h.tmp y.tab.h ; \ |