]> git.draconx.ca Git - cdecl99.git/blob - Makefile.am
Use #n in strtab.sed.
[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/typenames.h src/validtypes.h src/errtab.h
24
25 EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/typenames.sed \
26         src/validtypes.sed 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 libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD)
44 $(libcdecl_la_OBJECTS): $(gnulib_headers)
45
46 bin_PROGRAMS = cdecl99
47 cdecl99_SOURCES = src/cdecl99.c
48 cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
49 $(cdecl99_OBJECTS): $(gnulib_headers)
50
51 src/parse.lo: src/scan.h
52 src/scan.lo: src/parse.h
53 src/parse-decl.lo: src/scan.h src/parse.h
54 src/typemap.lo: src/validtypes.h src/typenames.h
55 src/error.lo: src/errtab.h
56
57 src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed
58         $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \
59                 < $(srcdir)/src/types.lst > $@.tmp
60         $(AM_V_at)mv -f $@.tmp $@
61
62 src/typenames.h: $(srcdir)/src/types.lst $(srcdir)/src/typenames.sed
63         $(AM_V_GEN)sed -f $(srcdir)/src/typenames.sed \
64                 < $(srcdir)/src/types.lst > $@.tmp
65         $(AM_V_at)mv -f $@.tmp $@
66
67 src/errtab.h: $(srcdir)/src/errors.lst $(srcdir)/src/strtab.sed
68         $(AM_V_GEN)sed -f $(srcdir)/src/strtab.sed \
69                 < $(srcdir)/src/errors.lst > $@.tmp
70         $(AM_V_at)mv -f $@.tmp $@
71
72 # Supporting rules for gettext.
73 ALL_MOFILES = $(POFILES:.po=.mo)
74 EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES)
75 MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES)
76 XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
77         --add-comments=TRANSLATORS: --foreign-user \
78         --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \
79         --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
80         --keyword=_ --keyword=N_ --keyword=PN_:1c,2
81
82 po/$(PACKAGE).pot: $(SOURCES) src/errors.lst
83         $(AM_V_at)  $(MKDIR_P) $(@D)
84         $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES)
85         $(AM_V_at)  $(XGETTEXT) $(XGETTEXT_OPTS) --omit-header -Lc \
86                 -ajo $@.tmp src/errors.lst
87         $(AM_V_at)  mv -f $@.tmp $@
88
89 .po.mo:
90         $(AM_V_at)$(MKDIR_P) $(@D)
91         $(AM_V_GEN)$(MSGFMT) -c -o $@ $<
92
93 install-data-local: install-mo
94 install-mo: $(MOFILES)
95         for mo in $?; do \
96                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
97                 test x"$$lang" = x"" && exit 1; \
98                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
99                 set -x; \
100                 $(MKDIR_P) "$$inst" || exit $$?; \
101                 $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo" || exit $$?; \
102                 set +x; \
103         done
104
105 installdirs-local: installdirs-mo
106 installdirs-mo:
107         for mo in $(MOFILES); do \
108                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
109                 test x"$$lang" = x"" && exit 1; \
110                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
111                 set -x; \
112                 $(MKDIR_P) "$$inst" || exit $$?; \
113                 set +x; \
114         done
115
116 uninstall-local: uninstall-mo
117 uninstall-mo:
118         for mo in $(ALL_MOFILES); do \
119                 lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \
120                 test x"$$lang" = x"" && exit 1; \
121                 inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \
122                 set -x; \
123                 cd "$$inst" && rm -f '$(PACKAGE).mo'; \
124                 set +x; \
125         done
126
127 .PHONY: install-mo installdirs-mo uninstall-mo
128
129 # These are required to prevent the builtin lex/yacc rules from
130 # superseding ours...
131 src/scan.c src/scan.h: src/scan.stamp
132 src/parse.c src/parse.h: src/parse.stamp
133
134 # The flex/bison rules refrain from updating unchanged headers for the
135 # convenience of developers, but the headers must be distributed with
136 # up-to-date timestamps, otherwise make will try to update them in a fresh
137 # VPATH build.
138 dist-hook: update-headers
139 update-headers:
140         touch -c '$(distdir)/src/scan.h'
141         touch -c '$(distdir)/src/parse.h'
142
143 # Supporting rules for bison/flex.
144
145 BISON_V   = $(BISON_V_$(V))
146 BISON_V_  = $(BISON_V_$(AM_DEFAULT_VERBOSITY))
147 BISON_V_0 = @echo "  BISON " $<;
148
149 FLEX_V   = $(FLEX_V_$(V))
150 FLEX_V_  = $(FLEX_V_$(AM_DEFAULT_VERBOSITY))
151 FLEX_V_0 = @echo "  FLEX  " $<;
152
153 .y.c: ;
154 .l.c: ;
155
156 .y.stamp:
157         $(AM_V_at) touch $@.tmp
158         $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
159         $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
160                 rm -f $*.h.tmp; \
161         else \
162                 mv -f $*.h.tmp $*.h; \
163         fi
164         $(AM_V_at) mv -f $@.tmp $@
165
166 .l.stamp:
167         $(AM_V_at) touch $@.tmp
168         $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
169         $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
170                 rm -f $*.h.tmp; \
171         else \
172                 mv -f $*.h.tmp $*.h; \
173         fi
174         $(AM_V_at) mv -f $@.tmp $@
175
176 .stamp.c:
177         @if test -f $@; then :; else \
178                 rm -f $<; \
179                 $(MAKE) $(AM_MAKEFLAGS) $<; \
180         fi
181
182 .stamp.h:
183         @if test -f $@; then :; else \
184                 rm -f $<; \
185                 $(MAKE) $(AM_MAKEFLAGS) $<; \
186         fi
187
188 include $(top_srcdir)/lib/gnulib.mk
189 include $(top_srcdir)/glconfig.mk