1 # Copyright © 2019-2021 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$(top_builddir)/lib -I$(top_srcdir)/lib \
13 -DPKGDATADIR=\"$(pkgdatadir)\"
14 AM_CFLAGS = $(LIBGLIB_CFLAGS)
19 EXTRA_DIST = COPYING.GPL3 COPYING.generated-code common/scripts/fix-gnulib.pl \
20 examples/GNOME_Foo_SomeInterface.idl examples/README \
21 examples/foo-some-interface.gob examples/gtk-button-count.gob \
22 examples/my-glade-main.c examples/my-glade.glade \
23 examples/my-glade.gob gob2.spec src/generate_treefuncs.pl \
24 src/lexer.l src/lexer.stamp src/treefuncs.def \
25 src/treefuncs.stamp t/str.gob t/test-fooable.c t/test-fooable.h \
26 t/test.gob m4/gnulib-cache.m4 bootstrap
28 CLEANFILES = $(EXTRA_LIBRARIES)
31 MAINTAINERCLEANFILES = src/lexer.c src/lexer.h src/lexer.stamp \
32 src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
37 EXTRA_PROGRAMS = parser-rdeps
38 parser_rdeps_SOURCES = src/main.c src/lexer.c
39 $(parser_rdeps_OBJECTS): src/parse.h
41 noinst_HEADERS = src/main.h src/treefuncs.h src/out.h src/util.h src/checks.h
43 gob2_SOURCES = src/main.c src/main.h src/treefuncs.c src/out.c src/util.c \
44 src/checks.c src/parse.y src/lexer.c src/lexer.h src/options.h
45 gob2_LDADD = $(LIBGLIB_LIBS) libgnu.a
46 $(gob2_OBJECTS): src/treefuncs.h src/options.h $(gnulib_headers)
49 EXTRA_DIST += doc/makehtml.pl
51 FLEX_V = $(FLEX_V_@AM_V@)
52 FLEX_V_ = $(FLEX_V_@AM_DEFAULT_V@)
53 FLEX_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'FLEX ' $<;
56 echo "ERROR: *** $$tool is missing on your system."; \
57 echo " *** Because of this, I cannot compile $$toolsrc."; \
58 echo " *** If $$tool is installed but was not detected by configure,";\
59 echo " *** consider setting $$toolvar and re-running configure."; \
60 echo " *** See config.log for more details."; } >&2; false
63 echo "ERROR: *** $$tool is missing on your system."; \
64 echo " *** Because of this, I cannot compile $$toolsrc, but"; \
65 echo " *** (perhaps because you modified it) the sources appear out"; \
66 echo " *** of date. If $$tool is installed but was not detected by"; \
67 echo " *** configure, consired setting $$toolvar and re-running configure."; \
68 echo " *** See config.log for more details."; } >&2; false
70 src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
72 @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(DEV_TOOL_ERROR)
74 $(AM_V_at) $(MKDIR_P) $(@D) && touch $@.tmp
75 $(AM_V_GEN) (cd $(@D) && \
76 $(PERL) $(abs_srcdir)/src/generate_treefuncs.pl \
77 $(abs_srcdir)/src/treefuncs.def; )
78 $(AM_V_at) mv -f $@.tmp $@
80 OPTFILES = src/options.opt
82 $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
83 $(AM_V_at) mv -f $@.tmp $@
84 $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
85 MAINTAINERCLEANFILES += $(OPTFILES:.opt=.h)
86 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
91 @tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
93 $(AM_V_at) touch $@.tmp
94 $(AM_V_at) rm -f $*.h.tmp; mv -f $*.h $*.h.tmp 2>/dev/null; :
95 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h $(FLEXFLAGS) $<
96 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; \
97 then mv -f $*.h.tmp $*.h; \
98 else rm -f $*.h.tmp; fi
99 $(AM_V_at) mv -f $@.tmp $@
102 @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
104 @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
106 # Required to prevent the builtin lex rule from superseding ours
107 src/lexer.c src/lexer.h: src/lexer.stamp
109 html-local: doc/gob2.html
110 doc/gob2.html: doc/gob2.1
112 @tool=perl toolvar=PERL toolsrc=$@; $(TOOL_ERROR)
114 $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
115 $(AM_V_at) mv -f $@.tmp $@
116 CLEANFILES += doc/gob2.html
118 install-html-local: install-gob2-html
119 install-gob2-html: doc/gob2.html
120 $(MKDIR_P) "$(DESTDIR)$(docdir)"
121 $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
122 .PHONY: install-gob2-html
124 uninstall-local: uninstall-gob2-html
126 test ! -d "$(DESTDIR)$(docdir)" || \
127 cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
128 .PHONY: uninstall-gob2-html
130 m4dir = $(datadir)/aclocal
133 gob2.m4: $(DX_BASEDIR)/m4/gob2.m4 $(DX_BASEDIR)/m4/basename.m4
135 $(SED) -e 's/DX_PROG_GOB2/GOB2_CHECK/g' \
136 -e 's/DX_BASENAME/GOB2_BASENAME/g' \
137 $(DX_BASEDIR)/m4/gob2.m4 && echo && \
138 $(SED) -e 's/DX_/GOB2_/g' -e 's/dx_fn_/gob2_fn_/g' \
139 $(DX_BASEDIR)/m4/basename.m4; \
141 $(AM_V_at) mv -f $@.tmp $@
142 DISTCLEANFILES += gob2.m4
143 EXTRA_DIST += $(DX_BASEDIR)/m4/gob2.m4 $(DX_BASEDIR)/m4/basename.m4
145 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
146 dist-hook: generate-changelog
147 generate-changelog: unfuck-distdir
148 -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
149 export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
150 $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
151 $(git_changelog_start).. && \
153 git show $(git_changelog_start):ChangeLog; \
154 } >$(distdir)/ChangeLog.gen && \
155 mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
156 rm -f $(distdir)/ChangeLog.gen
157 .PHONY: generate-changelog
159 # Ensure that any generated headers, which may be left unchanged to improve
160 # incremental build performance, are fully up-to-date in the distribution.
161 dist-hook: update-headers
162 update-headers: unfuck-distdir
163 touch -c $(distdir)/src/lexer.h
164 .PHONY: update-headers
166 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
167 # will produce a distribution with all files read-only. Moreover, the files
168 # are read-only in distdir when the dist hooks are run. This hook will fix
169 # up the permission. All dist hooks that modify files in distdir should list
170 # unfuck-distdir as a prerequisite.
171 dist-hook: unfuck-distdir
173 find '$(distdir)' -type f -exec chmod u+w {} +
174 .PHONY: unfuck-distdir
176 GENERIC_V = $(GENERIC_V_@AM_V@)
177 GENERIC_V_ = $(GENERIC_V_@AM_DEFAULT_V@)
178 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
180 TEST_DISTRIBUTION = false
181 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
182 then echo 'Proceeding anyway...'; \
183 else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
188 $(GENERIC_V) : 'CHECK ' ChangeLog; \
189 $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
190 $(distdir)/ChangeLog || { \
191 echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
192 echo ' *** The source version was used instead, but this appears to'; \
193 echo ' *** be the stub from a git checkout. The "git" and "perl"'; \
194 echo ' *** programs are required for ChangeLog generation to work.'; \
195 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
196 $(GENERIC_V) : 'CHECK ' NEWS; \
197 $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
198 { print FILENAME ":" NR ":", $$0; exit 1}' \
199 $(distdir)/NEWS || { \
200 echo 'ERROR: *** First line of NEWS should match the package version'; \
201 echo ' *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
202 echo ' *** Remember to update NEWS before preparing a release.'; \
203 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
205 atlocal: config.status
207 printf ': "$${%s=%s}"\n' \
210 CPPFLAGS '$(CPPFLAGS)' \
212 CXXFLAGS '$(CXXFLAGS)' \
213 LDFLAGS '$(LDFLAGS)' \
214 GTK_CFLAGS '$(GTK_CFLAGS)' \
215 GTK_LIBS '$(GTK_LIBS)' \
216 LIBGOBJECT_CFLAGS '$(LIBGOBJECT_CFLAGS)' \
217 LIBGOBJECT_LIBS '$(LIBGOBJECT_LIBS)' \
218 HAVE_GOBJECT '$(HAVE_GOBJECT)' \
219 HAVE_GOBJECT_PRIVATES '$(HAVE_GOBJECT_PRIVATES)' \
220 HAVE_GTK2 '$(HAVE_GTK2)' \
221 pkgdatadir '$(pkgdatadir)' \
223 $(AM_V_at) mv -f $@.tmp $@
225 CLEANFILES += atlocal
227 include $(top_srcdir)/lib/gnulib.mk
228 include $(top_srcdir)/common/snippet/autotest.mk