libupkg: Make decodeindex test accept an empty string.
[upkg.git] / Makefile.am
1 # Copyright © 2009-2012 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
9 MAINTAINERCLEANFILES =
10 MOSTLYCLEANFILES =
11 CLEANFILES =
12
13 EXTRA_DIST = $(MAINTAINERCLEANFILES) m4/gnulib-cache.m4
14
15 AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
16         -I$(top_builddir)/lib -I$(top_srcdir)/lib \
17         -DPKGLIBDIR=\"$(pkglibdir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
18
19 AM_CFLAGS = $(LTDLINCL) $(GLIB_CFLAGS) $(LIBMODPLUG_CFLAGS)
20
21 bin_PROGRAMS = upkg
22 lib_LTLIBRARIES = libupkg.la libuobject.la
23 pkglib_LTLIBRARIES = engine.la
24 noinst_LTLIBRARIES =
25 EXTRA_LTLIBRARIES =
26 include_HEADERS =
27
28 dist_man_MANS = doc/man/upkg.1
29
30 # This trick should define orderonly to | iff we're using GNU make.
31 have_orderonly = $(findstring order-only,$(.FEATURES))
32 orderonly = $(have_orderonly:order-only=|)
33
34 upkg_SOURCES  = src/upkg.c
35 upkg_LDFLAGS  = $(AM_LDFLAGS) -export-dynamic
36 upkg_LDADD    = libuobject.la libupkg.la libgnu.la $(GLIB_LIBS)
37 $(upkg_OBJECTS): $(gnulib_headers)
38
39 libupkg_la_SOURCES = src/libupkg.c src/pack.c
40
41 uobjectdir = $(includedir)/uobject
42 uobject_HEADERS = src/uobject/uobject.h src/uobject/exportable.h \
43         src/uobject/loadable.h src/uobject/module.h src/uobject/package.h \
44         src/uobject/vfs.h
45
46 libuobject_la_SOURCES = src/uobject/uobject.c src/uobject/module.c \
47         src/uobject/avl.c src/uobject/avl.h src/uobject/package.c \
48         src/uobject/exportable.c src/uobject/loadable.c src/uobject/vfs.c
49 libuobject_la_LDFLAGS  = $(AM_LDFLAGS) -export-symbols-regex '^u_'
50 libuobject_la_LIBADD   = libgnu.la $(LIBLTDL) $(GLIB_LIBS)
51 $(libuobject_la_OBJECTS): $(gnulib_headers)
52
53 libuobject_la = libuobject.la
54 $(libuobject_la): $(LTDLDEPS)
55
56 moduleflags = -module -avoid-version -export-symbols-regex _LTX_
57
58 engine_GOBS = src/engine/palette.gob src/engine/texture.gob \
59         src/engine/music.gob
60
61 MAINTAINERCLEANFILES += $(engine_GOBS:.gob=.gobstamp) \
62         $(engine_GOBS:.gob=.c) $(engine_GOBS:.gob=.h)
63
64 engine_la_SOURCES = $(engine_GOBS:.gob=.c) $(engine_GOBS:.gob=.h) \
65         src/engine/engine.c src/engine/pcx.c
66 engine_la_LDFLAGS  = $(AM_LDFLAGS) $(moduleflags)
67 engine_la_LIBADD   = $(GLIB_LIBS)
68 $(engine_la_OBJECTS): $(orderonly) $(engine_GOBS:.gob=.gobstamp)
69
70 if USE_DUMMYMOD
71 engine_la_SOURCES += src/engine/music-dummymod.c
72 endif
73
74 if USE_LIBMODPLUG
75 engine_la_SOURCES  += src/engine/music-modplug.c src/engine/modplug-types.h
76 engine_la_LIBADD   += $(LIBMODPLUG_LIBS)
77 endif
78
79 check_PROGRAMS = test/decodeindex
80 test_decodeindex_LDADD = libupkg.la libgnu.la
81 $(test_decodeindex_OBJECTS): $(gnulib_headers)
82
83 TESTS_ENVIRONMENT = SHELL='$(SHELL)' EXEEXT='$(EXEEXT)'
84 TEST_EXTENSIONS = .sh
85 SH_LOG_COMPILER = $(SHELL)
86
87 TESTS = tests/libupkg-index-decode.sh
88 EXTRA_DIST += $(TESTS)
89
90 # Supporting rules for GObject Builder
91 GOB_V   = $(GOB_V_$(V))
92 GOB_V_  = $(GOB_V_$(AM_DEFAULT_VERBOSITY))
93 GOB_V_0 = @echo "  GOB   " $<;
94
95 # Unfortunately, GOB's output filenames depend on the contents of the gob file,
96 # rather than its filename.  This isn't really suitable for use with make, so
97 # this rule has to make some assumptions about the source tree layout.
98 .gob.gobstamp:
99         $(GOB_V) $(GOB2) -o src --file-sep=/ --no-private-header $<
100         $(AM_V_at) touch $@
101
102 STAMP_RECOVER = \
103         @if test -f $@; then :; else rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; fi
104 .gobstamp.c: ; $(STAMP_RECOVER)
105 .gobstamp.h: ; $(STAMP_RECOVER)
106
107 include $(top_srcdir)/lib/gnulib.mk
108 if BUNDLED_LIBLTDL
109 include $(top_srcdir)/libltdl/ltdl.mk
110 endif