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
59 src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed
60 $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \
61 < $(srcdir)/src/types.lst > $@.tmp
62 $(AM_V_at)mv -f $@.tmp $@
64 src/ordspecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/ordspecs.sed
65 $(AM_V_GEN) sed -f $(srcdir)/src/ordspecs.sed \
66 < $(srcdir)/src/specs.lst > $@.tmp
67 $(AM_V_at) mv -f $@.tmp $@
69 src/errtab.h: $(srcdir)/src/errors.lst $(srcdir)/src/strtab.sed
70 $(AM_V_GEN)sed -f $(srcdir)/src/strtab.sed \
71 < $(srcdir)/src/errors.lst > $@.tmp
72 $(AM_V_at)mv -f $@.tmp $@
74 # Supporting rules for gettext.
75 ALL_MOFILES = $(POFILES:.po=.mo)
76 EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
77 MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
78 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
79 --add-comments=TRANSLATORS: --foreign-user \
80 --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
81 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
82 --keyword=_ --keyword=N_ --keyword=PN_:1c,2
84 po/$(PACKAGE).pot: $(SOURCES) src/errors.lst
85 $(AM_V_at) $(MKDIR_P) $(@D)
86 $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
87 $(AM_V_at) $(XGETTEXT) $(XGETTEXT_OPTS) --omit-header -Lc \
88 -ajo $@.tmp src/errors.lst
89 $(AM_V_at) mv -f $@.tmp $@
92 $(AM_V_at)$(MKDIR_P) $(@D)
93 $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
95 install-data-local: install-mo
96 install-mo: $(MOFILES)
98 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
99 test x"$$lang" = x"" && exit 1; \
100 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
102 $(MKDIR_P) "$$inst" || exit $$?; \
103 $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo" || exit $$?; \
107 installdirs-local: installdirs-mo
109 for mo in $(MOFILES); do \
110 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
111 test x"$$lang" = x"" && exit 1; \
112 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
114 $(MKDIR_P) "$$inst" || exit $$?; \
118 uninstall-local: uninstall-mo
120 for mo in $(ALL_MOFILES); do \
121 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
122 test x"$$lang" = x"" && exit 1; \
123 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
125 cd "$$inst" && rm -f '$(PACKAGE).mo'; \
129 .PHONY: install-mo installdirs-mo uninstall-mo
131 # These are required to prevent the builtin lex/yacc rules from
132 # superseding ours...
133 src/scan.c src/scan.h: src/scan.stamp
134 src/parse.c src/parse.h: src/parse.stamp
136 # The flex/bison rules refrain from updating unchanged headers for the
137 # convenience of developers, but the headers must be distributed with
138 # up-to-date timestamps, otherwise make will try to update them in a fresh
140 dist-hook: update-headers
142 touch -c '$(distdir)/src/scan.h'
143 touch -c '$(distdir)/src/parse.h'
145 # Supporting rules for bison/flex.
147 BISON_V = $(BISON_V_$(V))
148 BISON_V_ = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
149 BISON_V_0 = @echo " BISON " $<;
151 FLEX_V = $(FLEX_V_$(V))
152 FLEX_V_ = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
153 FLEX_V_0 = @echo " FLEX " $<;
159 $(AM_V_at) touch $@.tmp
160 $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
161 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
164 mv -f $*.h.tmp $*.h; \
166 $(AM_V_at) mv -f $@.tmp $@
169 $(AM_V_at) touch $@.tmp
170 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
171 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
174 mv -f $*.h.tmp $*.h; \
176 $(AM_V_at) mv -f $@.tmp $@
179 @if test -f $@; then :; else \
181 $(MAKE) $(AM_MAKEFLAGS) $<; \
185 @if test -f $@; then :; else \
187 $(MAKE) $(AM_MAKEFLAGS) $<; \
190 include $(top_srcdir)/lib/gnulib.mk
191 include $(top_srcdir)/glconfig.mk