]> git.draconx.ca Git - gob-dx.git/blob - Makefile.am
Avoid more GLib deprecation warnings.
[gob-dx.git] / Makefile.am
1 # Copyright © 2019-2021 Nick Bowler
2 #
3 # Based on original work Copyright © 1999-2013 Jiri (George) Lebl.
4 #
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.
8
9 ACLOCAL_AMFLAGS = -I m4 -I common/m4
10
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)
15 AM_YFLAGS = -d -t
16
17 bin_PROGRAMS = gob2
18
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
27
28 CLEANFILES = $(EXTRA_LIBRARIES)
29 DISTCLEANFILES =
30 MOSTLYCLEANFILES =
31 MAINTAINERCLEANFILES = src/lexer.c src/lexer.h src/lexer.stamp \
32                        src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
33
34 # For Gnulib
35 EXTRA_LIBRARIES =
36
37 EXTRA_PROGRAMS = parser-rdeps
38 parser_rdeps_SOURCES = src/main.c src/lexer.c
39 $(parser_rdeps_OBJECTS): src/parse.h
40
41 noinst_HEADERS = src/main.h src/treefuncs.h src/out.h src/util.h src/checks.h
42
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)
47
48 man_MANS = doc/gob2.1
49 EXTRA_DIST += doc/makehtml.pl
50
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    ' $<;
54
55 TOOL_ERROR = { \
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
61
62 DEV_TOOL_ERROR = { \
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
69
70 src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
71 if !HAVE_PERL
72         @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(DEV_TOOL_ERROR)
73 endif
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 $@
79
80 OPTFILES = src/options.opt
81 .opt.h:
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)
87
88 .l.c: ;
89 .l.stamp:
90 if !HAVE_FLEX
91         @tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
92 endif
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 $@
100
101 .stamp.c:
102         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
103 .stamp.h:
104         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
105
106 # Required to prevent the builtin lex rule from superseding ours
107 src/lexer.c src/lexer.h: src/lexer.stamp
108
109 html-local: doc/gob2.html
110 doc/gob2.html: doc/gob2.1
111 if !HAVE_PERL
112         @tool=perl toolvar=PERL toolsrc=$@; $(TOOL_ERROR)
113 endif
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
117
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
123
124 uninstall-local: uninstall-gob2-html
125 uninstall-gob2-html:
126         test ! -d "$(DESTDIR)$(docdir)" || \
127           cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
128 .PHONY: uninstall-gob2-html
129
130 m4dir = $(datadir)/aclocal
131 m4_DATA = gob2.m4
132
133 gob2.m4: $(top_srcdir)/common/m4/gob2.m4
134         $(AM_V_GEN) $(SED) 's/DX_PROG_GOB2/GOB2_CHECK/g' \
135           $(top_srcdir)/common/m4/gob2.m4 >$@.tmp
136         $(AM_V_at) mv -f $@.tmp $@
137 DISTCLEANFILES += gob2.m4
138 EXTRA_DIST += common/m4/gob2.m4
139
140 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
141 dist-hook: generate-changelog
142 generate-changelog: unfuck-distdir
143         -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
144           export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
145             $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
146               $(git_changelog_start).. && \
147             echo && \
148             git show $(git_changelog_start):ChangeLog; \
149           } >$(distdir)/ChangeLog.gen && \
150           mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
151         rm -f $(distdir)/ChangeLog.gen
152 .PHONY: generate-changelog
153
154 # Ensure that any generated headers, which may be left unchanged to improve
155 # incremental build performance, are fully up-to-date in the distribution.
156 dist-hook: update-headers
157 update-headers: unfuck-distdir
158         touch -c $(distdir)/src/lexer.h
159 .PHONY: update-headers
160
161 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
162 # will produce a distribution with all files read-only.  Moreover, the files
163 # are read-only in distdir when the dist hooks are run.  This hook will fix
164 # up the permission.  All dist hooks that modify files in distdir should list
165 # unfuck-distdir as a prerequisite.
166 dist-hook: unfuck-distdir
167 unfuck-distdir:
168         find '$(distdir)' -type f -exec chmod u+w {} +
169 .PHONY: unfuck-distdir
170
171 GENERIC_V   = $(GENERIC_V_@AM_V@)
172 GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
173 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
174
175 TEST_DISTRIBUTION = false
176 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
177   then echo 'Proceeding anyway...'; \
178   else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
179        false; \
180   fi
181
182 distcheck-hook:
183         $(GENERIC_V) : 'CHECK   ' ChangeLog; \
184           $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
185             $(distdir)/ChangeLog || { \
186               echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
187               echo '       *** The source version was used instead, but this appears to'; \
188               echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
189               echo '       *** programs are required for ChangeLog generation to work.'; \
190               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
191         $(GENERIC_V) : 'CHECK   ' NEWS; \
192           $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
193             { print FILENAME ":" NR ":", $$0; exit 1}' \
194             $(distdir)/NEWS || { \
195               echo 'ERROR: *** First line of NEWS should match the package version'; \
196               echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
197               echo '       *** Remember to update NEWS before preparing a release.'; \
198               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
199
200 atlocal: config.status
201         $(AM_V_GEN) :; { \
202           printf ': "$${%s=%s}"\n' \
203             CC '$(CC)' \
204             CXX '$(CXX)' \
205             CPPFLAGS '$(CPPFLAGS)' \
206             CFLAGS '$(CFLAGS)' \
207             CXXFLAGS '$(CXXFLAGS)' \
208             LDFLAGS '$(LDFLAGS)' \
209             GTK_CFLAGS '$(GTK_CFLAGS)' \
210             GTK_LIBS '$(GTK_LIBS)' \
211             LIBGOBJECT_CFLAGS '$(LIBGOBJECT_CFLAGS)' \
212             LIBGOBJECT_LIBS '$(LIBGOBJECT_LIBS)' \
213             HAVE_GOBJECT '$(HAVE_GOBJECT)' \
214             HAVE_GTK2 '$(HAVE_GTK2)' \
215             pkgdatadir '$(pkgdatadir)' \
216             ; } >$@.tmp
217         $(AM_V_at) mv -f $@.tmp $@
218 check_DATA = atlocal
219 CLEANFILES += atlocal
220
221 include $(top_srcdir)/lib/gnulib.mk
222 include $(top_srcdir)/common/snippet/autotest.mk