1 # Copyright © 2011 Nick Bowler
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.
7 ACLOCAL_AMFLAGS = -I m4
13 AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
14 -I$(top_builddir)/lib -I$(top_srcdir)/lib \
15 -I$(top_builddir)/test \
16 -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \
17 -DLOCALEDIR=\"$(localedir)\"
19 AM_CFLAGS = $(GSL_CFLAGS)
21 MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
22 src/parse.c src/parse.h src/parse.stamp
24 CLEANFILES = src/validtypes.h src/errtab.h src/namespecs.h src/ordspecs.h \
27 EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/validtypes.sed \
28 src/specs.lst src/namespecs.sed src/ordspecs.sed \
29 src/errors.lst src/strtab.sed test/typegen.sh \
30 src/parse.y src/parse.stamp src/scan.l src/scan.stamp \
33 dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
35 include_HEADERS = src/cdecl.h
36 noinst_HEADERS = conf_pre.h conf_post.h src/typemap.h src/output.h src/scan.h \
37 src/parse.h src/i18n.h src/normalize.h src/error.h test/declgen.h \
40 noinst_DATA = $(MOFILES)
42 lib_LTLIBRARIES = libcdecl.la
43 libcdecl_la_LDFLAGS = -no-undefined \
44 -export-symbols-regex '^cdecl_[[:lower:]]'
45 libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
46 src/output.c src/explain.c src/declare.c src/i18n.c src/error.c \
48 libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
49 $(libcdecl_la_OBJECTS): $(gnulib_headers)
51 bin_PROGRAMS = cdecl99
54 check_LTLIBRARIES = libtest.la
55 libtest_la_LIBADD = $(GSL_LIBS)
56 libtest_la_SOURCES = test/testlib.c
57 $(libtest_la_OBJECTS): $(gnulib_headers)
60 libtest_la_SOURCES += test/declgen.c
61 check_PROGRAMS += test/randomdecl
64 cdecl99_SOURCES = src/cdecl99.c
65 cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
66 $(cdecl99_OBJECTS): $(gnulib_headers)
68 test_randomdecl_LDADD = libcdecl.la libtest.la libgnu.la
69 $(test_randomdecl_OBJECTS): $(gnulib_headers)
71 src/parse.lo: src/scan.h
72 src/scan.lo: src/parse.h
73 src/parse-decl.lo: src/scan.h src/parse.h
74 src/typemap.lo: src/validtypes.h
75 src/error.lo: src/errtab.h
76 src/normalize.lo: src/ordspecs.h
77 src/output.lo: src/namespecs.h
78 test/declgen.lo: test/typegen.h
80 src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed
81 $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \
82 < $(srcdir)/src/types.lst > $@.tmp
83 $(AM_V_at)mv -f $@.tmp $@
85 src/namespecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/namespecs.sed
86 $(AM_V_GEN) sed -f $(srcdir)/src/namespecs.sed \
87 < $(srcdir)/src/specs.lst > $@.tmp
88 $(AM_V_at) mv -f $@.tmp $@
90 src/ordspecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/ordspecs.sed
91 $(AM_V_GEN) sed -f $(srcdir)/src/ordspecs.sed \
92 < $(srcdir)/src/specs.lst > $@.tmp
93 $(AM_V_at) mv -f $@.tmp $@
95 src/errtab.h: $(srcdir)/src/errors.lst $(srcdir)/src/strtab.sed
96 $(AM_V_GEN)sed -f $(srcdir)/src/strtab.sed \
97 < $(srcdir)/src/errors.lst > $@.tmp
98 $(AM_V_at)mv -f $@.tmp $@
100 test/typegen.h: $(srcdir)/src/types.lst $(srcdir)/test/typegen.sh
101 $(AM_V_GEN) $(SHELL) $(srcdir)/test/typegen.sh \
102 < $(srcdir)/src/types.lst > $@.tmp
103 $(AM_V_at)mv -f $@.tmp $@
105 # Supporting rules for gettext.
106 ALL_MOFILES = $(POFILES:.po=.mo)
107 EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
108 MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
109 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
110 --add-comments=TRANSLATORS: --foreign-user \
111 --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
112 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
113 --keyword=_ --keyword=N_ --keyword=PN_:1c,2
115 po/$(PACKAGE).pot: $(SOURCES) src/errors.lst
116 $(AM_V_at) $(MKDIR_P) $(@D)
117 $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
118 $(AM_V_at) $(XGETTEXT) $(XGETTEXT_OPTS) --omit-header -Lc \
119 -ajo $@.tmp src/errors.lst
120 $(AM_V_at) mv -f $@.tmp $@
123 $(AM_V_at)$(MKDIR_P) $(@D)
124 $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
126 install-data-local: install-mo
127 install-mo: $(MOFILES)
129 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
130 test x"$$lang" = x"" && exit 1; \
131 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
132 (set -x; $(MKDIR_P) "$$inst") \
134 (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") \
138 installdirs-local: installdirs-mo
140 for mo in $(MOFILES); do \
141 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
142 test x"$$lang" = x"" && exit 1; \
143 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
144 (set -x; $(MKDIR_P) "$$inst") || exit $$?; \
147 uninstall-local: uninstall-mo
149 for mo in $(ALL_MOFILES); do \
150 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
151 test x"$$lang" = x"" && exit 1; \
152 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
153 (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \
156 .PHONY: install-mo installdirs-mo uninstall-mo
158 # These are required to prevent the builtin lex/yacc rules from
159 # superseding ours...
160 src/scan.c src/scan.h: src/scan.stamp
161 src/parse.c src/parse.h: src/parse.stamp
163 # The flex/bison rules refrain from updating unchanged headers for the
164 # convenience of developers, but the headers must be distributed with
165 # up-to-date timestamps, otherwise make will try to update them in a fresh
167 dist-hook: update-headers
168 update-headers: unfuck-distdir
169 touch -c '$(distdir)/src/scan.h'
170 touch -c '$(distdir)/src/parse.h'
171 .PHONY: update-headers
173 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
174 # will produce a distribution with all files read-only. Moreover, the files
175 # are read-only in distdir when the dist hooks are run. This hook will
176 # manually fix up the permissions. All dist hooks that modify files in distdir
177 # should list unfuck-distdir as a prerequisite.
178 dist-hook: unfuck-distdir
180 find '$(distdir)' -type f -exec chmod u+w {} +
181 .PHONY: unfuck-distdir
183 # Supporting rules for bison/flex.
185 BISON_V = $(BISON_V_$(V))
186 BISON_V_ = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
187 BISON_V_0 = @echo " BISON " $<;
189 FLEX_V = $(FLEX_V_$(V))
190 FLEX_V_ = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
191 FLEX_V_0 = @echo " FLEX " $<;
197 $(AM_V_at) touch $@.tmp
198 $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
199 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
202 mv -f $*.h.tmp $*.h; \
204 $(AM_V_at) mv -f $@.tmp $@
207 $(AM_V_at) touch $@.tmp
208 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
209 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
212 mv -f $*.h.tmp $*.h; \
214 $(AM_V_at) mv -f $@.tmp $@
217 @if test -f $@; then :; else \
219 $(MAKE) $(AM_MAKEFLAGS) $<; \
223 @if test -f $@; then :; else \
225 $(MAKE) $(AM_MAKEFLAGS) $<; \
228 include $(top_srcdir)/lib/gnulib.mk
229 include $(top_srcdir)/glconfig.mk