]> git.draconx.ca Git - liblbx.git/blob - Makefile.am
Convert tools to use option generator script from dxcommon.
[liblbx.git] / Makefile.am
1 # Copyright © 2009-2010,2013-2014,2021 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 AUTOMAKE_OPTIONS = parallel-tests color-tests
8 ACLOCAL_AMFLAGS = -I m4 -I common/m4
9
10 # For Gnulib
11 MOSTLYCLEANFILES =
12 EXTRA_LTLIBRARIES =
13
14 EXTRA_DIST = bootstrap $(DX_BASEDIR)/scripts/fix-gnulib.pl m4/gnulib-cache.m4
15 CLEANFILES = $(EXTRA_LTLIBRARIES)
16
17 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
18               -I$(top_builddir)/src -I$(top_srcdir)/src \
19               -I$(top_srcdir)/common/src
20 AM_CFLAGS = $(LIBPNG_CFLAGS) $(GTK_CFLAGS)
21
22 dist_man_MANS = doc/man/lbxtool.1 doc/man/lbximg.1
23 dist_doc_DATA = doc/txt/moo2-data.txt
24
25 lbxdir = $(includedir)/lbx
26 lbx_HEADERS = src/lbx.h src/image.h src/error.h
27 noinst_HEADERS = src/misc.h src/tools.h src/imgoutput.h common/src/help.h
28
29 lib_LTLIBRARIES = liblbx.la
30 liblbx_la_SOURCES = src/lbx.c src/fops.c src/image.c src/error.c \
31                     common/src/pack.c common/src/pack.h
32 liblbx_la_LDFLAGS = -export-symbols-regex '^lbx_'
33
34 bin_PROGRAMS = lbxtool lbximg
35 if BUILD_LBXGUI
36 bin_PROGRAMS += lbxgui
37 endif
38
39 lbxtool_SOURCES = src/lbxtool.c src/tools.c common/src/help.c
40 lbxtool_LDADD = liblbx.la libgnu.la
41 $(lbxtool_OBJECTS): $(gnulib_headers)
42 $(lbxtool_OBJECTS): src/toolopts.h
43
44 lbximg_SOURCES = src/lbximg.c src/tools.c src/pnm.c common/src/help.c
45 lbximg_LDADD = liblbx.la libgnu.la $(LIBPNG_LIBS)
46 $(lbximg_OBJECTS): $(gnulib_headers)
47 $(lbximg_OBJECTS): src/imgopts.h
48
49 if HAVE_LIBPNG
50 lbximg_SOURCES += src/png.c
51 endif
52
53 nodist_lbxgui_SOURCES = src/gui/lbxgui.glade.c
54 lbxgui_SOURCES = src/gui/lbxgui.c src/gui/lbxgui.h src/gui/image.c \
55         src/gui/bg.xbm
56 lbxgui_LDFLAGS = $(AM_LDFLAGS) -export-dynamic
57 lbxgui_LDADD = liblbx.la $(GTK_LIBS)
58
59 TEST_EXTENSIONS = .tap
60
61 TAP_LOG_COMPILER = $(SHELL)
62 TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' \
63         $(SHELL) $(srcdir)/tests/util/tap-driver.sh
64
65 TESTS = tests/broken-archives.tap tests/empty-image.tap tests/pam-formats.tap \
66         tests/moo2-mainmenu.tap tests/moo2-logo.tap tests/moo2-starbg.tap \
67         tests/moo2-ships.tap tests/moo2-monster.tap
68
69 mostlyclean-local: clean-testdirs
70 clean-testdirs:
71         for dir in $(TESTS:.tap=.dir); do \
72                 case $$dir in \
73                 *.dir) rm -rf "$$dir" ;; \
74                 esac; \
75         done
76 .PHONY: clean-testdirs
77
78 OPTFILES = src/toolopts.opt src/imgopts.opt
79 .opt.h:
80         $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
81         $(AM_V_at) mv -f $@.tmp $@
82 $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
83 CLEANFILES += $(OPTFILES:.opt=.h)
84 EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
85
86 .xml.c:
87         $(AM_V_GEN) printf '%s\n' $(*F) | sed -e 's/[^[:alnum:]]/_/g' \
88                 -e 's/.*/const char &[] =/' > $@.tmp
89         $(AM_V_at) sed -e 's/\\/\\\\/g' \
90                 -e 's/"/\\"/g' \
91                 -e 's/.*/"&\\n"/' \
92                 -e '$$ s/$$/;/' $< >> $@.tmp
93         $(AM_V_at) mv -f $@.tmp $@
94
95 EXTRA_DIST += src/gui/lbxgui.glade.xml
96 CLEANFILES += src/gui/lbxgui.glade.c
97
98 include lib/gnulib.mk