]> git.draconx.ca Git - gob-dx.git/blob - Makefile.am
Convert command-line options processing to getopt_long.
[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
45 gob2_LDADD = $(LIBGLIB_LIBS) libgnu.a
46 $(gob2_OBJECTS): src/treefuncs.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 .l.c: ;
81 .l.stamp:
82 if !HAVE_FLEX
83         @tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
84 endif
85         $(AM_V_at) touch $@.tmp
86         $(AM_V_at) rm -f $*.h.tmp; mv -f $*.h $*.h.tmp 2>/dev/null; :
87         $(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h $(FLEXFLAGS) $<
88         $(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; \
89           then mv -f $*.h.tmp $*.h; \
90           else rm -f $*.h.tmp; fi
91         $(AM_V_at) mv -f $@.tmp $@
92
93 .stamp.c:
94         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
95 .stamp.h:
96         @test -f $@ || { rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; }
97
98 # Required to prevent the builtin lex rule from superseding ours
99 src/lexer.c src/lexer.h: src/lexer.stamp
100
101 html-local: doc/gob2.html
102 doc/gob2.html: doc/gob2.1
103 if !HAVE_PERL
104         @tool=perl toolvar=PERL toolsrc=$@; $(TOOL_ERROR)
105 endif
106         $(AM_V_GEN) $(PERL) $(top_srcdir)/doc/makehtml.pl <doc/gob2.1 >$@.tmp
107         $(AM_V_at) mv -f $@.tmp $@
108 CLEANFILES += doc/gob2.html
109
110 install-html-local: install-gob2-html
111 install-gob2-html: doc/gob2.html
112         $(MKDIR_P) "$(DESTDIR)$(docdir)"
113         $(INSTALL_DATA) doc/gob2.html "$(DESTDIR)$(docdir)/gob2.html"
114 .PHONY: install-gob2-html
115
116 uninstall-local: uninstall-gob2-html
117 uninstall-gob2-html:
118         test ! -d "$(DESTDIR)$(docdir)" || \
119           cd "$(DESTDIR)$(docdir)" && rm -f gob2.html
120 .PHONY: uninstall-gob2-html
121
122 m4dir = $(datadir)/aclocal
123 m4_DATA = gob2.m4
124
125 gob2.m4: $(top_srcdir)/common/m4/gob2.m4
126         $(AM_V_GEN) $(SED) 's/DX_PROG_GOB2/GOB2_CHECK/g' \
127           $(top_srcdir)/common/m4/gob2.m4 >$@.tmp
128         $(AM_V_at) mv -f $@.tmp $@
129 DISTCLEANFILES += gob2.m4
130 EXTRA_DIST += common/m4/gob2.m4
131
132 git_changelog_start = 2cd951c678998b2b0230c8eb25717ecf0f1dd2db
133 dist-hook: generate-changelog
134 generate-changelog: unfuck-distdir
135         -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
136           export GIT_DIR; test -d "$$GIT_DIR" || exit 0; { \
137             $(PERL) -x $(top_srcdir)/build-aux/gitlog-to-changelog -- \
138               $(git_changelog_start).. && \
139             echo && \
140             git show $(git_changelog_start):ChangeLog; \
141           } >$(distdir)/ChangeLog.gen && \
142           mv -f $(distdir)/ChangeLog.gen $(distdir)/ChangeLog
143         rm -f $(distdir)/ChangeLog.gen
144 .PHONY: generate-changelog
145
146 # Ensure that any generated headers, which may be left unchanged to improve
147 # incremental build performance, are fully up-to-date in the distribution.
148 dist-hook: update-headers
149 update-headers: unfuck-distdir
150         touch -c $(distdir)/src/lexer.h
151 .PHONY: update-headers
152
153 # When running "make dist" in a VPATH build with a read-only srcdir, Automake
154 # will produce a distribution with all files read-only.  Moreover, the files
155 # are read-only in distdir when the dist hooks are run.  This hook will fix
156 # up the permission.  All dist hooks that modify files in distdir should list
157 # unfuck-distdir as a prerequisite.
158 dist-hook: unfuck-distdir
159 unfuck-distdir:
160         find '$(distdir)' -type f -exec chmod u+w {} +
161 .PHONY: unfuck-distdir
162
163 GENERIC_V   = $(GENERIC_V_@AM_V@)
164 GENERIC_V_  = $(GENERIC_V_@AM_DEFAULT_V@)
165 GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
166
167 TEST_DISTRIBUTION = false
168 TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
169   then echo 'Proceeding anyway...'; \
170   else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
171        false; \
172   fi
173
174 distcheck-hook:
175         $(GENERIC_V) : 'CHECK   ' ChangeLog; \
176           $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
177             $(distdir)/ChangeLog || { \
178               echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
179               echo '       *** The source version was used instead, but this appears to'; \
180               echo '       *** be the stub from a git checkout.  The "git" and "perl"'; \
181               echo '       *** programs are required for ChangeLog generation to work.'; \
182               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
183         $(GENERIC_V) : 'CHECK   ' NEWS; \
184           $(AWK) -F: 'NR == 1 && $$1 != "$(PACKAGE_VERSION)" \
185             { print FILENAME ":" NR ":", $$0; exit 1}' \
186             $(distdir)/NEWS || { \
187               echo 'ERROR: *** First line of NEWS should match the package version'; \
188               echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
189               echo '       *** Remember to update NEWS before preparing a release.'; \
190               $(TEST_DISTRIBUTION_OR_ERROR); } >&2
191
192 atlocal: config.status
193         $(AM_V_GEN) :; { \
194           printf ': "$${%s=%s}"\n' \
195             CC '$(CC)' \
196             CXX '$(CXX)' \
197             CPPFLAGS '$(CPPFLAGS)' \
198             CFLAGS '$(CFLAGS)' \
199             CXXFLAGS '$(CXXFLAGS)' \
200             LDFLAGS '$(LDFLAGS)' \
201             GTK_CFLAGS '$(GTK_CFLAGS)' \
202             GTK_LIBS '$(GTK_LIBS)' \
203             LIBGOBJECT_CFLAGS '$(LIBGOBJECT_CFLAGS)' \
204             LIBGOBJECT_LIBS '$(LIBGOBJECT_LIBS)' \
205             HAVE_GOBJECT '$(HAVE_GOBJECT)' \
206             HAVE_GTK2 '$(HAVE_GTK2)' \
207             pkgdatadir '$(pkgdatadir)' \
208             ; } >$@.tmp
209         $(AM_V_at) mv -f $@.tmp $@
210 check_DATA = atlocal
211 CLEANFILES += atlocal
212
213 include $(top_srcdir)/lib/gnulib.mk
214 include $(top_srcdir)/common/snippet/autotest.mk