Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 39 additions & 89 deletions crawl-ref/source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
# Typical parameters:
# TILES -- set to anything to enable tiles build
#
# SOUND -- set to anything to enable sound
# SOUND -- set to anything to enable sound; note that you will need to
# uncomment some lines in sound.h if not building tiles
#
# CROSSHOST -- target system, eg, i386-pc-msdosdjgpp or i586-mingw32msvc
#
Expand Down Expand Up @@ -104,7 +105,7 @@ include Makefile.obj
#

# Which C++ standard to support
STDFLAG = -std=c++0x
STDFLAG = -std=c++11

CFOTHERS := -pipe $(EXTERNAL_FLAGS)
CFWARN :=
Expand Down Expand Up @@ -132,7 +133,7 @@ CHMOD = chmod 2>/dev/null
CHOWN = chown 2>/dev/null
PNGCRUSH = $(COPY)
PNGCRUSH_LABEL = COPY
ADVPNG = advpng -z -4
ADVPNG = advpng -z -2
PKGCONFIG = pkg-config
DOXYGEN = doxygen
DOXYGEN_SIMPLE_CONF = crawl_simple.doxy
Expand Down Expand Up @@ -227,7 +228,7 @@ ifeq ($(uname_S),Darwin)
BUILD_SQLITE = YesPlease
BUILD_ZLIB = YesPlease
ifdef TILES
EXTRA_LIBS += -framework AppKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon -framework IOKit -framework OpenGL contrib/install/$(ARCH)/lib/libSDL2main.a
EXTRA_LIBS += -framework AppKit -framework AudioUnit -framework CoreAudio -framework ForceFeedback -framework Carbon -framework IOKit -framework OpenGL -framework AudioToolbox -framework CoreVideo contrib/install/$(ARCH)/lib/libSDL2main.a
BUILD_FREETYPE = YesPlease
BUILD_SDL2 = YesPlease
BUILD_SDL2IMAGE = YesPlease
Expand Down Expand Up @@ -285,7 +286,13 @@ endif
LIBZ := contrib/install/$(ARCH)/lib/libz.a

ifndef CROSSHOST
SQLITE_INCLUDE_DIR := /usr/include
# FreeBSD keeps all of its userland includes in /usr/local so
# look there
ifeq ($(uname_S),FreeBSD)
SQLITE_INCLUDE_DIR := /usr/local/include
else
SQLITE_INCLUDE_DIR := /usr/include
endif
else
# This is totally wrong, works only with some old-style setups, and
# on some architectures of Debian/new FHS multiarch -- excluding, for
Expand Down Expand Up @@ -323,10 +330,10 @@ endif
#
# Check for an Apple-released compiler.
#
ifndef NO_APPLE_GCC
ifndef NO_APPLE_PLATFORM
ifeq ($(uname_S),Darwin)
ifneq ($(shell gcc -v 2>&1 | grep Apple),)
APPLE_GCC = YesPlease
APPLE_PLATFORM = YesPlease
endif
endif
endif
Expand Down Expand Up @@ -370,9 +377,6 @@ MCHMOD_LOGS := 664
INSTALL_UGRP := games:games
endif

chroot_prefix :=
prefix :=

ifeq ($(patsubst %/local,%,$(patsubst %/,%,$(prefix))),/usr)
FHS := yes
endif
Expand Down Expand Up @@ -405,87 +409,22 @@ endif

INCLUDES_L += -Iutil -I.

ifdef APPLE_GCC

MARCH := $(uname_M)


ifndef NO_AUTO_SDK

# The SDK locations were moved in 10.8; this snippet tries to find them
# there first, then reverts to the original location.
XCODE_SDK_SUFFIX := Platforms/MacOSX.platform/Developer
# Try to use xcode-select -p to find the current user-configured Xcode.app.
XCODE_SELECT_PATH := $(shell xcode-select -p 2>/dev/null | sed 's/\/$$//')
ifeq ($(shell test -e "$(XCODE_SELECT_PATH)/$(XCODE_SDK_SUFFIX)" || echo NOPE),)
DEVELOPER_PATH := $(XCODE_SELECT_PATH)/$(XCODE_SDK_SUFFIX)
else
# Otherwise, try /Applications/Xcode.app.
XCODE_DEFAULT_PATH := /Applications/Xcode.app/Contents/Developer
ifeq ($(shell test -e "$(XCODE_DEFAULT_PATH)/$(XCODE_SDK_SUFFIX)" || echo NOPE),)
DEVELOPER_PATH := $(XCODE_DEFAULT_PATH)/$(XCODE_SDK_SUFFIX)
else
# If all else fails, maybe it's in /Developer.
DEVELOPER_PATH := /Developer
endif
endif

