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