aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 3e72d86a705bce7a539f3202c3de21780aeb7f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#######################################################################
# Default compilation parameters. Normally don't edit these           #
#######################################################################

srcdir      ?= .

DEFINES     := -DHAVE_CONFIG_H
LDFLAGS     :=
INCLUDES    := -I. -I$(srcdir) -I$(srcdir)/engines
LIBS        :=
OBJS        :=
DEPDIR      := .deps

MODULES     :=
MODULE_DIRS :=

# Load the make rules generated by configure
-include config.mk

ifeq "$(HAVE_GCC)" "1"
	CXXFLAGS:= -Wall $(CXXFLAGS)
	# Turn off some annoying and not-so-useful warnings
	CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
	# Enable even more warnings...
	CXXFLAGS+= -Wpointer-arith -Wcast-qual
	CXXFLAGS+= -Wshadow -Wnon-virtual-dtor -Wwrite-strings

	# Currently we disable this gcc flag, since it will also warn in cases,
	# where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
	# is not possible, thus it would fail compiliation with -Werror without
	# being helpful.
	#CXXFLAGS+= -Wmissing-format-attribute

ifneq "$(BACKEND)" "tizen"
	# Disable exceptions. This setting causes tizen apps to crash
	# TODO: Does this still apply after enabling RTTI again?
	CXXFLAGS+= -fno-exceptions
endif

ifneq "$(HAVE_CLANG)" "1"
	# enable checking of pointers returned by "new", but only when we do not
	# build with clang
	CXXFLAGS+= -fcheck-new
endif
endif

ifeq "$(HAVE_CLANG)" "1"
	CXXFLAGS+= -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants
	# We use a anonymous nested type declaration in an anonymous union in
	# common/str.h. This is no standard construct and clang warns about it.
	# It works for all our target systems though, thus we simply disable that
	# warning.
	CXXFLAGS+= -Wno-nested-anon-types
endif

ifeq "$(HAVE_ICC)" "1"
	# Disable some warnings:
	#  161: unrecognized #pragma
	# 1899: multicharacter character literal (potential portability problem)
	CXXFLAGS+= -diag-disable 161,1899
endif

#######################################################################
# Default commands - put the necessary replacements in config.mk      #
#######################################################################

CAT     ?= cat
CP      ?= cp
ECHO    ?= printf
INSTALL ?= install
MKDIR   ?= mkdir -p
RM      ?= rm -f
RM_REC  ?= $(RM) -r
ZIP     ?= zip -q

#######################################################################
# Misc stuff - you should never have to edit this                     #
#######################################################################

EXECUTABLE  := $(EXEPRE)scummvm$(EXEEXT)

include $(srcdir)/Makefile.common

# check if configure has been run or has been changed since last run
ENGINE_SUBDIRS_CONFIGURE := $(wildcard $(srcdir)/engines/*/configure.engine)
config.h: $(srcdir)/configure $(ENGINE_SUBDIRS_CONFIGURE)
ifeq "$(findstring config.mk,$(MAKEFILE_LIST))" "config.mk"
	@echo "Running $(srcdir)/configure with the last specified parameters"
	@sleep 2
	AR="$(SAVED_AR)" AS="$(SAVED_AS)" ASFLAGS="$(SAVED_ASFLAGS)" \
		CPPFLAGS="$(SAVED_CPPFLAGS)" CXX="$(SAVED_CXX)" \
		CXXFLAGS="$(SAVED_CXXFLAGS)" LD="$(SAVED_LD)" \
		LDFLAGS="$(SAVED_LDFLAGS)" PKG_CONFIG_LIBDIR="$(SAVED_PKG_CONFIG_LIBDIR)" \
		RANLIB="$(SAVED_RANLIB)" SDL_CONFIG="$(SAVED_SDL_CONFIG)" \
		STRIP="$(SAVED_STRIP)" WINDRES="$(SAVED_WINDRES)" \
		WINDRESFLAGS="$(SAVED_WINDRESFLAGS)" \
			$(srcdir)/configure $(SAVED_CONFIGFLAGS)
else
	$(error You need to run $(srcdir)/configure before you can run make. Check $(srcdir)/configure --help for a list of parameters)
endif

config.mk engines/plugins_table.h engines/engines.mk: config.h
	@if test -f $@; then \
		touch $@; \
	else \
		rm -f config.h; \
		$(MAKE) config.h; \
	fi

ifneq ($(origin port_mk), undefined)
include $(srcdir)/$(port_mk)
endif

.PHONY: print-dists print-executables print-version print-distversion
print-dists:
	@echo $(DIST_FILES_DOCS) $(DIST_FILES_THEMES) $(DIST_FILES_NETWORKING) $(DIST_FILES_ENGINEDATA) $(srcdir)/doc

print-executables:
	@echo $(if $(DIST_EXECUTABLES),$(DIST_EXECUTABLES),$(EXECUTABLE) $(PLUGINS))

print-version:
	@echo $(VERSION)

print-distversion:
	@echo $(DISTVERSION)