[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] package: don't ship the sources generated from the parser
From: |
Akim Demaille |
Subject: |
[PATCH 1/4] package: don't ship the sources generated from the parser |
Date: |
Sun, 28 Apr 2019 11:41:17 +0200 |
Because some of our examples use
%C%_reccalc_SOURCES = %D%/parse.y
Automake ships parse.y and parse.c, and possibly parse.h when it
"understands" that there is one. This is not what we want: ship only
parser.y. Yet we still want to use Automake to compile the sources
from parser.y. The easiest seems to use
nodist_%C%_reccalc_SOURCES = %D%/parse.y
together with
dist_reccalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
which guarantees that parse.y is indeed shipped.
* examples/c/calc/local.mk, examples/c/lexcalc/local.mk,
* examples/c/reccalc/local.mk: Always use nodist_*SOURCES for parsers,
let the dist_*_DATA rules do their job.
---
examples/c/calc/local.mk | 4 ++--
examples/c/lexcalc/local.mk | 4 ++--
examples/c/reccalc/local.mk | 3 +--
examples/local.mk | 18 ++++++++++++++++++
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/examples/c/calc/local.mk b/examples/c/calc/local.mk
index 6d930dae..9525e65e 100644
--- a/examples/c/calc/local.mk
+++ b/examples/c/calc/local.mk
@@ -22,12 +22,12 @@ calcdir = $(docdir)/%D%
check_PROGRAMS += %D%/calc
TESTS += %D%/calc.test
EXTRA_DIST += %D%/calc.test
-%C%_calc_SOURCES = %D%/calc.y
+nodist_%C%_calc_SOURCES = %D%/calc.y
%D%/calc.c: $(dependencies)
# Don't use gnulib's system headers.
%C%_calc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
dist_calc_DATA = %D%/calc.y %D%/Makefile %D%/README.md
-CLEANFILES += %D%/calc %D%/*.o %D%/parse.c %D%/scan.c
+CLEANFILES += %D%/calc %D%/*.o %D%/scan.c
CLEANDIRS += %D%/*.dSYM
diff --git a/examples/c/lexcalc/local.mk b/examples/c/lexcalc/local.mk
index 74f60109..3be2e4b9 100644
--- a/examples/c/lexcalc/local.mk
+++ b/examples/c/lexcalc/local.mk
@@ -22,12 +22,12 @@ lexcalcdir = $(docdir)/%D%
check_PROGRAMS += %D%/lexcalc
TESTS += %D%/lexcalc.test
EXTRA_DIST += %D%/lexcalc.test
-%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
+nodist_%C%_lexcalc_SOURCES = %D%/parse.y %D%/parse.h %D%/scan.l
%D%/parse.c: $(dependencies)
# Don't use gnulib's system headers.
%C%_lexcalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
dist_lexcalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
-CLEANFILES += %D%/lexcalc %D%/*.o %D%/parse.c %D%/scan.c
+CLEANFILES += %D%/lexcalc %D%/parse.c %D%/scan.c
CLEANDIRS += %D%/*.dSYM
diff --git a/examples/c/reccalc/local.mk b/examples/c/reccalc/local.mk
index bf29aa33..3605cdfc 100644
--- a/examples/c/reccalc/local.mk
+++ b/examples/c/reccalc/local.mk
@@ -22,8 +22,7 @@ reccalcdir = $(docdir)/%D%
check_PROGRAMS += %D%/reccalc
TESTS += %D%/reccalc.test
EXTRA_DIST += %D%/reccalc.test %D%/scan.l
-%C%_reccalc_SOURCES = %D%/parse.y %D%/parse.h
-nodist_%C%_reccalc_SOURCES = %D%/scan.h %D%/scan.c
+nodist_%C%_reccalc_SOURCES = %D%/parse.y %D%/scan.h %D%/scan.c
BUILT_SOURCES += $(nodist_%C%_reccalc_SOURCES)
%D%/parse.c: $(dependencies)
diff --git a/examples/local.mk b/examples/local.mk
index 1cd60457..ff04345c 100644
--- a/examples/local.mk
+++ b/examples/local.mk
@@ -14,6 +14,24 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+## Because some of our examples use
+##
+## %C%_reccalc_SOURCES = %D%/parse.y
+##
+## Automake ships parse.y and parse.c, and possibly parse.h when it
+## "understands" that there is one. This is not what we want: ship only
+## parser.y. Yet we still want to use Automake to compile the sources
+## from parser.y. The easiest seems to use
+##
+## nodist_%C%_reccalc_SOURCES = %D%/parse.y
+##
+## together with
+##
+## dist_reccalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
+##
+## which guarantees that parse.y is indeed shipped.
+
dist_noinst_SCRIPTS = %D%/extexi %D%/test
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
--
2.21.0