1 # Copyright © 2019-2022 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 -I$(DX_BASEDIR)/src -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 \
44 gob2_SOURCES = src/main.c src/main.h src/treefuncs.c src/out.c src/util.c \
45 src/checks.c src/parse.y src/lexer.c src/lexer.h src/options.h \
47 gob2_LDADD = $(LIBGLIB_LIBS) libgnu.a
48 $(gob2_OBJECTS): $(gnulib_headers) src/treefuncs.h src/options.h
51 gob2_SOURCES += src/gob-strcase.c
55 EXTRA_DIST += doc/makehtml.pl
57 FLEX_V = $(FLEX_V_@AM_V@)
58 FLEX_V_ = $(FLEX_V_@AM_DEFAULT_V@)
59 FLEX_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'FLEX ' $<;
62 echo "ERROR: *** $$tool is missing on your system."; \
63 echo " *** Because of this, I cannot compile $$toolsrc."; \
64 echo " *** If $$tool is installed but was not detected by configure,";\
65 echo " *** consider setting $$toolvar and re-running configure."; \
66 echo " *** See config.log for more details."; } >&2; false
69 echo "ERROR: *** $$tool is missing on your system."; \
70 echo " *** Because of this, I cannot compile $$toolsrc, but"; \
71 echo " *** (perhaps because you modified it) the sources appear out"; \
72 echo " *** of date. If $$tool is installed but was not detected by"; \
73 echo " *** configure, consired setting $$toolvar and re-running configure."; \
74 echo " *** See config.log for more details."; } >&2; false
76 src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
78 @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(DEV_TOOL_ERROR)
80 $(AM_V_at) $(MKDIR_P) $(@D) && touch $@.tmp
81 $(AM_V_GEN) (cd $(@D) && \
82 $(PERL) $(abs_srcdir)/src/generate_treefuncs.pl \
83 $(abs_srcdir)/src/treefuncs.def; )
84 $(AM_V_at) mv -f $@.tmp $@
86 OPTFILES = src/options.opt
88 $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
89 $(AM_V_at) mv -f $@.tmp $@
90 $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
91 MAINTAINERCLEANFILES += $(OPTFILES:.opt=.h)
92 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
97 @tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
99 $(AM_V_at) touch $@.tmp
100 $(AM_V_at) rm -f $*.h.tmp; mv -f $*.h $*.h.tmp 2>/dev/null; :
101 $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h $(FLEXFLAGS) $<
102 $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; \
103 then mv -f $*.h.tmp $*.h; \
104 else rm -f $*.h.tmp; fi
105 $(AM_V_at) mv -f $@.tmp $@
108 @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
110 @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
112 # Required to prevent the builtin lex rule from superseding ours
113 src/lexer.c src/lexer.h: src/lexer.stamp
115 html-local: doc/gob2.html
116 doc/gob2.html: doc/gob2.1
118 @tool=perl toolvar=PERL toolsrc=$@; $(TOOL_ERROR)
120 $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
121 $(AM_V_at) mv -f $@.tmp $@
122 CLEANFILES += doc/gob2.html
124 install-html-local: install-gob2-html
125 install-gob2-html: doc/gob2.html
126 $(MKDIR_P) "$(DESTDIR)$(docdir)"
127 $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
128 .PHONY: install-gob2-html
130 uninstall-local: uninstall-gob2-html
132 test ! -d "$(DESTDIR)$(docdir)" || \
133 cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
134 .PHONY: uninstall-gob2-html
136 m4dir = $(datadir)/aclocal
139 gob2.m4: $(DX_BASEDIR)/m4/gob2.m4 $(DX_BASEDIR)/m4/basename.m4
141 $(SED) -e 's/DX_PROG_GOB2/GOB2_CHECK/g' \
142 -e 's/DX_BASENAME/GOB2_BASENAME/g' \
143 $(DX_BASEDIR)/m4/gob2.m4 && echo && \
144 $(SED) -e 's/DX_/GOB2_/g' -e 's/dx_fn_/gob2_fn_/g' \
145 $(DX_BASEDIR)/m4/basename.m4; \
147 $(AM_V_at) mv -f $@.tmp $@
148 DISTCLEANFILES += gob2.m4
149 EXTRA_DIST += $(DX_BASEDIR)/m4/gob2.m4 $(DX_BASEDIR)/m4/basename.m4
151 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
152 dist-hook: generate-changelog
153 generate-changelog: unfuck-distdir
154 -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
155 export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
156 $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
157 $(git_changelog_start).. && \
159 git show $(git_changelog_start):ChangeLog; \
160 } >$(distdir)/ChangeLog.gen && \
161 mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
162 rm -f $(distdir)/ChangeLog.gen
163 .PHONY: generate-changelog
165 # Ensure that any generated headers, which may be left unchanged to improve
166 # incremental build performance, are fully up-to-date in the distribution.
167 dist-hook: update-headers
168 update-headers: unfuck-distdir
169 touch -c $(distdir)/src/lexer.h
170 .PHONY: update-headers
172 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
173 # will produce a distribution with all files read-only. Moreover, the files
174 # are read-only in distdir when the dist hooks are run. This hook will fix
175 # up the permission. All dist hooks that modify files in distdir should list
176 # unfuck-distdir as a prerequisite.
177 dist-hook: unfuck-distdir
179 find '$(distdir)' -type f -exec chmod u+w {} +
180 .PHONY: unfuck-distdir
182 GENERIC_V = $(GENERIC_V_@AM_V@)
183 GENERIC_V_ = $(GENERIC_V_@AM_DEFAULT_V@)
184 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
186 TEST_DISTRIBUTION = false
187 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
188 then echo 'Proceeding anyway...'; \
189 else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
194 $(GENERIC_V) : 'CHECK ' ChangeLog; \
195 $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
196 $(distdir)/ChangeLog || { \
197 echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
198 echo ' *** The source version was used instead, but this appears to'; \
199 echo ' *** be the stub from a git checkout. The "git" and "perl"'; \
200 echo ' *** programs are required for ChangeLog generation to work.'; \
201 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
202 $(GENERIC_V) : 'CHECK ' NEWS; \
203 $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
204 { print FILENAME ":" NR ":", $$0; exit 1}' \
205 $(distdir)/NEWS || { \
206 echo 'ERROR: *** First line of NEWS should match the package version'; \
207 echo ' *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
208 echo ' *** Remember to update NEWS before preparing a release.'; \
209 $(TEST_DISTRIBUTION_OR_ERROR); } >&2
211 atlocal: config.status
213 printf ': "$${%s=%s}"\n' \
217 CPPFLAGS '$(CPPFLAGS)' \
219 CXXFLAGS '$(CXXFLAGS)' \
220 LDFLAGS '$(LDFLAGS)' \
221 GTK_CFLAGS '$(GTK_CFLAGS)' \
222 GTK_LIBS '$(GTK_LIBS)' \
223 LIBGOBJECT_CFLAGS '$(LIBGOBJECT_CFLAGS)' \
224 LIBGOBJECT_LIBS '$(LIBGOBJECT_LIBS)' \
225 HAVE_GOBJECT '$(HAVE_GOBJECT)' \
226 HAVE_GOBJECT_PRIVATES '$(HAVE_GOBJECT_PRIVATES)' \
227 HAVE_GTK2 '$(HAVE_GTK2)' \
228 pkgdatadir '$(pkgdatadir)' \
230 $(AM_V_at) mv -f $@.tmp $@
232 CLEANFILES += atlocal
234 include $(top_srcdir)/lib/gnulib.mk
235 include $(top_srcdir)/common/snippet/autotest.mk