# Find the oldest SDK available, in attempt to make this build as
# backward-compatible as we possibly can.
SDK_VER := $(shell command ls $(DEVELOPER_PATH)/SDKs | grep -v "MacOSX.sdk" | sort -n | head -1 | perl -pe 's/^MacOSX//g;s/.sdk$$//g')

ifeq ($(SDK_VER),10.4u)
SDK_VER := 10.4
endif

ifndef SDK_VER
$(error You do not seem to have any Mac OS X SDKs installed! This build is doomed to fail)
endif

endif

ifndef SDK_VER
ifeq ($(MARCH),ppc)
SDK_VER := 10.4
endif
ifeq ($(MARCH),i386)
SDK_VER := 10.4
endif
ifeq ($(MARCH),x86_64)
ifdef TILES
SDK_VER := 10.6
else
SDK_VER := 10.5
endif
endif
endif

# Mac OS X 10.4 adds a 'u' on the end of the SDK name. Everything
# else is much easier to predict the name of.
ifeq ($(SDK_VER),10.4)
GCC_VER := 4.0
SDKROOT := $(DEVELOPER_PATH)/SDKs/MacOSX$(SDK_VER)u.sdk
else
SDKROOT := $(DEVELOPER_PATH)/SDKs/MacOSX$(SDK_VER).sdk
endif

ifneq ($(shell test -d $(SDKROOT) || echo NOPE),)
$(error The Mac OS X $(SDK_VER) SDK seems missing)
endif
ifdef APPLE_PLATFORM

ifdef BUILD_UNIVERSAL
# [ds] 10.4 SDK g++-4.0 + x86_64 runs into SDL compile issues.
CFLAGS_ARCH := -arch i386 -arch ppc -faltivec
CFLAGS_DEPCC_ARCH := -arch i386
NO_INLINE_DEPGEN := YesPlease
else
CFLAGS_ARCH := -arch $(MARCH)
CFLAGS_ARCH := -arch $(uname_M)
endif

CC = $(GCC) $(CFLAGS_ARCH) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER)
CXX = $(GXX) $(CFLAGS_ARCH) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER)
DEPCC = $(GCC) $(or $(CFLAGS_DEPCC_ARCH),$(CFLAGS_ARCH)) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER)
DEPCXX = $(GXX) $(or $(CFLAGS_DEPCC_ARCH),$(CFLAGS_ARCH)) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER)
MACOSX_MIN_VERSION=10.7
CC = $(GCC) $(CFLAGS_ARCH) -mmacosx-version-min=$(MACOSX_MIN_VERSION)
CXX = $(GXX) $(CFLAGS_ARCH) -stdlib=libc++ -mmacosx-version-min=$(MACOSX_MIN_VERSION)
DEPCC = $(GCC) $(or $(CFLAGS_DEPCC_ARCH),$(CFLAGS_ARCH)) -mmacosx-version-min=$(MACOSX_MIN_VERSION)
DEPCXX = $(GXX) $(or $(CFLAGS_DEPCC_ARCH),$(CFLAGS_ARCH)) -stdlib=libc++ -mmacosx-version-min=$(MACOSX_MIN_VERSION)

ifdef USE_ICC
CC += -gcc-name=gcc-$(GCC_VER) -gxx-name=g++-$(GCC_VER)
Expand Down Expand Up @@ -760,10 +699,10 @@ endif # pkg-config

