1# This file is part of grecs - Gray's Extensible Configuration System
2# Copyright (C) 2007-2019 Sergey Poznyakoff
3#
4# Grecs is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# Grecs is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with Grecs.  If not, see <http://www.gnu.org/licenses/>.
16
17EXTRA_DIST = \
18 $(TESTSUITE_AT)\
19 testsuite\
20 package.m4\
21 gcf1.conf\
22 bind.conf\
23 bind.keys\
24 bind.int.conf\
25 bind.ext.conf\
26 bind.dlz\
27 dhcpd.conf\
28 meta1.conf\
29 git.conf
30
31DISTCLEANFILES       = atconfig $(check_SCRIPTS)
32MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
33
34PARSER_DEFS =
35
36if GRECS_COND_META1_PARSER
37  PARSER_DEFS += ENABLE_META1_PARSER
38endif
39
40if GRECS_COND_BIND_PARSER
41  PARSER_DEFS += ENABLE_BIND_PARSER
42endif
43
44if GRECS_COND_DHCPD_PARSER
45  PARSER_DEFS += ENABLE_DHCPD_PARSER
46endif
47
48if GRECS_COND_GIT_PARSER
49  PARSER_DEFS += ENABLE_GIT_PARSER
50endif
51
52if GRECS_COND_JSON
53  PARSER_DEFS += ENABLE_JSON
54endif
55
56## ------------ ##
57## package.m4.  ##
58## ------------ ##
59
60$(srcdir)/package.m4: $(top_srcdir)/configure.ac $(top_srcdir)/@GRECS_SUBDIR@/am/grecs.m4
61	$(AM_V_GEN){                                      \
62	  echo '# Signature of the current package.'; \
63	  echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
64	  echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
65	  echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
66	  echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
67	  echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
68          echo 'm4_define([GRECS_DISTCK_AT],      [@GRECS_DISTCK_AT@])'; \
69          for var in $(PARSER_DEFS); do \
70            echo "m4_define([$$var],1)"; \
71          done; \
72	} >$(srcdir)/package.m4
73
74#
75
76## ------------ ##
77## Test suite.  ##
78## ------------ ##
79
80TESTSUITE_AT = \
81 bind00.at\
82 cfhelp.at\
83 empty.at\
84 format00.at\
85 format01.at\
86 format02.at\
87 glob00.at\
88 glob01.at\
89 glob02.at\
90 glob03.at\
91 glob04.at\
92 glob05.at\
93 grecs00.at\
94 enum.at\
95 incl00.at\
96 incl01.at\
97 incl02.at\
98 incl03.at\
99 join.at\
100 json00.at\
101 json01.at\
102 locus00.at\
103 locus01.at\
104 locus02.at\
105 locus-bind.at\
106 locus-git.at\
107 locus-meta1.at\
108 parser-dhcpd.at\
109 parser-bind.at\
110 parser-git.at\
111 parser-meta1.at\
112 path-locus.at\
113 peek00.at\
114 peek01.at\
115 peek02.at\
116 peek03.at\
117 reduce00.at\
118 reduce01.at\
119 reduce02.at\
120 reduce03.at\
121 set.at\
122 sort00.at\
123 sort01.at\
124 stradj.at\
125 strcat.at\
126 testsuite.at\
127 vercmp.at\
128 @GRECS_DISTCK_AT@
129
130TESTSUITE = $(srcdir)/testsuite
131M4=m4
132
133AUTOTEST = $(AUTOM4TE) --language=autotest
134$(TESTSUITE): package.m4 $(TESTSUITE_AT)
135	$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
136	mv $@.tmp $@
137
138atconfig: $(top_builddir)/config.status
139	cd $(top_builddir) && ./config.status tests/$@
140
141clean-local: clean-wordsplit
142	test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
143
144check-local: check-wordsplit atconfig atlocal $(TESTSUITE) $(noinst_PROGRAMS)
145	$(SHELL) $(TESTSUITE)
146
147# Run the test suite on the *installed* tree.
148#installcheck-local:
149#	$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
150
151noinst_PROGRAMS = \
152 distck\
153 gcffmt\
154 gcfenum\
155 gcfpeek\
156 gcfset\
157 gcfver
158
159if GRECS_COND_JSON
160  noinst_PROGRAMS += json
161endif
162
163LDADD = @GRECS_LDADD@ $(LIBINTL) $(LIBICONV) @GRECS_HOST_PROJECT_LDADD@
164AM_CPPFLAGS = @GRECS_INCLUDES@ @GRECS_HOST_PROJECT_INCLUDES@ -I$(srcdir)
165
166# Wordsplit testsuite
167WSTEST = $(srcdir)/wstest
168EXTRA_DIST += wstest wstest.at wspackage.m4 wordsplit-version.h
169$(WSTEST): wstest.at $(top_srcdir)/@GRECS_SUBDIR@/wordsplit/wordsplit.at $(srcdir)/wspackage.m4
170	$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) \
171                  -I $(top_srcdir)/@GRECS_SUBDIR@/wordsplit \
172                  wspackage.m4 \
173                  wstest.at \
174                  wordsplit.at \
175	          -o $(WSTEST).tmp
176	$(AM_V_at)mv $(WSTEST).tmp $(WSTEST)
177
178$(srcdir)/wspackage.m4: $(top_srcdir)/configure.ac $(top_srcdir)/@GRECS_SUBDIR@/am/grecs.m4
179	$(AM_V_GEN){\
180	    if test -e $(top_srcdir)/@GRECS_SUBDIR@/wordsplit/.git; then \
181	        wsversion=$$(cd $(top_srcdir)/@GRECS_SUBDIR@/wordsplit; git describe); \
182	    else \
183                wsversion="unknown"; \
184	    fi;\
185            echo 'm4_define([AT_PACKAGE_NAME],      [wordsplit])'; \
186	    echo 'm4_define([AT_PACKAGE_TARNAME],   [wordsplit])'; \
187	    echo "m4_define([AT_PACKAGE_VERSION],   [$$wsversion])"; \
188	    echo 'm4_define([AT_PACKAGE_STRING],    [AT_PACKAGE_TARNAME AT_PACKAGE_VERSION])'; \
189	    echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
190        } > $(srcdir)/wspackage.m4
191
192$(srcdir)/wordsplit-version.h: $(srcdir)/wspackage.m4
193	$(AM_V_GEN){ echo "m4_divert(-1)";\
194          echo "m4_changequote([,])";\
195          echo "m4_changecom([//])";\
196	  echo "m4_include($(srcdir)/wspackage.m4)";\
197	  echo 'm4_divert(0)#define WORDSPLIT_VERSION "AT_PACKAGE_VERSION"'; } | \
198	 $(M4) -P - > $(srcdir)/wordsplit-version.h
199
200noinst_PROGRAMS += wsp
201wsp_SOURCES =
202nodist_wsp_SOURCES = wsp.c
203wsp.o: $(srcdir)/wordsplit-version.h
204VPATH += $(top_srcdir)/@GRECS_SUBDIR@/wordsplit
205
206clean-wordsplit:
207	test ! -f $(WSTEST) || $(SHELL) $(WSTEST) --clean
208
209check-wordsplit: atconfig atlocal $(WSTEST) $(noinst_PROGRAMS)
210	$(SHELL) $(WSTEST)
211
212
213
214