summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makefile.unix
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-22 20:31:54 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-22 20:31:54 +0000
commit8548e1273bf068feeeed283e9ae90ca826fd0efa (patch)
tree1ca4b3c73d85ae973e70b9a47567483c57963c25 /crawl-ref/source/makefile.unix
parentfac344b62ebbf48e7b1d2a7b5f0bcdd3608bd4a7 (diff)
downloadcrawl-ref-8548e1273bf068feeeed283e9ae90ca826fd0efa.tar.gz
crawl-ref-8548e1273bf068feeeed283e9ae90ca826fd0efa.zip
Fixed trunk build for DOS and Windows. DOS and Windows builds use a SQLite db,
with a dbm-like wrapper so database.cc builds unchanged. Added SQLite to the source tree. Only DOS and Windows builds use it at the moment, but it can be added to Unix builds easily (and will be added automatically if a suitable db.h or ndbm.h is not found). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1342 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/makefile.unix')
-rw-r--r--crawl-ref/source/makefile.unix65
1 files changed, 50 insertions, 15 deletions
diff --git a/crawl-ref/source/makefile.unix b/crawl-ref/source/makefile.unix
index 1fbf207124..a9403ce67e 100644
--- a/crawl-ref/source/makefile.unix
+++ b/crawl-ref/source/makefile.unix
@@ -41,6 +41,9 @@ INSTALLDIR := /usr/games
# SAVEDIR := /usr/games/crawl-saves/
# DATADIR := /usr/games/crawl-data/
+LEX := flex
+YACC := bison -y
+
ifeq ($(LUASRC),)
LUASRC := util/lua/src
endif
@@ -48,12 +51,41 @@ endif
LUALIB = lua
LUALIBA = l$(LUALIB).a
-LIBDBM = $(shell [ "`ls /usr/lib/libdbm.* 2>/dev/null`" != "" ] \
- && echo 'dbm' || echo 'db')
+SELDBM :=
+DBH_FILE := /usr/include/db.h
+NDBM_FILE := /usr/include/ndbm.h
+
+HAVE_DBH := $(shell [ -f $(DBH_FILE) ] && echo y)
+HAVE_NDBM := $(shell [ -f $(NDBM_FILE) ] && echo y)
+
+ifeq ($(HAVE_DBH),y)
+ifneq ($(shell grep dbm_open $(DBH_FILE)),)
+SELDBM := -DDB_DBH
+LIBDBM := -ldb
+endif
+endif
+
+ifeq ($(HAVE_NDBM),y)
+SELDBM ?= -DDB_NDBM
+ifeq ($(SELDBM), -DDB_NDBM)
+LIBDBM := -ldbm
+endif
+endif
+
+SQLSRC := util/sqlite
+SQLLIB := sqlite3
+SQLLIBA := lib$(SQLLIB).a
+FSQLLIBA := $(SQLSRC)/$(SQLLIBA)
-LIB = -lncurses -L$(LUASRC) -l$(LUALIB) -l$(LIBDBM)
+ifeq ($(LIBDBM),)
+LIBDBM := -L$(SQLSRC) -lsqlite3
+EXTRA_INCLUDES += -I$(SQLSRC)
+EXTRA_DEPENDS += $(FSQLLIBA)
+endif
+
+LIB = -lncurses -L$(LUASRC) -l$(LUALIB) $(LIBDBM)
-INCLUDES := $(INCLUDES) -Iutil -I. -I$(LUASRC)
+INCLUDES := $(INCLUDES) -Iutil -I. -I$(LUASRC) $(EXTRA_INCLUDES)
CFWARN := -Wall -Wwrite-strings \
-Wshadow -pedantic
@@ -68,20 +100,13 @@ ifneq ($(DATADIR),)
CFOTHERS += '-DDATA_DIR_PATH="$(DATADIR)"'
endif
-HAVE_NDBM := $(shell [ -f /usr/include/ndbm.h ] && echo y)
-
-ifeq ($(HAVE_NDBM),y)
-CFOTHERS += -DDB_NDBM
-endif
+CFOTHERS += $(SELDBM)
CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS)
YCFLAGS := $(INCLUDES) $(CFOTHERS)
UTIL = util/
-LEX := flex
-YACC := bison -y
-
YTABC := levcomp.tab.c
YTABH := levcomp.tab.h
@@ -96,7 +121,7 @@ ifeq ($(YACC),)
DOYACC :=
endif
-GAME_DEPENDS := $(OBJECTS)
+GAME_DEPENDS := $(EXTRA_DEPENDS) $(OBJECTS)
SRC_PKG_BASE := stone_soup
SRC_VERSION := $(shell egrep 'VER_NUM *".*"' version.h | \
egrep -o '[0-9]\.[0-9](\.[0-9])?')
@@ -122,7 +147,7 @@ depend: $(OBJECTS:.o=.cc)
@for i in $^; do \
echo "Updating dependencies for $$i"; \
$(CXX) -MM $(CFLAGS) $$i >>$(DEPENDENCY_MKF) 2>/dev/null; \
- done
+ done
-include $(DEPENDENCY_MKF)
@@ -192,7 +217,10 @@ clean:
clean-lua:
cd $(LUASRC) && $(MAKE) clean
-distclean: clean clean-lua
+clean-sql:
+ cd $(SQLSRC) && $(MAKE) clean
+
+distclean: clean clean-lua clean-sql
$(DELETE) bones.*
$(DELETE) morgue.txt
$(DELETE) scores
@@ -229,6 +257,13 @@ $(LUASRC)$(LUALIBA):
cd $(LUASRC) && $(MAKE) crawl_unix
#############################################################################
+# Build SQLite
+
+$(FSQLLIBA):
+ echo Building SQLite
+ cd $(SQLSRC) && $(MAKE)
+
+#############################################################################
# Packaging a source tarball for release
#