1 # Copyright © 2019-2020 Nick Bowler
3 # Based on original work Copyright © 1999-2013 Jiri (George) Lebl.
5 # License GPLv2+: GNU General Public License version 2 or any later version.
6 # This is free software: you are free to change and redistribute it.
7 # There is NO WARRANTY, to the extent permitted by law.
9 ACLOCAL_AMFLAGS = -I m4 -I common/m4
11 AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
12 -I$(builddir) -I$(srcdir) -DPKGDATADIR=\"$(pkgdatadir)\"
13 AM_CFLAGS = $(LIBGLIB_CFLAGS)
18 EXTRA_DIST = COPYING.GPL3 COPYING.generated-code \
19 examples/GNOME_Foo_SomeInterface.idl examples/README \
20 examples/foo-some-interface.gob examples/gtk-button-count.gob \
21 examples/my-glade-main.c examples/my-glade.glade \
22 examples/my-glade.gob gob2.spec src/generate_treefuncs.pl \
23 src/lexer.l src/lexer.stamp src/treefuncs.def \
24 src/treefuncs.stamp t/str.gob t/test-fooable.c t/test-fooable.h \
29 MAINTAINERCLEANFILES = src/lexer.c src/lexer.h src/lexer.stamp \
30 src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
32 EXTRA_PROGRAMS = parser-rdeps
33 parser_rdeps_SOURCES = src/main.c src/lexer.c
34 $(parser_rdeps_OBJECTS): src/parse.h
36 noinst_HEADERS = src/main.h src/treefuncs.h src/out.h src/util.h src/checks.h
38 gob2_SOURCES = src/main.c src/main.h src/treefuncs.c src/out.c src/util.c \
39 src/checks.c src/parse.y src/lexer.c src/lexer.h
40 gob2_LDADD = $(LIBGLIB_LIBS)
41 $(gob2_OBJECTS): src/treefuncs.h
44 EXTRA_DIST += doc/makehtml.pl
46 FLEX_V = $(FLEX_V_@AM_V@)
47 FLEX_V_ = $(FLEX_V_@AM_DEFAULT_V@)
48 FLEX_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'FLEX ' $<;
51 echo "ERROR: *** $$tool is missing on your system."; \
52 echo " *** Because of this, I cannot compile $$toolsrc, but"; \
53 echo " *** (perhaps because you modified it) the sources appear out"; \
54 echo " *** of date. If $$tool is installed but was not detected by"; \
55 echo " *** configure, consired setting $$toolvar and re-running configure."; \
56 echo " *** See config.log for more details."; } >&2; false
58 src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
60 @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(TOOL_ERROR)
62 $(AM_V_at) $(MKDIR_P) $(@D) && touch $@.tmp
63 $(AM_V_GEN) (cd $(@D) && \
64 $(PERL) $(abs_srcdir)/src/generate_treefuncs.pl \
65 $(abs_srcdir)/src/treefuncs.def; )
66 $(AM_V_at) mv -f $@.tmp $@
71 @tool=flex toolvar=FLEX toolsrc=$<; $(TOOL_ERROR)
73 $(AM_V_at) touch $@.tmp
74 $(AM_V_at) rm -f $*.h.tmp; mv -f $*.h $*.h.tmp 2>/dev/null; :
75 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h $(FLEXFLAGS) $<
76 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; \
77 then mv -f $*.h.tmp $*.h; \
78 else rm -f $*.h.tmp; fi
79 $(AM_V_at) mv -f $@.tmp $@
82 @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
84 @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
86 # Required to prevent the builtin lex rule from superseding ours
87 src/lexer.c src/lexer.h: src/lexer.stamp
89 html-local: doc/gob2.html
90 doc/gob2.html: doc/gob2.1
94 $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
95 $(AM_V_at) mv -f $@.tmp $@
96 CLEANFILES += doc/gob2.html
98 install-html-local: install-gob2-html
99 install-gob2-html: doc/gob2.html
100 $(MKDIR_P) "$(DESTDIR)$(docdir)"
101 $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
102 .PHONY: install-gob2-html
104 uninstall-local: uninstall-gob2-html
106 test ! -d "$(DESTDIR)$(docdir)" || \
107 cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
108 .PHONY: uninstall-gob2-html
110 m4dir = $(datadir)/aclocal
113 gob2.m4: $(top_srcdir)/common/m4/gob2.m4
114 $(AM_V_GEN) $(SED) 's/DX_PROG_GOB2/GOB2_CHECK/g' \
115 $(top_srcdir)/common/m4/gob2.m4 >$@.tmp
116 $(AM_V_at) mv -f $@.tmp $@
117 DISTCLEANFILES += gob2.m4
118 EXTRA_DIST += common/m4/gob2.m4
120 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
121 dist-hook: generate-changelog
122 generate-changelog: unfuck-distdir
123 -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
124 test -d "$$GIT_DIR" || exit 0; { \
125 $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
126 $(git_changelog_start).. && \
128 git show $(git_changelog_start):ChangeLog; \
129 } >$(distdir)/ChangeLog.gen && \
130 mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
131 rm -f $(distdir)/ChangeLog.gen
132 .PHONY: generate-changelog
134 # Ensure that any generated headers, which may be left unchanged to improve
135 # incremental build performance, are fully up-to-date in the distribution.
136 dist-hook: update-headers
137 update-headers: unfuck-distdir
138 touch -c $(distdir)/src/lexer.h
139 .PHONY: update-headers
141 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
142 # will produce a distribution with all files read-only. Moreover, the files
143 # are read-only in distdir when the dist hooks are run. This hook will fix
144 # up the permission. All dist hooks that modify files in distdir should list
145 # unfuck-distdir as a prerequisite.
146 dist-hook: unfuck-distdir
148 find '$(distdir)' -type f -exec chmod u+w {} +
149 .PHONY: unfuck-distdir
151 GENERIC_V = $(GENERIC_V_@AM_V@)
152 GENERIC_V_ = $(GENERIC_V_@AM_DEFAULT_V@)
153 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
155 TEST_DISTRIBUTION = false
156 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
157 then echo 'Proceeding anyway...'; \
158 else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
163 $(GENERIC_V) : 'CHECK ' ChangeLog; \
164 $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
165 $(distdir)/ChangeLog || { \
166 echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
167 echo ' *** The source version was used instead, but this appears to'; \
168 echo ' *** be the stub from a git checkout. The "git" and "perl"'; \
169 echo ' *** programs are required for ChangeLog generation to work.'; \
170 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
171 $(GENERIC_V) : 'CHECK ' NEWS; \
172 $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
173 { print FILENAME ":" NR ":", $$0; exit 1}' \
174 $(distdir)/NEWS || { \
175 echo 'ERROR: *** First line of NEWS should match the package version'; \
176 echo ' *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
177 echo ' *** Remember to update NEWS before preparing a release.'; \
178 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
180 include $(top_srcdir)/common/snippet/autotest.mk