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/treefuncs.def src/treefuncs.stamp t/str.gob t/test-fooable.c \
- t/test-fooable.h t/test.gob
+ 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
CLEANFILES =
DISTCLEANFILES =
-MAINTAINERCLEANFILES = src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
+MAINTAINERCLEANFILES = src/lexer.c src/lexer.h src/lexer.stamp \
+ src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
EXTRA_PROGRAMS = parser-rdeps
-parser_rdeps_SOURCES = src/main.c src/lexer.l
+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
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.l
-gob2_LDADD = $(LIBGLIB_LIBS) @LEXLIB@
+ src/checks.c src/parse.y src/lexer.c src/lexer.h
+gob2_LDADD = $(LIBGLIB_LIBS)
$(gob2_OBJECTS): src/treefuncs.h
man_MANS = doc/gob2.1
EXTRA_DIST += doc/makehtml.pl
-PERL_ERROR = @:; { \
- printf '%s: ERROR: perl was not available at configure time.\n' "$@"; \
- printf '%s: If perl is installed but was not detected by configure,\n' "$@"; \
- printf '%s: consider setting PERL and re-running configure.\n' "$@"; \
- } 1>&2; false
+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, 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
- $(PERL_ERROR)
+ @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(TOOL_ERROR)
endif
- $(AM_V_at) $(MKDIR_P) $(@D)
+ $(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) touch $@
+ $(AM_V_at) mv -f $@.tmp $@
+
+.l.c: ;
+.l.stamp:
+if !HAVE_FLEX
+ @tool=flex toolvar=FLEX toolsrc=$<; $(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
git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
dist-hook: generate-changelog
-generate-changelog:
+generate-changelog: unfuck-distdir
-: "$${GIT_DIR=$(top_srcdir)/.git}"; \
test -d "$$GIT_DIR" || exit 0; { \
$(PERL) -x $(top_srcdir)/build-aux/gitlog-to-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'