X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/e8b313f75d564832dd0cef3eef6056717e07c0fd..daa6f0b3f99dc3f84d094276242189c86362cd4b:/Makefile.am diff --git a/Makefile.am b/Makefile.am index 7bc77dc..e40e69c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,39 +1,184 @@ +# Copyright © 2011 Nick Bowler +# +# License WTFPL2: Do What The Fuck You Want To Public License, version 2. +# This is free software: you are free to do what the fuck you want to. +# There is NO WARRANTY, to the extent permitted by law. + ACLOCAL_AMFLAGS = -I m4 +AUTOMAKE_OPTIONS = nostdinc + +# For Gnulib +MOSTLYCLEANFILES = +noinst_LTLIBRARIES = + +AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \ + -I$(top_builddir)/lib -I$(top_srcdir)/lib \ + -I$(top_builddir) -I$(top_srcdir) \ + -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \ + -DLOCALEDIR=\"$(localedir)\" -SUBDIRS = lib . -CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib +AM_CFLAGS = $(GSL_CFLAGS) MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \ src/parse.c src/parse.h src/parse.stamp -EXTRA_DIST = m4/gnulib-cache.m4 src/parse.stamp src/scan.stamp +CLEANFILES = src/validtypes.h src/errtab.h src/namespecs.h src/ordspecs.h \ + test/typegen.h + +EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/validtypes.sed \ + src/specs.lst src/namespecs.sed src/ordspecs.sed \ + src/errors.lst src/strtab.sed \ + src/parse.stamp src/scan.stamp \ + COPYING.WTFPL2 + +dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3 include_HEADERS = src/cdecl.h -noinst_HEADERS = src/scan.h src/parse.h +noinst_HEADERS = conf_post.h src/typemap.h src/output.h src/scan.h \ + src/parse.h src/i18n.h src/normalize.h src/error.h + +noinst_DATA = $(MOFILES) lib_LTLIBRARIES = libcdecl.la -libcdecl_la_LDFLAGS = -export-symbols-regex '^cdecl_[[:lower:]]' -libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c +libcdecl_la_LDFLAGS = -no-undefined \ + -export-symbols-regex '^cdecl_[[:lower:]]' +libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \ + src/output.c src/explain.c src/declare.c src/i18n.c src/error.c \ + src/normalize.c +libcdecl_la_LIBADD = libgnu.la $(LTLIBINTL) $(LTLIBTHREAD) +$(libcdecl_la_OBJECTS): $(gnulib_headers) bin_PROGRAMS = cdecl99 + +check_PROGRAMS = +EXTRA_LTLIBRARIES = libtest.la +libtest_la_LIBADD = $(GSL_LIBS) +libtest_la_SOURCES = test/testlib.c + +if HAVE_GSL +libtest_la_SOURCES += test/declgen.c +check_PROGRAMS += test/randomdecl +endif + cdecl99_SOURCES = src/cdecl99.c -cdecl99_LDADD = libcdecl.la lib/libgnu.la +cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE) +$(cdecl99_OBJECTS): $(gnulib_headers) + +test_randomdecl_LDADD = libcdecl.la libtest.la libgnu.la +$(test_randomdecl_OBJECTS): $(gnulib_headers) src/parse.lo: src/scan.h src/scan.lo: src/parse.h src/parse-decl.lo: src/scan.h src/parse.h src/typemap.lo: src/validtypes.h +src/error.lo: src/errtab.h +src/normalize.lo: src/ordspecs.h +src/output.lo: src/namespecs.h +test/declgen.lo: test/typegen.h -src/validtypes.h: src/validtypes.in $(srcdir)/src/validtypes.sed +src/validtypes.h: $(srcdir)/src/types.lst $(srcdir)/src/validtypes.sed $(AM_V_GEN)sed -f $(srcdir)/src/validtypes.sed \ - < src/validtypes.in > $@.tmp + < $(srcdir)/src/types.lst > $@.tmp $(AM_V_at)mv -f $@.tmp $@ +src/namespecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/namespecs.sed + $(AM_V_GEN) sed -f $(srcdir)/src/namespecs.sed \ + < $(srcdir)/src/specs.lst > $@.tmp + $(AM_V_at) mv -f $@.tmp $@ + +src/ordspecs.h: $(srcdir)/src/specs.lst $(srcdir)/src/ordspecs.sed + $(AM_V_GEN) sed -f $(srcdir)/src/ordspecs.sed \ + < $(srcdir)/src/specs.lst > $@.tmp + $(AM_V_at) mv -f $@.tmp $@ + +src/errtab.h: $(srcdir)/src/errors.lst $(srcdir)/src/strtab.sed + $(AM_V_GEN)sed -f $(srcdir)/src/strtab.sed \ + < $(srcdir)/src/errors.lst > $@.tmp + $(AM_V_at)mv -f $@.tmp $@ + +test/typegen.h: $(srcdir)/src/types.lst $(srcdir)/test/typegen.sh + $(AM_V_GEN) $(SHELL) $(srcdir)/test/typegen.sh \ + < $(srcdir)/src/types.lst > $@.tmp + $(AM_V_at)mv -f $@.tmp $@ + +# Supporting rules for gettext. +ALL_MOFILES = $(POFILES:.po=.mo) +EXTRA_DIST += po/$(PACKAGE).pot po/LINGUAS $(POFILES) $(ALL_MOFILES) +MAINTAINERCLEANFILES += po/$(PACKAGE).pot $(ALL_MOFILES) +XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \ + --add-comments=TRANSLATORS: --foreign-user \ + --package-name=$(PACKAGE) --package-version=$(PACKAGE_VERSION) \ + --msgid-bugs-address=$(PACKAGE_BUGREPORT) \ + --keyword=_ --keyword=N_ --keyword=PN_:1c,2 + +po/$(PACKAGE).pot: $(SOURCES) src/errors.lst + $(AM_V_at) $(MKDIR_P) $(@D) + $(AM_V_GEN) $(XGETTEXT) $(XGETTEXT_OPTS) -o $@.tmp $(SOURCES) + $(AM_V_at) $(XGETTEXT) $(XGETTEXT_OPTS) --omit-header -Lc \ + -ajo $@.tmp src/errors.lst + $(AM_V_at) mv -f $@.tmp $@ + +.po.mo: + $(AM_V_at)$(MKDIR_P) $(@D) + $(AM_V_GEN)$(MSGFMT) -c -o $@ $< + +install-data-local: install-mo +install-mo: $(MOFILES) + for mo in $?; do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; $(MKDIR_P) "$$inst") \ + || exit $$?; \ + (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") \ + || exit $$?; \ + done + +installdirs-local: installdirs-mo +installdirs-mo: + for mo in $(MOFILES); do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; $(MKDIR_P) "$$inst") || exit $$?; \ + done + +uninstall-local: uninstall-mo +uninstall-mo: + for mo in $(ALL_MOFILES); do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \ + done + +.PHONY: install-mo installdirs-mo uninstall-mo + # These are required to prevent the builtin lex/yacc rules from # superseding ours... src/scan.c src/scan.h: src/scan.stamp src/parse.c src/parse.h: src/parse.stamp +# The flex/bison rules refrain from updating unchanged headers for the +# convenience of developers, but the headers must be distributed with +# up-to-date timestamps, otherwise make will try to update them in a fresh +# VPATH build. +dist-hook: update-headers +update-headers: unfuck-distdir + touch -c '$(distdir)/src/scan.h' + touch -c '$(distdir)/src/parse.h' +.PHONY: update-headers + +# When running "make dist" in a VPATH build with a read-only srcdir, Automake +# will produce a distribution with all files read-only. Moreover, the files +# are read-only in distdir when the dist hooks are run. This hook will +# manually fix up the permissions. All dist hooks that modify files in distdir +# should list unfuck-distdir as a prerequisite. +dist-hook: unfuck-distdir +unfuck-distdir: + find '$(distdir)' -type f -exec chmod u+w {} + +.PHONY: unfuck-distdir + # Supporting rules for bison/flex. BISON_V = $(BISON_V_$(V)) @@ -78,3 +223,6 @@ FLEX_V_0 = @echo " FLEX " $<; rm -f $<; \ $(MAKE) $(AM_MAKEFLAGS) $<; \ fi + +include $(top_srcdir)/lib/gnulib.mk +include $(top_srcdir)/glconfig.mk