1 | # GNU Make 3.80 and older have bugs that cause parsing issues.
|
---|
2 | # Make sure we have at least version 3.81.
|
---|
3 | ifndef .FEATURES
|
---|
4 | $(error GNU Make 3.81 or higher is required)
|
---|
5 | endif
|
---|
6 |
|
---|
7 | #######################################################################
|
---|
8 | # Default compilation parameters. Normally don't edit these #
|
---|
9 | #######################################################################
|
---|
10 |
|
---|
11 | srcdir ?= .
|
---|
12 |
|
---|
13 | DEFINES := -DHAVE_CONFIG_H
|
---|
14 | LDFLAGS :=
|
---|
15 | INCLUDES := -I. -I$(srcdir) -I$(srcdir)/engines
|
---|
16 | LIBS :=
|
---|
17 | OBJS :=
|
---|
18 | DEPDIR := .deps
|
---|
19 |
|
---|
20 | MODULES :=
|
---|
21 | MODULE_DIRS :=
|
---|
22 |
|
---|
23 | # All game detection-related object files for engines
|
---|
24 | DETECT_OBJS :=
|
---|
25 | LOAD_RULES_MK := 1
|
---|
26 |
|
---|
27 | # Load the make rules generated by configure
|
---|
28 | -include config.mk
|
---|
29 |
|
---|
30 | ifeq "$(HAVE_GCC)" "1"
|
---|
31 | CXXFLAGS:= -Wall $(CXXFLAGS)
|
---|
32 | # Turn off some annoying and not-so-useful warnings
|
---|
33 | CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
|
---|
34 | # Enable even more warnings...
|
---|
35 | CXXFLAGS+= -Wpointer-arith -Wcast-qual
|
---|
36 | CXXFLAGS+= -Wshadow -Wnon-virtual-dtor -Wwrite-strings
|
---|
37 |
|
---|
38 | # Currently we disable this gcc flag, since it will also warn in cases,
|
---|
39 | # where using GCC_PRINTF (means: __attribute__((format(printf, x, y))))
|
---|
40 | # is not possible, thus it would fail compiliation with -Werror without
|
---|
41 | # being helpful.
|
---|
42 | #CXXFLAGS+= -Wmissing-format-attribute
|
---|
43 |
|
---|
44 | # Disable exceptions.
|
---|
45 | CXXFLAGS+= -fno-exceptions
|
---|
46 |
|
---|
47 | ifneq "$(HAVE_CLANG)" "1"
|
---|
48 | # enable checking of pointers returned by "new", but only when we do not
|
---|
49 | # build with clang
|
---|
50 | CXXFLAGS+= -fcheck-new
|
---|
51 | endif
|
---|
52 | endif
|
---|
53 |
|
---|
54 | ifeq "$(HAVE_CLANG)" "1"
|
---|
55 | CXXFLAGS+= -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants
|
---|
56 | # We use a anonymous nested type declaration in an anonymous union in
|
---|
57 | # common/str.h. This is no standard construct and clang warns about it.
|
---|
58 | # It works for all our target systems though, thus we simply disable that
|
---|
59 | # warning.
|
---|
60 | CXXFLAGS+= -Wno-nested-anon-types
|
---|
61 | endif
|
---|
62 |
|
---|
63 | ifeq "$(HAVE_ICC)" "1"
|
---|
64 | # Disable some warnings:
|
---|
65 | # 161: unrecognized #pragma
|
---|
66 | # 1899: multicharacter character literal (potential portability problem)
|
---|
67 | CXXFLAGS+= -diag-disable 161,1899
|
---|
68 | endif
|
---|
69 |
|
---|
70 | #######################################################################
|
---|
71 | # Default commands - put the necessary replacements in config.mk #
|
---|
72 | #######################################################################
|
---|
73 |
|
---|
74 | CAT ?= cat
|
---|
75 | CP ?= cp
|
---|
76 | ECHO ?= printf
|
---|
77 | INSTALL ?= install
|
---|
78 | MKDIR ?= mkdir -p
|
---|
79 | RM ?= rm -f
|
---|
80 | RM_REC ?= $(RM) -r
|
---|
81 | ZIP ?= zip -q
|
---|
82 |
|
---|
83 | ifeq ($(VERBOSE_BUILD),1)
|
---|
84 | LS := ls -l
|
---|
85 | else
|
---|
86 | LS := true
|
---|
87 | endif
|
---|
88 |
|
---|
89 | #######################################################################
|
---|
90 | # Misc stuff - you should never have to edit this #
|
---|
91 | #######################################################################
|
---|
92 |
|
---|
93 | EXECUTABLE := $(EXEPRE)scummvm$(EXEEXT)
|
---|
94 |
|
---|
95 | include $(srcdir)/Makefile.common
|
---|
96 |
|
---|
97 | ENGINE_SUBDIRS_CONFIGURE := $(wildcard $(srcdir)/engines/*/configure.engine)
|
---|
98 |
|
---|
99 | config.h:
|
---|
100 | SAVED_ENV_VARS = AR AS ASFLAGS CPPFLAGS CXX CXXFLAGS LD LDFLAGS RANLIB SDL_CONFIG STRIP WINDRES WINDRESFLAGS
|
---|
101 |
|
---|
102 | # The environment variable PKG_CONFIG_LIBDIR has a different meaning
|
---|
103 | # for pkg-config when it is empty and when it is not defined.
|
---|
104 | # When PKG_CONFIG_LIBDIR is defined but empty, the .pc files cannot
|
---|
105 | # be found because the search path is empty.
|
---|
106 | # Here we make sure not to define PKG_CONFIG_LIBDIR when automatically
|
---|
107 | # running configure and it was not set for the previous run
|
---|
108 | # so pkg-config uses the system default search path for the .pc files.
|
---|
109 | ifneq ($(SAVED_PKG_CONFIG_LIBDIR),unset)
|
---|
110 | SAVED_ENV_VARS += PKG_CONFIG_LIBDIR
|
---|
111 | endif
|
---|
112 |
|
---|
113 | # check if configure has been run or has been changed since last run
|
---|
114 | configure.stamp: $(srcdir)/configure $(srcdir)/engines.awk $(ENGINE_SUBDIRS_CONFIGURE)
|
---|
115 | ifeq "$(findstring config.mk,$(MAKEFILE_LIST))" "config.mk"
|
---|
116 | @echo "Running $(srcdir)/configure with the last specified parameters"
|
---|
117 | @sleep 2
|
---|
118 |
|
---|
119 | $(foreach VAR,$(SAVED_ENV_VARS),$(VAR)="$(SAVED_$(VAR))") \
|
---|
120 | $(srcdir)/configure $(SAVED_CONFIGFLAGS)
|
---|
121 | else
|
---|
122 | $(error You need to run $(srcdir)/configure before you can run make. Check $(srcdir)/configure --help for a list of parameters)
|
---|
123 | endif
|
---|
124 |
|
---|
125 | config.h config.mk engines/plugins_table.h engines/detection_table.h engines/engines.mk: configure.stamp
|
---|
126 | @if ! test -f $@; then \
|
---|
127 | rm -f configure.stamp; \
|
---|
128 | $(MAKE) configure.stamp; \
|
---|
129 | fi
|
---|
130 |
|
---|
131 | ifneq ($(origin port_mk), undefined)
|
---|
132 | include $(srcdir)/$(port_mk)
|
---|
133 | endif
|
---|
134 |
|
---|
135 | .PHONY: print-dists print-executables print-version print-distversion
|
---|
136 | print-dists:
|
---|
137 | @echo $(DIST_FILES_DOCS) $(DIST_FILES_THEMES) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_PLATFORM) $(srcdir)/doc
|
---|
138 |
|
---|
139 | print-executables:
|
---|
140 | @echo $(if $(DIST_EXECUTABLES),$(DIST_EXECUTABLES),$(EXECUTABLE) $(PLUGINS))
|
---|
141 |
|
---|
142 | print-version:
|
---|
143 | @echo $(VERSION)
|
---|
144 |
|
---|
145 | print-distversion:
|
---|
146 | @echo $(DISTVERSION)
|
---|
147 |
|
---|
148 | devtools/create_project/cmake/build/create_project:
|
---|
149 | cmake -Hdevtools/create_project/cmake -Bdevtools/create_project/cmake/build/
|
---|
150 | cmake --build devtools/create_project/cmake/build/
|
---|
151 |
|
---|
152 | CMakeLists.txt: devtools/create_project/cmake/build/create_project config.mk
|
---|
153 | ./devtools/create_project/cmake/build/create_project . --cmake $(SAVED_CONFIGFLAGS)
|
---|
154 |
|
---|
155 | cmake: CMakeLists.txt
|
---|
156 | cmake -H. -Bbuild
|
---|
157 | cmake --build build
|
---|