summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-02-20 06:37:07 (EST)
committer P. J. McDermott <pjm@nac.net>2013-02-20 06:47:26 (EST)
commit46a5952de18f4585dac2a2b0962c269344c62be4 (patch)
treeec64bbc0551329c57877e91c6c2b18b4e3783b7f
parent029cadafc8f1be2949b92548b3407e0eff956df8 (diff)
downloadoverworld-rpg-46a5952de18f4585dac2a2b0962c269344c62be4.zip
overworld-rpg-46a5952de18f4585dac2a2b0962c269344c62be4.tar.gz
overworld-rpg-46a5952de18f4585dac2a2b0962c269344c62be4.tar.bz2
Improve build system.
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am12
-rw-r--r--configure.ac20
-rw-r--r--data/Makefile.am8
-rw-r--r--data/tilesets/Makefile.am24
-rw-r--r--data/tilesets/collision.pngbin209 -> 0 bytes
-rw-r--r--data/tilesets/mountain_landscape_19-16.pngbin149736 -> 0 bytes
-rw-r--r--src/compression.c2
-rw-r--r--src/resources/map.c2
9 files changed, 52 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index 9293bf8..5fa0f18 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,7 +18,9 @@ stamp-h1
.dirstamp
*.o
sdlex
+data/tilesets/*.png
*.tar.*
+sdlex-*/
*.s[a-w]?
Session.vim
diff --git a/Makefile.am b/Makefile.am
index 7c5108e..89ed355 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,7 @@
bin_PROGRAMS = sdlex
include $(top_srcdir)/src/Makefile.am
+include $(top_srcdir)/data/Makefile.am
sdlex_SOURCES = $(src_SOURCES)
@@ -15,13 +16,4 @@ sdlex_LDADD = $(SDL_LIBS) \
$(ZLIB_LIBS) \
$(EXPAT_LIBS)
-data_DATA = data/forest1-8bit.tmx \
- data/town1.tmx \
- data/town2.tmx \
- data/tilesets/collision.tsx \
- data/tilesets/collision.xcf \
- data/tilesets/collision.png \
- data/tilesets/mountain_landscape_19-16-8bit.xcf \
- data/tilesets/mountain_landscape_19-16-8bit.png
-
-EXTRA_DIST = $(data_DATA)
+clean-local: clean-local-data
diff --git a/configure.ac b/configure.ac
index 16e4ced..15a3d6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,16 +8,16 @@ AM_PROG_CC_C_O()
AC_C_INLINE()
-AC_CHECK_HEADERS([stdlib.h])
-AC_CHECK_HEADERS([string.h])
-AC_CHECK_HEADERS([inttypes.h])
+AC_CHECK_HEADERS([stdlib.h string.h inttypes.h],
+ [],
+ [AC_MSG_ERROR([cannot find or include standard C library headers])])
AC_TYPE_SIZE_T()
AC_FUNC_MALLOC()
-AC_CHECK_FUNCS([memset])
-AC_CHECK_FUNCS([strdup])
-AC_CHECK_FUNCS([strndup])
+AC_CHECK_FUNCS([memset strdup strndup],
+ [],
+ [AC_MSG_ERROR([cannot find standard C library functions])])
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES([SDL], [sdl])
@@ -25,6 +25,14 @@ PKG_CHECK_MODULES([SDL_IMAGE], [SDL_image])
PKG_CHECK_MODULES([ZLIB], [zlib])
PKG_CHECK_MODULES([EXPAT], [expat])
+AC_ARG_VAR([XCF2PNG], [path to xcf2png utility])
+AC_CHECK_PROGS([XCF2PNG], [xcf2png], [no])
+if test "x$XCF2PNG" = "xno"; then
+ AC_MSG_ERROR(
+[cannot find xcf2png
+xcftools may need to be installed.])
+fi
+
if test "x$GCC" = "xyes"; then
GCC_CFLAGS="-pedantic -Wall -Wextra -Werror"
GCC_CFLAGS="${GCC_CFLAGS} -Wformat=2 -Wswitch -Wswitch-enum"
diff --git a/data/Makefile.am b/data/Makefile.am
new file mode 100644
index 0000000..dae37c2
--- /dev/null
+++ b/data/Makefile.am
@@ -0,0 +1,8 @@
+include $(top_srcdir)/data/tilesets/Makefile.am
+
+dist_data_DATA = \
+ data/forest1-8bit.tmx \
+ data/town1.tmx \
+ data/town2.tmx
+
+clean-local-data: clean-local-data-tilesets
diff --git a/data/tilesets/Makefile.am b/data/tilesets/Makefile.am
new file mode 100644
index 0000000..3c2782d
--- /dev/null
+++ b/data/tilesets/Makefile.am
@@ -0,0 +1,24 @@
+tilesets_sources = \
+ data/tilesets/collision.xcf \
+ data/tilesets/mountain_landscape_19-16-8bit.xcf
+
+tilesetsdir = $(datadir)/tilesets
+
+tilesets_DATA = \
+ data/tilesets/collision.png \
+ data/tilesets/mountain_landscape_19-16-8bit.png
+ data/tilesets/collision.tsx
+
+EXTRA_DIST = $(tilesets_sources)
+
+data/tilesets/$(am__dirstamp):
+ @$(MKDIR_P) data/tilesets
+ @: > data/tilesets/$(am__dirstamp)
+
+$(tilesets_DATA): data/tilesets/$(am__dirstamp)
+
+.xcf.png:
+ $(XCF2PNG) -f -o $@ $<
+
+clean-local-data-tilesets:
+ -rm -f data/tilesets/*.png
diff --git a/data/tilesets/collision.png b/data/tilesets/collision.png
deleted file mode 100644
index 6d9a18b..0000000
--- a/data/tilesets/collision.png
+++ /dev/null
Binary files differ
diff --git a/data/tilesets/mountain_landscape_19-16.png b/data/tilesets/mountain_landscape_19-16.png
deleted file mode 100644
index 54e619c..0000000
--- a/data/tilesets/mountain_landscape_19-16.png
+++ /dev/null
Binary files differ
diff --git a/src/compression.c b/src/compression.c
index fcec2b4..95def11 100644
--- a/src/compression.c
+++ b/src/compression.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
-#include "../config.h"
+#include <config.h>
#include "compression.h"
#include "logging.h"
diff --git a/src/resources/map.c b/src/resources/map.c
index c6a62f4..ea62608 100644
--- a/src/resources/map.c
+++ b/src/resources/map.c
@@ -3,7 +3,7 @@
#include <libgen.h>
#include <ctype.h>
#include <expat.h>
-#include "../../config.h"
+#include <config.h>
#include "map.h"
#include "resource.h"
#include "../xml.h"