]> git.draconx.ca Git - rrace.git/blob - Makefile.am
Combine motifgui.dat / motifstr.str into one file.
[rrace.git] / Makefile.am
1 # Copyright © 2022 Nick Bowler
2 #
3 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 # This is free software: you are free to do what the fuck you want to.
5 # There is NO WARRANTY, to the extent permitted by law.
6
7 ACLOCAL_AMFLAGS = -I m4 -I common/m4
8
9 EXTRA_DIST =
10 EXTRA_LIBRARIES =
11 MAINTAINERCLEANFILES =
12 MOSTLYCLEANFILES =
13 DISTCLEANFILES =
14 CLEANFILES = $(EXTRA_LIBRARIES)
15 bin_PROGRAMS =
16
17 AM_CPPFLAGS = -I$(builddir)/src -I$(srcdir)/src -I$(DX_BASEDIR)/src \
18               -I$(builddir)/lib -I$(srcdir)/lib
19 AM_CFLAGS = $(CURSES_CFLAGS) $(MOTIF_CFLAGS)
20
21 if HAVE_CURSES
22 bin_PROGRAMS += rrace-curses
23 endif
24
25 if HAVE_MOTIF
26 bin_PROGRAMS += rrace-motif
27 man_MANS = doc/rrace-motif.1
28 endif
29
30 EXTRA_DIST += doc/rrace-motif.1
31
32 noinst_HEADERS = conf_post.h src/version.h
33
34 rrace_curses_SOURCES = common/src/help.c src/game.c src/version.c
35 rrace_curses_LDADD = $(libcursesmain_a_OBJECTS) libgnu.a $(CURSES_LIBS)
36
37 rrace_motif_SOURCES = src/game.c src/x11.c src/game.h src/motif.h \
38                       src/colour.h src/ewmhicon.c src/ewmhicon.h \
39                       src/version.c src/xcounter.c src/xcounter.h
40 rrace_motif_LDADD = $(libmotifmain_a_OBJECTS) $(libmotifui_a_OBJECTS) \
41                     $(libglohelp_a_OBJECTS) libgnu.a $(MOTIF_LIBS) \
42                     $(LIB_CLOCK_GETTIME) $(LIB_GETHRXTIME)
43 $(rrace_motif_OBJECTS): $(gnulib_headers)
44
45 EXTRA_LIBRARIES += libcursesmain.a
46 libcursesmain_a_SOURCES = src/curses.c
47 $(libcursesmain_a_OBJECTS): $(gnulib_headers)
48 $(libcursesmain_a_OBJECTS): src/cursesopt.h
49
50 EXTRA_LIBRARIES += libmotifmain.a
51 libmotifmain_a_SOURCES = src/motif.c
52 $(libmotifmain_a_OBJECTS): $(gnulib_headers)
53 $(libmotifmain_a_OBJECTS): src/motifopt.h
54
55 EXTRA_LIBRARIES += libmotifui.a
56 libmotifui_a_SOURCES = src/motif_ui.c
57 $(libmotifui_a_OBJECTS): $(gnulib_headers)
58 $(libmotifui_a_OBJECTS): src/motifgui.h
59
60 EXTRA_LIBRARIES += libglohelp.a
61 libglohelp_a_SOURCES = common/src/help.c common/src/help.h
62 libglohelp_a_CFLAGS = -DHELP_GETOPT_LONG_ONLY
63 $(libglohelp_a_OBJECTS): $(gnulib_headers)
64 libglohelp_a_SHORTNAME = glo
65
66 OPTFILES = src/cursesopt.opt src/motifopt.opt
67 .opt.h:
68         $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
69         $(AM_V_at) mv -f $@.tmp $@
70 $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
71 DISTCLEANFILES += $(OPTFILES:.opt=.h)
72 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
73
74 TREEFILES = src/motifgui.dat
75 .dat.h:
76         $(AM_V_GEN) :; { \
77           $(AWK) -f $(DX_BASEDIR)/scripts/gen-tree.awk $< && \
78           printf '%s\n' \
79             'sub(/^#&/, "\\&") == 0 { next }' \
80             '{ has_strtab=1 } END { if (!has_strtab) { exit(0); } print "" }' \
81             | $(AWK) -f - -f $(DX_BASEDIR)/scripts/gen-strtab.awk $<; \
82         } >$@-t
83         $(AM_V_at) mv -f $@-t $@
84 $(TREEFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-strtab.awk
85 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-strtab.awk
86 $(TREEFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-tree.awk
87 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk
88 DISTCLEANFILES += $(TREEFILES:.dat=.h)
89 EXTRA_DIST += $(TREEFILES)
90
91 check_PROGRAMS = t/boardmove t/boardbit t/ewmhicon t/rng-test
92 EXTRA_DIST += t/xos256ss.c
93
94 t_boardmove_SOURCES = t/boardmove.c src/game.c
95 t_boardmove_LDADD = libgnu.a $(LIB_CLOCK_GETTIME) $(LIB_GETHRXTIME)
96 $(t_boardmove_OBJECTS): $(gnulib_headers)
97
98 t_boardbit_SOURCES = t/boardbit.c
99 t_boardbit_LDADD = libgnu.a
100 $(t_boardbit_OBJECTS): $(gnulib_headers)
101
102 t_ewmhicon_SOURCES = t/ewmhicon.c src/ewmhicon.c common/src/help.c
103 t_ewmhicon_LDADD = libgnu.a $(MOTIF_LIBS)
104 $(t_ewmhicon_OBJECTS): $(gnulib_headers)
105
106 t_rng_test_LDADD = libgnu.a
107 $(t_rng_test_OBJECTS): $(gnulib_headers)
108
109 GENPNG_V = $(GENPNG_V_@AM_V@)
110 GENPNG_V_ = $(GENPNG_V_@AM_DEFAULT_V@)
111 GENPNG_V_0 = @printf '  %$(DX_ALIGN_V)s %s\n' 'GEN    ' $*.png;
112
113 $(GENICONS:.png=.gen):
114         $(GENPNG_V) $(MKDIR_P) $(@D)
115         $(AM_V_at) s=`expr $(@F) : '[^0-9]*\([^.]*\)'`; \
116           t/ewmhicon$(EXEEXT) -c yrwyogbbg "$$s" >$*.xpm
117 if USE_NETPBM
118         $(AM_V_at) $(XPMTOPPM) $*.xpm | $(PNMTOPNG) >$*-t.png
119 else
120 if USE_CONVERT
121         $(AM_V_at) $(CONVERT) $*.xpm $*-t.png
122 endif
123 endif
124         $(AM_V_at) $(OPTIPNG) -o7 -quiet $*-t.png
125         $(AM_V_at) mv -f $*-t.png $*.png
126 MOSTLYCLEANFILES += $(GENICONS:.png=-t.png)
127 DISTCLEANFILES += $(GENICONS:.png=.xpm)
128 MAINTAINERCLEANFILES += $(GENICONS)
129 SUFFIXES = .gen
130
131 GENICONS = data/rr48x48.png data/rr32x32.png data/rr24x24.png data/rr16x16.png
132 $(GENICONS): ;
133
134 build-icons: t/ewmhicon$(EXEEXT) $(GENICONS)
135         $(AM_V_at) set x $(GENICONS:.png=); shift; for f; do shift; \
136           test -f "$$f.png" || test -f "$(srcdir)/$$f.png" || \
137             { set x "$$@" "$$f.gen"; shift; }; \
138           done; $(MAKE) $(AM_MAKEFLAGS) "$$@"
139 .PHONY: build-icons
140
141 dist-hook: dist-icons
142 dist-icons: build-icons
143         $(MKDIR_P) $(distdir)/data
144         for f in $(GENICONS); do \
145           if test -f "$$f"; \
146             then cp "$$f" "$(distdir)/data" || exit; \
147             else cp "$(srcdir)/$$f" "$(distdir)/data" || exit; \
148           fi; done
149 .PHONY: dist-icons
150
151 iconsdir = $(datarootdir)/icons/hicolor
152
153 install-data-local: install-icons
154 install-icons: build-icons
155         for f in $(GENICONS); do \
156           s=`expr "$$f" : '[^0-9]*\([^.]*\)'`; \
157           od="$(DESTDIR)$(iconsdir)/$$s/apps"; \
158           $(MKDIR_P) "$$od"; if test -f "$$f"; \
159             then $(INSTALL_DATA) "$$f" "$$od/$(PACKAGE_TARNAME).png"; \
160             else $(INSTALL_DATA) "$(srcdir)/$$f" "$$od/$(PACKAGE_TARNAME).png";\
161           fi; done
162 .PHONY: install-icons
163
164 uninstall-local: uninstall-icons
165 uninstall-icons:
166         for f in $(GENICONS); do \
167           s=`expr "$$f" : '[^0-9]*\([^.]*\)'`; \
168           od="$(DESTDIR)$(iconsdir)/$$s/apps"; \
169           rm -f "$$od/$(PACKAGE_TARNAME).png"; \
170           done
171 .PHONY: uninstall-icons
172
173 include $(top_srcdir)/lib/gnulib.mk
174 include $(top_srcdir)/common/snippet/autotest.mk