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/typenames.h src/validtypes.h
25 EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/typenames.sed \
26 src/validtypes.sed src/parse.stamp src/scan.stamp \
29 dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
31 include_HEADERS = src/cdecl.h
32 noinst_HEADERS = src/typemap.h src/output.h src/scan.h src/parse.h src/i18n.h \
35 noinst_DATA = $(MOFILES)
37 lib_LTLIBRARIES = libcdecl.la
38 libcdecl_la_LDFLAGS = -no-undefined \
39 -export-symbols-regex '^cdecl_[[:lower:]]'
40 libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
41 src/output.c src/explain.c src/declare.c src/i18n.c src/error.c
42 libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
43 $(libcdecl_la_OBJECTS): $(gnulib_headers)
45 bin_PROGRAMS = cdecl99
46 cdecl99_SOURCES = src/cdecl99.c
47 cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
48 $(cdecl99_OBJECTS): $(gnulib_headers)
50 src/parse.lo: src/scan.h
51 src/scan.lo: src/parse.h
52 src/parse-decl.lo: src/scan.h src/parse.h
53 src/typemap.lo: src/validtypes.h src/typenames.h
55 src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed
56 $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \
57 < $(srcdir)/src/types.lst > $@.tmp
58 $(AM_V_at)mv -f $@.tmp $@
60 src/typenames.h: $(srcdir)/src/types.lst $(srcdir)/src/typenames.sed
61 $(AM_V_GEN)sed -f $(srcdir)/src/typenames.sed \
62 < $(srcdir)/src/types.lst > $@.tmp
63 $(AM_V_at)mv -f $@.tmp $@
65 # Supporting rules for gettext.
66 ALL_MOFILES = $(POFILES:.po=.mo)
67 EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
68 MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
69 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
70 --add-comments=TRANSLATORS: --foreign-user \
71 --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
72 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
73 --keyword=_ --keyword=N_
75 po/$(PACKAGE).pot: $(SOURCES)
76 $(AM_V_at)$(MKDIR_P) $(@D)
77 $(AM_V_GEN)$(XGETTEXT) $(XGETTEXT_OPTS) -o $@ $(SOURCES)
80 $(AM_V_at)$(MKDIR_P) $(@D)
81 $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
83 install-data-local: install-mo
84 install-mo: $(MOFILES)
86 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
87 test x"$$lang" = x"" && exit 1; \
88 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
90 $(MKDIR_P) "$$inst" || exit $$?; \
91 $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo" || exit $$?; \
95 installdirs-local: installdirs-mo
97 for mo in $(MOFILES); do \
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 $$?; \
106 uninstall-local: uninstall-mo
108 for mo in $(ALL_MOFILES); do \
109 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
110 test x"$$lang" = x"" && exit 1; \
111 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
113 cd "$$inst" && rm -f '$(PACKAGE).mo'; \
117 .PHONY: install-mo installdirs-mo uninstall-mo
119 # These are required to prevent the builtin lex/yacc rules from
120 # superseding ours...
121 src/scan.c src/scan.h: src/scan.stamp
122 src/parse.c src/parse.h: src/parse.stamp
124 # The flex/bison rules refrain from updating unchanged headers for the
125 # convenience of developers, but the headers must be distributed with
126 # up-to-date timestamps, otherwise make will try to update them in a fresh
128 dist-hook: update-headers
130 touch -c '$(distdir)/src/scan.h'
131 touch -c '$(distdir)/src/parse.h'
133 # Supporting rules for bison/flex.
135 BISON_V = $(BISON_V_$(V))
136 BISON_V_ = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
137 BISON_V_0 = @echo " BISON " $<;
139 FLEX_V = $(FLEX_V_$(V))
140 FLEX_V_ = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
141 FLEX_V_0 = @echo " FLEX " $<;
147 $(AM_V_at) touch $@.tmp
148 $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
149 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
152 mv -f $*.h.tmp $*.h; \
154 $(AM_V_at) mv -f $@.tmp $@
157 $(AM_V_at) touch $@.tmp
158 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
159 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
162 mv -f $*.h.tmp $*.h; \
164 $(AM_V_at) mv -f $@.tmp $@
167 @if test -f $@; then :; else \
169 $(MAKE) $(AM_MAKEFLAGS) $<; \
173 @if test -f $@; then :; else \
175 $(MAKE) $(AM_MAKEFLAGS) $<; \
178 include $(top_srcdir)/lib/gnulib.mk
179 include $(top_srcdir)/glconfig.mk