]> git.draconx.ca Git - gob-dx.git/blob - Makefile.am
7f099572f602a7f1dbd2d2992bc675ced8d33ea8
[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/treefuncs.def src/treefuncs.stamp t/str.gob t/test-fooable.c \
24              t/test-fooable.h t/test.gob
25
26 CLEANFILES =
27 DISTCLEANFILES =
28 MAINTAINERCLEANFILES = src/treefuncs.c src/treefuncs.h src/treefuncs.stamp
29
30 EXTRA_PROGRAMS = parser-rdeps
31 parser_rdeps_SOURCES = src/main.c src/lexer.l
32 $(parser_rdeps_OBJECTS): src/parse.h
33
34 noinst_HEADERS = src/main.h src/treefuncs.h src/out.h src/util.h src/checks.h
35
36 gob2_SOURCES = src/main.c src/main.h src/treefuncs.c src/out.c src/util.c \
37                src/checks.c src/parse.y src/lexer.l
38 gob2_LDADD = $(LIBGLIB_LIBS) @LEXLIB@
39 $(gob2_OBJECTS): src/treefuncs.h
40
41 man_MANS = doc/gob2.1
42 EXTRA_DIST += doc/makehtml.pl
43
44 PERL_ERROR = @:; { \
45           printf '%s: ERROR: perl was not available at configure time.\n' "$@"; \
46           printf '%s: If perl is installed but was not detected by configure,\n' "$@"; \
47           printf '%s: consider setting PERL and re-running configure.\n' "$@"; \
48         } 1>&2; false
49
50 src/treefuncs.stamp: src/generate_treefuncs.pl src/treefuncs.def
51 if !HAVE_PERL
52         $(PERL_ERROR)
53 endif
54         $(AM_V_at) $(MKDIR_P) $(@D)
55         $(AM_V_GEN) (cd $(@D) && \
56           $(PERL) $(abs_srcdir)/src/generate_treefuncs.pl \
57                   $(abs_srcdir)/src/treefuncs.def; )
58         $(AM_V_at) touch $@
59
60 .stamp.c:
61         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
62 .stamp.h:
63         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
64
65 html-local: doc/gob2.html
66 doc/gob2.html: doc/gob2.1
67 if !HAVE_PERL
68         $(PERL_ERROR)
69 endif
70         $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
71         $(AM_V_at) mv -f $@.tmp $@
72 CLEANFILES += doc/gob2.html
73
74 install-html-local: install-gob2-html
75 install-gob2-html: doc/gob2.html
76         $(MKDIR_P) "$(DESTDIR)$(docdir)"
77         $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
78 .PHONY: install-gob2-html
79
80 uninstall-local: uninstall-gob2-html
81 uninstall-gob2-html:
82         test ! -d "$(DESTDIR)$(docdir)" || \
83           cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
84 .PHONY: uninstall-gob2-html
85
86 m4dir = $(datadir)/aclocal
87 m4_DATA = gob2.m4
88
89 gob2.m4: $(top_srcdir)/common/m4/gob2.m4
90         $(AM_V_GEN) $(SED) 's/DX_PROG_GOB2/GOB2_CHECK/g' \
91           $(top_srcdir)/common/m4/gob2.m4 >$@.tmp
92         $(AM_V_at) mv -f $@.tmp $@
93 DISTCLEANFILES += gob2.m4
94 EXTRA_DIST += common/m4/gob2.m4
95
96 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
97 dist-hook: generate-changelog
98 generate-changelog:
99         -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
100           test -d "$$GIT_DIR" || exit 0; { \
101             $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
102               $(git_changelog_start).. && \
103             echo && \
104             git show $(git_changelog_start):ChangeLog; \
105           } >$(distdir)/ChangeLog.gen && \
106           mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
107         rm -f $(distdir)/ChangeLog.gen
108 .PHONY: generate-changelog
109
110 GENERIC_V   = $(GENERIC_V_@AM_V@)
111 GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
112 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
113
114 TEST_DISTRIBUTION = false
115 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
116   then echo 'Proceeding anyway...'; \
117   else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
118        false; \
119   fi
120
121 distcheck-hook:
122         $(GENERIC_V) : 'CHECK   ' ChangeLog; \
123           $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
124             $(distdir)/ChangeLog || { \
125               echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
126               echo '       *** The source version was used instead, but this appears to'; \
127               echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
128               echo '       *** programs are required for ChangeLog generation to work.'; \
129               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
130         $(GENERIC_V) : 'CHECK   ' NEWS; \
131           $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
132             { print FILENAME ":" NR ":", $$0; exit 1}' \
133             $(distdir)/NEWS || { \
134               echo 'ERROR: *** First line of NEWS should match the package version'; \
135               echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
136               echo '       *** Remember to update NEWS before preparing a release.'; \
137               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
138
139 include $(top_srcdir)/common/snippet/autotest.mk