ifndef GLES
ifneq ($(uname_S),Darwin)
ifeq (,$(findstring MINGW,$(uname_S)))
LIBS += -lGL -lGLU
else
ifeq ($(msys),Yes)
LIBS += -lopengl32 -lglu32
else
LIBS += -lGL -lGLU
endif
endif
endif
Expand All @@ -782,6 +721,9 @@ CFWARN_L += $(shell w=-Wno-array-bounds;echo|$(GXX) -E -x c++ - -Werror $$w >/de
CFWARN_L += $(shell w=-Wno-format-zero-length;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w)
CFWARN_L += $(shell w=-Wmissing-declarations;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w)
CFWARN_L += $(shell w=-Wredundant-decls;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w)
# Avoid warnings about safety checks that might be necessary on other compilers
# where the same enum is assigned a signed underlying type.
CFWARN_L += $(shell w=-Wno-tautological-unsigned-enum-zero-compare;echo|$(GXX) -E -x c++ - -Werror $$w >/dev/null 2>&1 && echo $$w)

CFWARN_L += -Wno-parentheses -Wwrite-strings -Wshadow -pedantic
CFOTHERS_L = $(EXTERNAL_FLAGS_L) $(EXTRA_FLAGS) $(DEFINES) $(SDL2_CFLAGS)
Expand Down Expand Up @@ -1079,7 +1021,7 @@ ifeq ($(strip $(YACC)),)
NO_YACC = YesPlease
endif

ifneq ($(findstring $(MAKEFLAGS),s),s)
ifneq ($(findstring s,$(MAKEFLAGS)),s)
ifndef V
QUIET_CC = @echo ' ' CC $@;
QUIET_CXX = @echo ' ' CXX $@;
Expand Down Expand Up @@ -1203,6 +1145,10 @@ MAJOR_VERSION = $(shell echo "$(SRC_VERSION)"|sed -r 's/-.*//;s/^([^.]+\.[^.]+).

export SRC_VERSION

# Update .ver file if SRC_VERSION has changed
.ver: FORCE
@echo '$(SRC_VERSION)' | cmp -s - $@ || echo '$(SRC_VERSION)' > $@

PKG_SRC_DIR := $(SRC_PKG_BASE)-$(SRC_VERSION)
SRC_PKG_TAR := $(PKG_SRC_DIR).tar.xz
SRC_PKG_TAR_NODEPS := $(PKG_SRC_DIR)-nodeps.tar.xz
Expand Down Expand Up @@ -1333,7 +1279,7 @@ endif
compflag.h: $(OBJECTS:.o=.cc) main.cc util/gen-cflg.pl .cflags
$(QUIET_GEN)util/gen-cflg.pl compflag.h "$(ALL_CFLAGS)" "$(LDFLAGS)" "$(HOST)" "$(ARCH)"

build.h: $(OBJECTS:.o=.cc) main.cc util/gen_ver.pl
build.h: $(OBJECTS:.o=.cc) main.cc util/gen_ver.pl .ver
$(QUIET_GEN)util/gen_ver.pl $@ $(MERGE_BASE)

version.o: build.h compflag.h
Expand All @@ -1345,6 +1291,10 @@ $(DOC_BASE)/aptitudes.txt: $(DOC_TEMPLATES)/apt-tmpl.txt species-data.h aptitude
util/gen-apt.pl
$(QUIET_GEN)./util/gen-apt.pl $@ $^

$(DOC_BASE)/aptitudes-wide.txt: $(DOC_TEMPLATES)/apt-tmpl-wide.txt species-data.h \
aptitudes.h util/gen-apt.pl
$(QUIET_GEN)./util/gen-apt.pl $@ $^

$(DOC_BASE)/FAQ.html: dat/database/FAQ.txt util/FAQ2html.pl
$(QUIET_GEN)./util/FAQ2html.pl $< $@

Expand Down Expand Up @@ -1429,7 +1379,7 @@ endif
$(COPY_R) dat/dlua/* $(datadir_fp)/dat/dlua/
echo "-- Autogenerated list of maps to load and compile:" \
>$(datadir_fp)/dat/dlua/loadmaps.lua
find dat -name '*.des'|sed s:dat/::| \
find dat -name '*.des'|LC_ALL=C sort|sed s:dat/::| \
while read x; \
do echo "dgn.load_des_file('$$x')"; \
done >>$(datadir_fp)/dat/dlua/loadmaps.lua
Expand All @@ -1445,7 +1395,7 @@ endif
$(COPY) ../docs/develop/levels/*.txt $(datadir_fp)/docs/develop/levels/
$(COPY) ../docs/license/*.txt $(datadir_fp)/docs/license/
$(COPY) ../CREDITS.txt $(datadir_fp)/docs/
$(COPY) ../settings/* $(datadir_fp)/settings/
$(COPY_R) ../settings/* $(datadir_fp)/settings/
ifeq ($(GAME),crawl.exe)
sed -i 's/$$/\r/' `find $(datadir_fp) -iname '*.txt' -o -iname '*.des'`
endif
Expand Down
6 changes: 3 additions & 3 deletions crawl-ref/source/acquire.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ static skill_type _acquirement_weapon_skill(bool divine)
{
// reservoir sample.
int count = 0;
skill_type skill = SK_FIGHTING;
skill_type skill = SK_UNARMED_COMBAT;
for (skill_type sk = SK_FIRST_WEAPON; sk <= SK_LAST_WEAPON; ++sk)
{
// Adding a small constant allows for the occasional
Expand Down Expand Up @@ -554,7 +554,7 @@ static int _acquirement_staff_subtype(bool /*divine*/, int & /*quantity*/)
*/
static int _acquirement_misc_subtype(bool /*divine*/, int & /*quantity*/)
{
// Give a crystal ball based on both evocations and either best spell
// Give a crystal ball based on both evocations and either best spell
// school or invocations if we haven't seen one.
const skill_type best_spell_skill = best_magic_skill();
int skills = _skill_rdiv(SK_EVOCATIONS)
Expand Down Expand Up @@ -908,7 +908,7 @@ static bool _do_book_acquirement(item_def &book, int agent)
break;
}
} // switch book choice

// If we couldn't make a useful book, try to make a manual instead.
// We have to temporarily identify the book for this.
int oldflags = book.flags;
Expand Down
Loading