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
8 AUTOMAKE_OPTIONS = nostdinc
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 -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \
18 -DLOCALEDIR=\"$(localedir)\"
20 MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
21 src/parse.c src/parse.h src/parse.stamp
23 CLEANFILES = src/validtypes.h src/errtab.h
25 EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/validtypes.sed \
26 src/errors.lst src/strtab.sed \
27 src/parse.stamp src/scan.stamp \
30 dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
32 include_HEADERS = src/cdecl.h
33 noinst_HEADERS = src/typemap.h src/output.h src/scan.h src/parse.h src/i18n.h \
36 noinst_DATA = $(MOFILES)
38 lib_LTLIBRARIES = libcdecl.la
39 libcdecl_la_LDFLAGS = -no-undefined \
40 -export-symbols-regex '^cdecl_[[:lower:]]'
41 libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
42 src/output.c src/explain.c src/declare.c src/i18n.c src/error.c \
44 libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
45 $(libcdecl_la_OBJECTS): $(gnulib_headers)
47 bin_PROGRAMS = cdecl99
48 cdecl99_SOURCES = src/cdecl99.c
49 cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
50 $(cdecl99_OBJECTS): $(gnulib_headers)
52 src/parse.lo: src/scan.h
53 src/scan.lo: src/parse.h
54 src/parse-decl.lo: src/scan.h src/parse.h
55 src/typemap.lo: src/validtypes.h
56 src/error.lo: src/errtab.h
57 src/normalize.lo: src/ordspecs.h
58 src/output.lo: src/namespecs.h
60 src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed
61 $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \
62 < $(srcdir)/src/types.lst > $@.tmp
63 $(AM_V_at)mv -f $@.tmp $@
65 src/namespecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/namespecs.sed
66 $(AM_V_GEN) sed -f $(srcdir)/src/namespecs.sed \
67 < $(srcdir)/src/specs.lst > $@.tmp
68 $(AM_V_at) mv -f $@.tmp $@
70 src/ordspecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/ordspecs.sed
71 $(AM_V_GEN) sed -f $(srcdir)/src/ordspecs.sed \
72 < $(srcdir)/src/specs.lst > $@.tmp
73 $(AM_V_at) mv -f $@.tmp $@
75 src/errtab.h: $(srcdir)/src/errors.lst $(srcdir)/src/strtab.sed
76 $(AM_V_GEN)sed -f $(srcdir)/src/strtab.sed \
77 < $(srcdir)/src/errors.lst > $@.tmp
78 $(AM_V_at)mv -f $@.tmp $@
80 # Supporting rules for gettext.
81 ALL_MOFILES = $(POFILES:.po=.mo)
82 EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
83 MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
84 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
85 --add-comments=TRANSLATORS: --foreign-user \
86 --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
87 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
88 --keyword=_ --keyword=N_ --keyword=PN_:1c,2
90 po/$(PACKAGE).pot: $(SOURCES) src/errors.lst
91 $(AM_V_at) $(MKDIR_P) $(@D)
92 $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
93 $(AM_V_at) $(XGETTEXT) $(XGETTEXT_OPTS) --omit-header -Lc \
94 -ajo $@.tmp src/errors.lst
95 $(AM_V_at) mv -f $@.tmp $@
98 $(AM_V_at)$(MKDIR_P) $(@D)
99 $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
101 install-data-local: install-mo
102 install-mo: $(MOFILES)
104 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
105 test x"$$lang" = x"" && exit 1; \
106 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
108 $(MKDIR_P) "$$inst" || exit $$?; \
109 $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo" || exit $$?; \
113 installdirs-local: installdirs-mo
115 for mo in $(MOFILES); do \
116 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
117 test x"$$lang" = x"" && exit 1; \
118 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
120 $(MKDIR_P) "$$inst" || exit $$?; \
124 uninstall-local: uninstall-mo
126 for mo in $(ALL_MOFILES); do \
127 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
128 test x"$$lang" = x"" && exit 1; \
129 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
131 cd "$$inst" && rm -f '$(PACKAGE).mo'; \
135 .PHONY: install-mo installdirs-mo uninstall-mo
137 # These are required to prevent the builtin lex/yacc rules from
138 # superseding ours...
139 src/scan.c src/scan.h: src/scan.stamp
140 src/parse.c src/parse.h: src/parse.stamp
142 # The flex/bison rules refrain from updating unchanged headers for the
143 # convenience of developers, but the headers must be distributed with
144 # up-to-date timestamps, otherwise make will try to update them in a fresh
146 dist-hook: update-headers
148 touch -c '$(distdir)/src/scan.h'
149 touch -c '$(distdir)/src/parse.h'
151 # Supporting rules for bison/flex.
153 BISON_V = $(BISON_V_$(V))
154 BISON_V_ = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
155 BISON_V_0 = @echo " BISON " $<;
157 FLEX_V = $(FLEX_V_$(V))
158 FLEX_V_ = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
159 FLEX_V_0 = @echo " FLEX " $<;
165 $(AM_V_at) touch $@.tmp
166 $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
167 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
170 mv -f $*.h.tmp $*.h; \
172 $(AM_V_at) mv -f $@.tmp $@
175 $(AM_V_at) touch $@.tmp
176 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
177 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
180 mv -f $*.h.tmp $*.h; \
182 $(AM_V_at) mv -f $@.tmp $@
185 @if test -f $@; then :; else \
187 $(MAKE) $(AM_MAKEFLAGS) $<; \
191 @if test -f $@; then :; else \
193 $(MAKE) $(AM_MAKEFLAGS) $<; \
196 include $(top_srcdir)/lib/gnulib.mk
197 include $(top_srcdir)/glconfig.mk