]> git.draconx.ca Git - upkg.git/blob - Makefile.am
Use GLib detection macros from dxcommon.
[upkg.git] / Makefile.am
1 # Copyright © 2009-2012, 2015, 2019-2020 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 MAINTAINERCLEANFILES =
10 MOSTLYCLEANFILES =
11 DISTCLEANFILES =
12 CLEANFILES =
13
14 EXTRA_DIST = $(MAINTAINERCLEANFILES) m4/gnulib-cache.m4
15
16 AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
17         -I$(top_srcdir)/$(DX_BASEDIR)/src \
18         -I$(top_builddir)/lib -I$(top_srcdir)/lib \
19         -DPKGLIBDIR=\"$(pkglibdir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
20
21 AM_CFLAGS = $(LTDLINCL) $(GLIB_CFLAGS) $(LIBMODPLUG_CFLAGS)
22
23 bin_PROGRAMS = upkg
24 lib_LTLIBRARIES = libupkg.la libuobject.la
25 pkglib_LTLIBRARIES = engine.la
26 noinst_LTLIBRARIES =
27 EXTRA_LTLIBRARIES =
28 include_HEADERS =
29
30 dist_man_MANS = doc/man/upkg.1
31
32 # This trick should define orderonly to | iff we're using GNU make.
33 have_orderonly = $(findstring order-only,$(.FEATURES))
34 orderonly = $(have_orderonly:order-only=|)
35
36 upkg_SOURCES  = src/upkg.c src/upkg.h
37 upkg_LDFLAGS  = $(AM_LDFLAGS) -export-dynamic
38 upkg_LDADD    = libuobject.la libupkg.la libgnu.la $(GLIB_LIBS)
39 $(upkg_OBJECTS): $(gnulib_headers)
40
41 libupkg_la_SOURCES = src/libupkg.c common/src/pack.c common/src/pack.h
42
43 uobjectdir = $(includedir)/uobject
44 uobject_HEADERS = src/uobject/uobject.h src/uobject/exportable.h \
45         src/uobject/loadable.h src/uobject/module.h src/uobject/package.h \
46         src/uobject/vfs.h
47
48 libuobject_la_SOURCES = src/uobject/uobject.c src/uobject/module.c \
49         src/uobject/avl.c src/uobject/avl.h src/uobject/package.c \
50         src/uobject/exportable.c src/uobject/loadable.c src/uobject/vfs.c
51 libuobject_la_LDFLAGS  = $(AM_LDFLAGS) -export-symbols-regex '^u_'
52 libuobject_la_LIBADD   = libgnu.la $(LIBLTDL) $(GLIB_LIBS)
53 $(libuobject_la_OBJECTS): $(gnulib_headers)
54
55 libuobject_la = libuobject.la
56 $(libuobject_la): $(LTDLDEPS)
57
58 moduleflags = -module -avoid-version -export-symbols-regex _LTX_
59
60 engine_GOBS = src/engine/palette.gob src/engine/texture.gob \
61         src/engine/music.gob src/engine/sound.gob
62
63 MAINTAINERCLEANFILES += $(engine_GOBS:.gob=.gobstamp) \
64         $(engine_GOBS:.gob=.c) $(engine_GOBS:.gob=.h)
65
66 engine_la_SOURCES = $(engine_GOBS:.gob=.c) $(engine_GOBS:.gob=.h) \
67         src/engine/engine.c \
68         src/engine/music-module.h \
69         src/engine/pcx.c \
70         src/engine/pcx.h
71 engine_la_LDFLAGS  = $(AM_LDFLAGS) $(moduleflags)
72 engine_la_LIBADD   = $(GLIB_LIBS)
73 $(engine_la_OBJECTS): $(orderonly) $(engine_GOBS:.gob=.gobstamp)
74
75 if USE_DUMMYMOD
76 engine_la_SOURCES += src/engine/music-dummymod.c
77 endif
78
79 if USE_LIBMODPLUG
80 engine_la_SOURCES  += src/engine/music-modplug.c src/engine/modplug-types.h
81 engine_la_LIBADD   += $(LIBMODPLUG_LIBS)
82 endif
83
84 check_LTLIBRARIES = libtest.la
85 check_PROGRAMS = test/decodeindex test/pcxrle
86
87 libtest_la_SOURCES = test/common.c test/common.h
88
89 test_decodeindex_LDADD = libupkg.la libgnu.la libtest.la
90 $(test_decodeindex_OBJECTS): $(gnulib_headers)
91 test_pcxrle_LDADD = src/engine/pcx.lo libupkg.la libgnu.la libtest.la
92 $(test_pcxrle_OBJECTS): $(gnulib_headers)
93
94 TESTS_ENVIRONMENT = SHELL='$(SHELL)' EXEEXT='$(EXEEXT)'
95 TEST_EXTENSIONS = .sh
96 SH_LOG_COMPILER = $(SHELL)
97
98 TESTS = tests/libupkg-index-decode.sh tests/engine-pcx-rlencode.sh
99 EXTRA_DIST += $(TESTS)
100
101 # Supporting rules for GObject Builder
102 GOB_V   = $(GOB_V_@AM_V@)
103 GOB_V_  = $(GOB_V_@AM_DEFAULT_V@)
104 GOB_V_0 = @printf '  %$(DX_ALIGN_V)s %s\n' 'GOB     ' $<;
105
106 # Unfortunately, GOB's output filenames depend on the contents of the gob file,
107 # rather than its filename.  This isn't really suitable for use with make, so
108 # this rule has to make some assumptions about the source tree layout.
109 .gob.gobstamp:
110 if HAVE_GOB2_DYN
111         $(GOB_V) $(GOB2) -o src --file-sep=/ --no-private-header $<
112         $(AM_V_at) touch $@
113 else
114 if HAVE_GOB2
115         @echo "ERROR: *** $(GOB2) does not support dynamic types." 1>&2
116 else
117         @echo "ERROR: *** gob2 is missing on your system."  1>&2
118 endif
119         @:; { \
120          echo "       *** Because of this, I cannot compile $<, but"; \
121          echo "       *** (perhaps because you modified it) the sources appear out of date."; \
122          echo "       *** A newer version of gob2 may be required; the latest version"; \
123          echo "       *** may be found at <https://draconx.ca/projects/gob-dx/>."; \
124          echo "       *** See config.log for more details."; \
125         } 1>&2
126         @false
127 endif
128
129 STAMP_RECOVER = \
130         @if test -f $@; then :; else rm -f $<; $(MAKE) $(AM_MAKEFLAGS) $<; fi
131 .gobstamp.c: ; $(STAMP_RECOVER)
132 .gobstamp.h: ; $(STAMP_RECOVER)
133
134 include $(top_srcdir)/lib/gnulib.mk
135 include $(top_srcdir)/libltdl/ltdl.mk