]> git.draconx.ca Git - gob-dx.git/blob - Makefile.am
Fix error message from 'make html' with no perl.
[gob-dx.git] / Makefile.am
1 # Copyright © 2019-2020 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$(builddir) -I$(srcdir) -DPKGDATADIR=\"$(pkgdatadir)\"
13 AM_CFLAGS = $(LIBGLIB_CFLAGS)
14 AM_YFLAGS = -d -t
15
16 bin_PROGRAMS = gob2
17
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 \
25              t/test.gob
26
27 CLEANFILES =
28 DISTCLEANFILES =
29 MAINTAINERCLEANFILES = src/lexer.c src/lexer.h src/lexer.stamp \
30                        src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
31
32 EXTRA_PROGRAMS = parser-rdeps
33 parser_rdeps_SOURCES = src/main.c src/lexer.c
34 $(parser_rdeps_OBJECTS): src/parse.h
35
36 noinst_HEADERS = src/main.h src/treefuncs.h src/out.h src/util.h src/checks.h
37
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
42
43 man_MANS = doc/gob2.1
44 EXTRA_DIST += doc/makehtml.pl
45
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    ' $<;
49
50 TOOL_ERROR = { \
51   echo "ERROR: *** $$tool is missing on your system."; \
52   echo "       *** Because of this, I cannot compile $$toolsrc."; \
53   echo "       *** If $$tool is installed but was not detected by configure,";\
54   echo "       *** consider setting $$toolvar and re-running configure."; \
55   echo "       *** See config.log for more details."; } >&2; false
56
57 DEV_TOOL_ERROR = { \
58   echo "ERROR: *** $$tool is missing on your system."; \
59   echo "       *** Because of this, I cannot compile $$toolsrc, but"; \
60   echo "       *** (perhaps because you modified it) the sources appear out"; \
61   echo "       *** of date.  If $$tool is installed but was not detected by"; \
62   echo "       *** configure, consired setting $$toolvar and re-running configure."; \
63   echo "       *** See config.log for more details."; } >&2; false
64
65 src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
66 if !HAVE_PERL
67         @tool=perl toolvar=PERL toolsrc=src/treefuncs.def; $(DEV_TOOL_ERROR)
68 endif
69         $(AM_V_at) $(MKDIR_P) $(@D) && touch $@.tmp
70         $(AM_V_GEN) (cd $(@D) && \
71           $(PERL) $(abs_srcdir)/src/generate_treefuncs.pl \
72                   $(abs_srcdir)/src/treefuncs.def; )
73         $(AM_V_at) mv -f $@.tmp $@
74
75 .l.c: ;
76 .l.stamp:
77 if !HAVE_FLEX
78         @tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
79 endif
80         $(AM_V_at) touch $@.tmp
81         $(AM_V_at) rm -f $*.h.tmp; mv -f $*.h $*.h.tmp 2>/dev/null; :
82         $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h $(FLEXFLAGS) $<
83         $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; \
84           then mv -f $*.h.tmp $*.h; \
85           else rm -f $*.h.tmp; fi
86         $(AM_V_at) mv -f $@.tmp $@
87
88 .stamp.c:
89         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
90 .stamp.h:
91         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
92
93 # Required to prevent the builtin lex rule from superseding ours
94 src/lexer.c src/lexer.h: src/lexer.stamp
95
96 html-local: doc/gob2.html
97 doc/gob2.html: doc/gob2.1
98 if !HAVE_PERL
99         @tool=perl toolvar=PERL toolsrc=$@; $(TOOL_ERROR)
100 endif
101         $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
102         $(AM_V_at) mv -f $@.tmp $@
103 CLEANFILES += doc/gob2.html
104
105 install-html-local: install-gob2-html
106 install-gob2-html: doc/gob2.html
107         $(MKDIR_P) "$(DESTDIR)$(docdir)"
108         $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
109 .PHONY: install-gob2-html
110
111 uninstall-local: uninstall-gob2-html
112 uninstall-gob2-html:
113         test ! -d "$(DESTDIR)$(docdir)" || \
114           cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
115 .PHONY: uninstall-gob2-html
116
117 m4dir = $(datadir)/aclocal
118 m4_DATA = gob2.m4
119
120 gob2.m4: $(top_srcdir)/common/m4/gob2.m4
121         $(AM_V_GEN) $(SED) 's/DX_PROG_GOB2/GOB2_CHECK/g' \
122           $(top_srcdir)/common/m4/gob2.m4 >$@.tmp
123         $(AM_V_at) mv -f $@.tmp $@
124 DISTCLEANFILES += gob2.m4
125 EXTRA_DIST += common/m4/gob2.m4
126
127 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
128 dist-hook: generate-changelog
129 generate-changelog: unfuck-distdir
130         -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
131           export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
132             $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
133               $(git_changelog_start).. && \
134             echo && \
135             git show $(git_changelog_start):ChangeLog; \
136           } >$(distdir)/ChangeLog.gen && \
137           mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
138         rm -f $(distdir)/ChangeLog.gen
139 .PHONY: generate-changelog
140
141 # Ensure that any generated headers, which may be left unchanged to improve
142 # incremental build performance, are fully up-to-date in the distribution.
143 dist-hook: update-headers
144 update-headers: unfuck-distdir
145         touch -c $(distdir)/src/lexer.h
146 .PHONY: update-headers
147
148 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
149 # will produce a distribution with all files read-only.  Moreover, the files
150 # are read-only in distdir when the dist hooks are run.  This hook will fix
151 # up the permission.  All dist hooks that modify files in distdir should list
152 # unfuck-distdir as a prerequisite.
153 dist-hook: unfuck-distdir
154 unfuck-distdir:
155         find '$(distdir)' -type f -exec chmod u+w {} +
156 .PHONY: unfuck-distdir
157
158 GENERIC_V   = $(GENERIC_V_@AM_V@)
159 GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
160 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
161
162 TEST_DISTRIBUTION = false
163 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
164   then echo 'Proceeding anyway...'; \
165   else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
166        false; \
167   fi
168
169 distcheck-hook:
170         $(GENERIC_V) : 'CHECK   ' ChangeLog; \
171           $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
172             $(distdir)/ChangeLog || { \
173               echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
174               echo '       *** The source version was used instead, but this appears to'; \
175               echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
176               echo '       *** programs are required for ChangeLog generation to work.'; \
177               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
178         $(GENERIC_V) : 'CHECK   ' NEWS; \
179           $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
180             { print FILENAME ":" NR ":", $$0; exit 1}' \
181             $(distdir)/NEWS || { \
182               echo 'ERROR: *** First line of NEWS should match the package version'; \
183               echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
184               echo '       *** Remember to update NEWS before preparing a release.'; \
185               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
186
187 include $(top_srcdir)/common/snippet/autotest.mk