]> git.draconx.ca Git - cdecl99.git/blob - Makefile.am
Separate specifier handling from the output routines.
[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         -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \
18         -DLOCALEDIR=\"$(localedir)\"
19
20 MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
21         src/parse.c src/parse.h src/parse.stamp
22
23 CLEANFILES = src/validtypes.h src/errtab.h
24
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 \
28         COPYING.WTFPL2
29
30 dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
31
32 include_HEADERS = src/cdecl.h
33 noinst_HEADERS = src/typemap.h src/output.h src/scan.h src/parse.h src/i18n.h \
34         src/error.h
35
36 noinst_DATA = $(MOFILES)
37
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 \
43         src/normalize.c
44 libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
45 $(libcdecl_la_OBJECTS): $(gnulib_headers)
46
47 bin_PROGRAMS = cdecl99
48 cdecl99_SOURCES = src/cdecl99.c
49 cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
50 $(cdecl99_OBJECTS): $(gnulib_headers)
51
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
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 $@
63
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 $@
68
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 $@
73
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
83
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 $@
90
91 .po.mo:
92         $(AM_V_at)$(MKDIR_P) $(@D)
93         $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
94
95 install-data-local: install-mo
96 install-mo: $(MOFILES)
97         for mo in $?; do \
98                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
99                 test x"$$lang" = x"" && exit 1; \
100                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
101                 set -x; \
102                 $(MKDIR_P) "$$inst" || exit $$?; \
103                 $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo" || exit $$?; \
104                 set +x; \
105         done
106
107 installdirs-local: installdirs-mo
108 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"; \
113                 set -x; \
114                 $(MKDIR_P) "$$inst" || exit $$?; \
115                 set +x; \
116         done
117
118 uninstall-local: uninstall-mo
119 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"; \
124                 set -x; \
125                 cd "$$inst" && rm -f '$(PACKAGE).mo'; \
126                 set +x; \
127         done
128
129 .PHONY: install-mo installdirs-mo uninstall-mo
130
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
135
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
139 # VPATH build.
140 dist-hook: update-headers
141 update-headers:
142         touch -c '$(distdir)/src/scan.h'
143         touch -c '$(distdir)/src/parse.h'
144
145 # Supporting rules for bison/flex.
146
147 BISON_V   = $(BISON_V_$(V))
148 BISON_V_  = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
149 BISON_V_0 = @echo "  BISON " $<;
150
151 FLEX_V   = $(FLEX_V_$(V))
152 FLEX_V_  = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
153 FLEX_V_0 = @echo "  FLEX  " $<;
154
155 .y.c: ;
156 .l.c: ;
157
158 .y.stamp:
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 \
162                 rm -f $*.h.tmp; \
163         else \
164                 mv -f $*.h.tmp $*.h; \
165         fi
166         $(AM_V_at) mv -f $@.tmp $@
167
168 .l.stamp:
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 \
172                 rm -f $*.h.tmp; \
173         else \
174                 mv -f $*.h.tmp $*.h; \
175         fi
176         $(AM_V_at) mv -f $@.tmp $@
177
178 .stamp.c:
179         @if test -f $@; then :; else \
180                 rm -f $<; \
181                 $(MAKE) $(AM_MAKEFLAGS) $<; \
182         fi
183
184 .stamp.h:
185         @if test -f $@; then :; else \
186                 rm -f $<; \
187                 $(MAKE) $(AM_MAKEFLAGS) $<; \
188         fi
189
190 include $(top_srcdir)/lib/gnulib.mk
191 include $(top_srcdir)/glconfig.mk