]> git.draconx.ca Git - gob-dx.git/blobdiff - Makefile.am
Replace gnulib patch with new common helper macro.
[gob-dx.git] / Makefile.am
index c8c5081e0b8e99e9094fb56b5e1b7ed35ee12892..c7ca686336571964e5b662a9542082c02cba443e 100644 (file)
-SUBDIRS = @SUBDIRS@
-DIST_SUBDIRS = src doc examples
+# Copyright © 2019-2022 Nick Bowler
+#
+# Based on original work Copyright © 1999-2013 Jiri (George) Lebl.
+#
+# License GPLv2+: GNU General Public License version 2 or any later version.
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law.
 
-m4dir=$(datadir)/aclocal
-m4_DATA=gob2.m4
+ACLOCAL_AMFLAGS = -I m4 -I common/m4
 
-EXTRA_DIST = gob2.spec.in $(m4_DATA)
+AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
+              -I$(top_builddir)/lib -I$(top_srcdir)/lib \
+              -I$(DX_BASEDIR)/src -DPKGDATADIR=\"$(pkgdatadir)\"
+AM_CFLAGS = $(LIBGLIB_CFLAGS)
+AM_YFLAGS = -d -t
 
-dist-hook: gob2.spec
-       cp gob2.spec $(distdir)
+bin_PROGRAMS = gob2
+
+EXTRA_DIST = COPYING.GPL3 COPYING.generated-code common/scripts/fix-gnulib.pl \
+             examples/GNOME_Foo_SomeInterface.idl examples/README \
+             examples/foo-some-interface.gob examples/gtk-button-count.gob \
+             examples/my-glade-main.c examples/my-glade.glade \
+             examples/my-glade.gob gob2.spec src/generate_treefuncs.pl \
+             src/lexer.l src/lexer.stamp src/treefuncs.def \
+             src/treefuncs.stamp t/str.gob t/test-fooable.c t/test-fooable.h \
+             t/test.gob m4/gnulib-cache.m4 bootstrap
+
+CLEANFILES = $(EXTRA_LIBRARIES)
+DISTCLEANFILES =
+MOSTLYCLEANFILES =
+MAINTAINERCLEANFILES = src/lexer.c src/lexer.h src/lexer.stamp \
+                       src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
+
+# For Gnulib
+EXTRA_LIBRARIES =
+
+EXTRA_PROGRAMS = parser-rdeps
+parser_rdeps_SOURCES = src/main.c src/lexer.c
+$(parser_rdeps_OBJECTS): src/parse.h
+
+noinst_HEADERS = src/main.h src/treefuncs.h src/out.h src/util.h src/checks.h \
+                 common/src/help.h
+
+gob2_SOURCES = src/main.c src/main.h src/treefuncs.c src/out.c src/util.c \
+               src/checks.c src/parse.y src/lexer.c src/lexer.h src/options.h \
+               common/src/help.c
+gob2_LDADD = $(LIBGLIB_LIBS) libgnu.a
+$(gob2_OBJECTS): $(gnulib_headers) src/treefuncs.h src/options.h
+
+if GOB_STRCASE
+gob2_SOURCES += src/gob-strcase.c
+endif
+
+man_MANS = doc/gob2.1
+EXTRA_DIST += doc/makehtml.pl
+
+FLEX_V   = $(FLEX_V_@AM_V@)
+FLEX_V_  = $(FLEX_V_@AM_DEFAULT_V@)
+FLEX_V_0 = @printf '  %$(DX_ALIGN_V)s %s\n' 'FLEX    ' $<;
+
+TOOL_ERROR = { \
+  echo "ERROR: *** $$tool is missing on your system."; \
+  echo "       *** Because of this, I cannot compile $$toolsrc."; \
+  echo "       *** If $$tool is installed but was not detected by configure,";\
+  echo "       *** consider setting $$toolvar and re-running configure."; \
+  echo "       *** See config.log for more details."; } >&2; false
+
+DEV_TOOL_ERROR = { \
+  echo "ERROR: *** $$tool is missing on your system."; \
+  echo "       *** Because of this, I cannot compile $$toolsrc, but"; \
+  echo "       *** (perhaps because you modified it) the sources appear out"; \
+  echo "       *** of date.  If $$tool is installed but was not detected by"; \
+  echo "       *** configure, consired setting $$toolvar and re-running configure."; \
+  echo "       *** See config.log for more details."; } >&2; false
+
+src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
+if !HAVE_PERL
+       @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(DEV_TOOL_ERROR)
+endif
+       $(AM_V_at) $(MKDIR_P) $(@D) && touch $@.tmp
+       $(AM_V_GEN) (cd $(@D) && \
+         $(PERL) $(abs_srcdir)/src/generate_treefuncs.pl \
+                 $(abs_srcdir)/src/treefuncs.def; )
+       $(AM_V_at) mv -f $@.tmp $@
+
+OPTFILES = src/options.opt
+.opt.h:
+       $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
+       $(AM_V_at) mv -f $@.tmp $@
+$(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
+MAINTAINERCLEANFILES += $(OPTFILES:.opt=.h)
+EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
+
+.l.c: ;
+.l.stamp:
+if !HAVE_FLEX
+       @tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
+endif
+       $(AM_V_at) touch $@.tmp
+       $(AM_V_at) rm -f $*.h.tmp; mv -f $*.h $*.h.tmp 2>/dev/null; :
+       $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h $(FLEXFLAGS) $<
+       $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; \
+         then mv -f $*.h.tmp $*.h; \
+         else rm -f $*.h.tmp; fi
+       $(AM_V_at) mv -f $@.tmp $@
+
+.stamp.c:
+       @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
+.stamp.h:
+       @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
+
+# Required to prevent the builtin lex rule from superseding ours
+src/lexer.c src/lexer.h: src/lexer.stamp
+
+html-local: doc/gob2.html
+doc/gob2.html: doc/gob2.1
+if !HAVE_PERL
+       @tool=perl toolvar=PERL toolsrc=$@; $(TOOL_ERROR)
+endif
+       $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
+       $(AM_V_at) mv -f $@.tmp $@
+CLEANFILES += doc/gob2.html
+
+install-html-local: install-gob2-html
+install-gob2-html: doc/gob2.html
+       $(MKDIR_P) "$(DESTDIR)$(docdir)"
+       $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
+.PHONY: install-gob2-html
+
+uninstall-local: uninstall-gob2-html
+uninstall-gob2-html:
+       test ! -d "$(DESTDIR)$(docdir)" || \
+         cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
+.PHONY: uninstall-gob2-html
+
+m4dir = $(datadir)/aclocal
+m4_DATA = gob2.m4
+
+gob2.m4: $(DX_BASEDIR)/m4/gob2.m4 $(DX_BASEDIR)/m4/basename.m4
+       $(AM_V_GEN) :; { \
+         $(SED) -e 's/DX_PROG_GOB2/GOB2_CHECK/g' \
+                -e 's/DX_BASENAME/GOB2_BASENAME/g' \
+                $(DX_BASEDIR)/m4/gob2.m4 && echo && \
+         $(SED) -e 's/DX_/GOB2_/g' -e 's/dx_fn_/gob2_fn_/g' \
+                $(DX_BASEDIR)/m4/basename.m4; \
+       } >$@.tmp
+       $(AM_V_at) mv -f $@.tmp $@
+DISTCLEANFILES += gob2.m4
+EXTRA_DIST += $(DX_BASEDIR)/m4/gob2.m4 $(DX_BASEDIR)/m4/basename.m4
+
+git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
+dist-hook: generate-changelog
+generate-changelog: unfuck-distdir
+       -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
+         export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
+           $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
+             $(git_changelog_start).. && \
+           echo && \
+           git show $(git_changelog_start):ChangeLog; \
+         } >$(distdir)/ChangeLog.gen && \
+         mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
+       rm -f $(distdir)/ChangeLog.gen
+.PHONY: generate-changelog
+
+# Ensure that any generated headers, which may be left unchanged to improve
+# incremental build performance, are fully up-to-date in the distribution.
+dist-hook: update-headers
+update-headers: unfuck-distdir
+       touch -c $(distdir)/src/lexer.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 fix
+# up the permission.  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
+
+GENERIC_V   = $(GENERIC_V_@AM_V@)
+GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
+GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
+
+TEST_DISTRIBUTION = false
+TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
+  then echo 'Proceeding anyway...'; \
+  else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
+       false; \
+  fi
+
+distcheck-hook:
+       $(GENERIC_V) : 'CHECK   ' ChangeLog; \
+         $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
+           $(distdir)/ChangeLog || { \
+             echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
+             echo '       *** The source version was used instead, but this appears to'; \
+             echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
+             echo '       *** programs are required for ChangeLog generation to work.'; \
+             $(TEST_DISTRIBUTION_OR_ERROR); } >&2
+       $(GENERIC_V) : 'CHECK   ' NEWS; \
+         $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
+           { print FILENAME ":" NR ":", $$0; exit 1}' \
+           $(distdir)/NEWS || { \
+             echo 'ERROR: *** First line of NEWS should match the package version'; \
+             echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
+             echo '       *** Remember to update NEWS before preparing a release.'; \
+             $(TEST_DISTRIBUTION_OR_ERROR); } >&2
+
+atlocal: config.status
+       $(AM_V_GEN) :; { \
+         printf ': "$${%s=%s}"\n' \
+           CC '$(CC)' \
+           CXX '$(CXX)' \
+           AWK '$(AWK)' \
+           CPPFLAGS '$(CPPFLAGS)' \
+           CFLAGS '$(CFLAGS)' \
+           CXXFLAGS '$(CXXFLAGS)' \
+           LDFLAGS '$(LDFLAGS)' \
+           GTK_CFLAGS '$(GTK_CFLAGS)' \
+           GTK_LIBS '$(GTK_LIBS)' \
+           LIBGOBJECT_CFLAGS '$(LIBGOBJECT_CFLAGS)' \
+           LIBGOBJECT_LIBS '$(LIBGOBJECT_LIBS)' \
+           HAVE_GOBJECT '$(HAVE_GOBJECT)' \
+           HAVE_GOBJECT_PRIVATES '$(HAVE_GOBJECT_PRIVATES)' \
+           HAVE_GTK2 '$(HAVE_GTK2)' \
+           pkgdatadir '$(pkgdatadir)' \
+           ; } >$@.tmp
+       $(AM_V_at) mv -f $@.tmp $@
+check_DATA = atlocal
+CLEANFILES += atlocal
+
+include $(top_srcdir)/lib/gnulib.mk
+include $(top_srcdir)/common/snippet/autotest.mk