]> git.draconx.ca Git - cdecl99.git/blob - Makefile.am
Add missing test files to the distribution.
[cdecl99.git] / Makefile.am
1 # Copyright © 2011 Nick Bowler
2 #
3 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 # This is free software: you are free to do what the fuck you want to.
5 # There is NO WARRANTY, to the extent permitted by law.
6
7 ACLOCAL_AMFLAGS = -I m4
8 AUTOMAKE_OPTIONS = nostdinc
9
10 # For Gnulib
11 MOSTLYCLEANFILES =
12 noinst_LTLIBRARIES =
13
14 AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
15         -I$(top_builddir)/lib -I$(top_srcdir)/lib \
16         -I$(top_builddir) -I$(top_srcdir) \
17         -I$(top_builddir)/test \
18         -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \
19         -DLOCALEDIR=\"$(localedir)\"
20
21 AM_CFLAGS = $(GSL_CFLAGS)
22
23 MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
24         src/parse.c src/parse.h src/parse.stamp
25
26 CLEANFILES = src/validtypes.h src/errtab.h src/namespecs.h src/ordspecs.h \
27         test/typegen.h
28
29 EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/validtypes.sed \
30         src/specs.lst src/namespecs.sed src/ordspecs.sed \
31         src/errors.lst src/strtab.sed test/typegen.sh \
32         src/parse.y src/parse.stamp src/scan.l src/scan.stamp \
33         COPYING.WTFPL2
34
35 dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
36
37 include_HEADERS = src/cdecl.h
38 noinst_HEADERS = conf_post.h src/typemap.h src/output.h src/scan.h \
39         src/parse.h src/i18n.h src/normalize.h src/error.h test/declgen.h \
40         test/test.h
41
42 noinst_DATA = $(MOFILES)
43
44 lib_LTLIBRARIES = libcdecl.la
45 libcdecl_la_LDFLAGS = -no-undefined \
46         -export-symbols-regex '^cdecl_[[:lower:]]'
47 libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
48         src/output.c src/explain.c src/declare.c src/i18n.c src/error.c \
49         src/normalize.c
50 libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
51 $(libcdecl_la_OBJECTS): $(gnulib_headers)
52
53 bin_PROGRAMS = cdecl99
54
55 check_PROGRAMS =
56 check_LTLIBRARIES = libtest.la
57 libtest_la_LIBADD = $(GSL_LIBS)
58 libtest_la_SOURCES = test/testlib.c
59
60 if HAVE_GSL
61 libtest_la_SOURCES += test/declgen.c
62 check_PROGRAMS += test/randomdecl
63 endif
64
65 cdecl99_SOURCES = src/cdecl99.c
66 cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
67 $(cdecl99_OBJECTS): $(gnulib_headers)
68
69 test_randomdecl_LDADD = libcdecl.la libtest.la libgnu.la
70 $(test_randomdecl_OBJECTS): $(gnulib_headers)
71
72 src/parse.lo: src/scan.h
73 src/scan.lo: src/parse.h
74 src/parse-decl.lo: src/scan.h src/parse.h
75 src/typemap.lo: src/validtypes.h
76 src/error.lo: src/errtab.h
77 src/normalize.lo: src/ordspecs.h
78 src/output.lo: src/namespecs.h
79 test/declgen.lo: test/typegen.h
80
81 src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed
82         $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \
83                 < $(srcdir)/src/types.lst > $@.tmp
84         $(AM_V_at)mv -f $@.tmp $@
85
86 src/namespecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/namespecs.sed
87         $(AM_V_GEN) sed -f $(srcdir)/src/namespecs.sed \
88                 < $(srcdir)/src/specs.lst > $@.tmp
89         $(AM_V_at) mv -f $@.tmp $@
90
91 src/ordspecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/ordspecs.sed
92         $(AM_V_GEN) sed -f $(srcdir)/src/ordspecs.sed \
93                 < $(srcdir)/src/specs.lst > $@.tmp
94         $(AM_V_at) mv -f $@.tmp $@
95
96 src/errtab.h: $(srcdir)/src/errors.lst $(srcdir)/src/strtab.sed
97         $(AM_V_GEN)sed -f $(srcdir)/src/strtab.sed \
98                 < $(srcdir)/src/errors.lst > $@.tmp
99         $(AM_V_at)mv -f $@.tmp $@
100
101 test/typegen.h: $(srcdir)/src/types.lst $(srcdir)/test/typegen.sh
102         $(AM_V_GEN) $(SHELL) $(srcdir)/test/typegen.sh \
103                 < $(srcdir)/src/types.lst > $@.tmp
104         $(AM_V_at)mv -f $@.tmp $@
105
106 # Supporting rules for gettext.
107 ALL_MOFILES = $(POFILES:.po=.mo)
108 EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
109 MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
110 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
111         --add-comments=TRANSLATORS: --foreign-user \
112         --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
113         --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
114         --keyword=_ --keyword=N_ --keyword=PN_:1c,2
115
116 po/$(PACKAGE).pot: $(SOURCES) src/errors.lst
117         $(AM_V_at)  $(MKDIR_P) $(@D)
118         $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
119         $(AM_V_at)  $(XGETTEXT) $(XGETTEXT_OPTS) --omit-header -Lc \
120                 -ajo $@.tmp src/errors.lst
121         $(AM_V_at)  mv -f $@.tmp $@
122
123 .po.mo:
124         $(AM_V_at)$(MKDIR_P) $(@D)
125         $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
126
127 install-data-local: install-mo
128 install-mo: $(MOFILES)
129         for mo in $?; do \
130                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
131                 test x"$$lang" = x"" && exit 1; \
132                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
133                 (set -x; $(MKDIR_P) "$$inst") \
134                         || exit $$?; \
135                 (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") \
136                         || exit $$?; \
137         done
138
139 installdirs-local: installdirs-mo
140 installdirs-mo:
141         for mo in $(MOFILES); do \
142                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
143                 test x"$$lang" = x"" && exit 1; \
144                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
145                 (set -x; $(MKDIR_P) "$$inst") || exit $$?; \
146         done
147
148 uninstall-local: uninstall-mo
149 uninstall-mo:
150         for mo in $(ALL_MOFILES); do \
151                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
152                 test x"$$lang" = x"" && exit 1; \
153                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
154                 (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \
155         done
156
157 .PHONY: install-mo installdirs-mo uninstall-mo
158
159 # These are required to prevent the builtin lex/yacc rules from
160 # superseding ours...
161 src/scan.c src/scan.h: src/scan.stamp
162 src/parse.c src/parse.h: src/parse.stamp
163
164 # The flex/bison rules refrain from updating unchanged headers for the
165 # convenience of developers, but the headers must be distributed with
166 # up-to-date timestamps, otherwise make will try to update them in a fresh
167 # VPATH build.
168 dist-hook: update-headers
169 update-headers: unfuck-distdir
170         touch -c '$(distdir)/src/scan.h'
171         touch -c '$(distdir)/src/parse.h'
172 .PHONY: update-headers
173
174 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
175 # will produce a distribution with all files read-only.  Moreover, the files
176 # are read-only in distdir when the dist hooks are run.  This hook will
177 # manually fix up the permissions.  All dist hooks that modify files in distdir
178 # should list unfuck-distdir as a prerequisite.
179 dist-hook: unfuck-distdir
180 unfuck-distdir:
181         find '$(distdir)' -type f -exec chmod u+w {} +
182 .PHONY: unfuck-distdir
183
184 # Supporting rules for bison/flex.
185
186 BISON_V   = $(BISON_V_$(V))
187 BISON_V_  = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
188 BISON_V_0 = @echo "  BISON " $<;
189
190 FLEX_V   = $(FLEX_V_$(V))
191 FLEX_V_  = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
192 FLEX_V_0 = @echo "  FLEX  " $<;
193
194 .y.c: ;
195 .l.c: ;
196
197 .y.stamp:
198         $(AM_V_at) touch $@.tmp
199         $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
200         $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
201                 rm -f $*.h.tmp; \
202         else \
203                 mv -f $*.h.tmp $*.h; \
204         fi
205         $(AM_V_at) mv -f $@.tmp $@
206
207 .l.stamp:
208         $(AM_V_at) touch $@.tmp
209         $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
210         $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
211                 rm -f $*.h.tmp; \
212         else \
213                 mv -f $*.h.tmp $*.h; \
214         fi
215         $(AM_V_at) mv -f $@.tmp $@
216
217 .stamp.c:
218         @if test -f $@; then :; else \
219                 rm -f $<; \
220                 $(MAKE) $(AM_MAKEFLAGS) $<; \
221         fi
222
223 .stamp.h:
224         @if test -f $@; then :; else \
225                 rm -f $<; \
226                 $(MAKE) $(AM_MAKEFLAGS) $<; \
227         fi
228
229 include $(top_srcdir)/lib/gnulib.mk
230 include $(top_srcdir)/glconfig.mk