summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/makefile.mgw
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-22 08:41:20 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-22 08:41:20 +0000
commit1d0f57cbceb778139ca215cc4fcfd1584951f6dd (patch)
treecafd60c944c51fcce778aa5d6912bc548c518339 /crawl-ref/source/makefile.mgw
parent6f5e187a9e5cd348296dba2fd89d2e206e775a01 (diff)
downloadcrawl-ref-1d0f57cbceb778139ca215cc4fcfd1584951f6dd.tar.gz
crawl-ref-1d0f57cbceb778139ca215cc4fcfd1584951f6dd.zip
Merged stone_soup r15:451 into trunk.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@452 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/makefile.mgw')
-rw-r--r--crawl-ref/source/makefile.mgw151
1 files changed, 130 insertions, 21 deletions
diff --git a/crawl-ref/source/makefile.mgw b/crawl-ref/source/makefile.mgw
index 499d3e22d2..17a47f132c 100644
--- a/crawl-ref/source/makefile.mgw
+++ b/crawl-ref/source/makefile.mgw
@@ -1,51 +1,160 @@
-# Make file for Dungeon Crawl (dos)
+# Make file for Dungeon Crawl (Win32, MinGW)
-# this file contains a list of the libraries.
-# it will make a variable called OBJECTS that contains all the libraries
+# makefile.obj includes a list of object files needed to build Crawl.
include makefile.obj
+ifeq ($(DEBUG_CRAWL),)
+OPATH := rel
+else
+OPATH := dbg
+endif
+
# need .exe so make will find the right file
-APPNAME = crawl.exe
+APPNAME = $(OPATH)\crawl.exe
CXX = g++
-DELETE = rm
+DELETE = del
COPY = copy
OS_TYPE = WIN32CONSOLE
-CFLAGS = -Wall -Wwrite-strings -Wstrict-prototypes \
- -Wmissing-prototypes -Wmissing-declarations \
- -D$(OS_TYPE) $(EXTRA_FLAGS)
+
+INSTALLDIR := $(OPATH)
+
+LIB = -lwinmm -static
+
+CFWARN := -Wall -Wwrite-strings \
+ -Wshadow \
+ -Werror \
+ -pedantic
+
+INCLUDES := -Iutil -I.
+
+CFOTHERS := -fsigned-char \
+ -fstrict-aliasing \
+ -pedantic \
+ -D$(OS_TYPE) $(EXTRA_FLAGS) \
+ -DWINMM_PLAY_SOUNDS
+
+CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS)
+YCFLAGS := $(INCLUDES) $(CFOTHERS)
+
+OBJECTS := $(OBJECTS) libw32c.o
+
LDFLAGS =
-INSTALLDIR = .
+
#LIB = -lcurso -lpano
-LIB = -lwinmm -static -lpcre -lluacore -lluastd
+
+UTIL = util/
+
+# If you don't have flex or bison, set DOYACC to N or empty.
+DOYACC := n
+
+LEX := flex
+YACC := bison -y
+
+YTABC := levcomp.tab.c
+YTABH := levcomp.tab.h
+
+
+ifeq ($(LEX),)
+DOYACC :=
+endif
+
+ifeq ($(YACC),)
+DOYACC :=
+endif
+
+# Do the levcomp stuff first because that's the most likely to fail.
+OBJECTS := levcomp.tab.o levcomp.lex.o levcomp.o \
+ $(OBJECTS)
+
+OBJECTS := $(foreach file,$(OBJECTS),$(OPATH)/$(file))
+
+GAME_DEPENDS := prepare $(OBJECTS)
+
+##########################################################################
all: $(APPNAME)
+prepare:
+ if not exist $(OPATH) mkdir $(OPATH)
+
+##########################################################################
+# The level compiler
+#
+ifeq ($(DOYACC),y)
+
+# [ds] A plague on the broken copy command on Windoze.
+prebuildyacc: $(UTIL)levcomp.lex.cc $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h
+ $(subst /,\,for %%f in ($^) do $(COPY) %%f prebuilt)
+
+$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
+ $(subst /,\, cd $(UTIL)) && $(YACC) -d -b levcomp levcomp.ypp
+ $(subst /,\, cd $(UTIL)) && move $(YTABC) levcomp.tab.cc
+
+$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
+ $(subst /,\, cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp)
+
+else
+
+$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
+ $(subst /,\,$(COPY) prebuilt/*.h $(UTIL))
+ $(subst /,\,$(COPY) $< $@)
+
+$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
+ $(subst /,\,$(COPY) $< $@)
+
+endif
+
+##########################################################################
+
install: $(APPNAME)
+ifneq ($(OPATH),$(INSTALLDIR))
$(COPY) $(APPNAME) ${INSTALLDIR}
+endif
+ mkdir $(INSTALLDIR)\dat 2>nul || echo "" >nul
+ copy dat\*.des $(INSTALLDIR)\dat
clean:
- $(DELETE) *.o
+ $(DELETE) $(OPATH)\*.o
+ $(subst /,\,$(DELETE) $(UTIL)*.o)
+ $(subst /,\,$(DELETE) $(UTIL)*.exe)
+ $(subst /,\,$(DELETE) $(UTIL)*.lex.cc)
+ $(subst /,\,$(DELETE) $(UTIL)*.tab.cc)
+ $(subst /,\,$(DELETE) $(UTIL)*.tab.h)
+ $(subst /,\,$(DELETE) $(UTIL)*.tab.c)
+ $(subst /,\,$(DELETE) *.ixx)
distclean:
- $(DELETE) *.o
+ $(DELETE) $(OPATH)\*.o
+ $(DELETE) *.o
$(DELETE) bones.*
+ $(DELETE) $(OPATH)\bones.*
$(DELETE) morgue.txt
+ $(DELETE) $(OPATH)\morgue.txt
$(DELETE) scores
- $(DELETE) $(APPNAME)
+ $(DELETE) $(OPATH)\scores
+ $(DELETE) crawl.exe
+ $(DELETE) $(subst /,\,$(APPNAME))
$(DELETE) *.sav
+ $(DELETE) $(OPATH)\*.sav
$(DELETE) core
+ $(DELETE) $(OPATH)\core
$(DELETE) *.0*
+ $(DELETE) $(OPATH)\*.0*
$(DELETE) *.lab
+ $(DELETE) $(OPATH)\*.lab
-$(APPNAME): $(OBJECTS) libw32c.o
- ${CXX} ${LDFLAGS} $(INCLUDES) $(CFLAGS) $(OBJECTS) libw32c.o -o $(APPNAME) $(LIB)
+$(APPNAME): $(GAME_DEPENDS)
+ ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
strip $(APPNAME)
-debug: $(OBJECTS)
- ${CXX} ${LDFLAGS} $(INCLUDES) $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
+debug: $(GAME_DEPENDS)
+ ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
+
+profile: $(GAME_DEPENDS)
+ ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-profile: $(OBJECTS)
- ${CXX} -g -p ${LDFLAGS} $(INCLUDES) $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
+$(OPATH)/%.o: %.cc
+ ${CXX} ${CFLAGS} -o $@ -c $<
-.cc.o:
- ${CXX} ${CFLAGS} -c $< ${INCLUDE}
+$(OPATH)/%.o: $(UTIL)%.cc
+ $(CXX) $(YCFLAGS) -o $@ -c $<