aboutsummaryrefslogtreecommitdiff
path: root/Makefile.common
blob: 96be52df31f2dde2a53d3fb1e0b01e7cf6725b45 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# $Header$
# This file is used by Makefile and Makefile.mingw and declares common build rules,
# a list of common object files etc.

######################################################################
# The defaul build target: just build the scummvm executable
######################################################################
all: scummvm$(EXEEXT)


######################################################################
# Various minor settings
######################################################################

# Files that are to be included in the archive built by "make dist"
DISTFILES := \
	Makefile Makefile.common Makefile.mingw \
	NEWS README COPYING scummvm.6 Info.plist \
	scumm.dsp  scummvm.dsp scummvm.dsw scummvm.icns scummvm.ico \
	scummvm.proj scummvm.rc scummvm.spec scummvm.xpm simon.dsp sky.dsp \
	scummvm.vcproj scumm.vcproj simon.vcproj sky.vcproj scummvm.sln

# The dist file name
ZIPFILE := scummvm-`date '+%Y-%m-%d'`.zip

# The name for the directory used for depenency tracking
DEPDIR := .deps


######################################################################
# Plugin settings
######################################################################

# For now we only support "static" plugins
STATIC_PLUGINS := 1

# Plugin prefix. Typically "lib" on Unix, and nothing everywhere else
PLUGIN_PREFIX := lib
# Plugin suffix. For static/shared libs this is typically ".so"/".a" on Unix,
# ".dll"/".lib" on Windows, ".bundle"/".a" on OS X, etc.
PLUGIN_SUFFIX := .a


######################################################################
# Module settings
######################################################################

ifdef DISABLE_SCUMM
DEFINES += -DDISABLE_SCUMM
else
MODULES += scumm scumm/smush
endif

ifdef DISABLE_SIMON
DEFINES += -DDISABLE_SIMON
else
MODULES += simon
endif

ifdef DISABLE_SKY
DEFINES += -DDISABLE_SKY
else
MODULES += sky sky/compacts sky/music
endif

ifdef DISABLE_SWORD2
DEFINES += -DDISABLE_SWORD2
else
MODULES += bs2 bs2/driver
endif

# After the game specific modules follow the shared modules
MODULES += \
	gui \
	backends \
	backends/fs/posix \
	backends/fs/morphos \
	backends/fs/windows \
	backends/midi \
	sound \
	common


######################################################################
# The build rules follow - normally you should have no need to
# touch whatever comes after here.
######################################################################

# Concat DEFINES and INCLUDES to form the CPPFLAGS
CPPFLAGS:= $(DEFINES) $(INCLUDES)

# Include the build instructions for all modules
-include $(addsuffix /module.mk,$(MODULES))

# Make engine.o depend on all other object files. This way if anything is
# changed, it causes engine.cpp to be recompiled. This in turn ensures that
# the build date in gScummVMBuildDate is correct.
common/main.o: $(OBJS)

# HACK temporary fix to get compilation on OS X (and possibly others) working again
OBJS:=common/main.o common/gameDetector.o $(OBJS)

scummvm$(EXEEXT):  $(OBJS)
	$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)

clean:
	$(RM) $(OBJS) scummvm$(EXEEXT)

.PHONY: all clean dist distclean

DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULES))
DEPFILES = $(wildcard $(addsuffix /*.d,$(DEPDIRS)))

# Old (dumb) compile & dependcy rules
#INCS	= scumm/scumm.h common/scummsys.h common/stdafx.h
#.cpp.o:
#	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
#$(OBJS): $(INCS)

ifndef HAVE_GCC3
# If you use GCC, disable the above and enable this for intelligent
# dependency tracking. 
.cpp.o:
	$(MKDIR) $(*D)/$(DEPDIR)
	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
	$(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
	$(CAT) "$(*D)/$(DEPDIR)/$(*F).d2" >> "$(*D)/$(DEPDIR)/$(*F).d"
	$(RM) "$(*D)/$(DEPDIR)/$(*F).d2"
else
# If you even have GCC 3.x, you can use this build rule, which is safer; the above
# rule can get you into a bad state if you Ctrl-C at the wrong moment.
# Also, with this GCC inserts additional dummy rules for the involved headers,
# which ensures a smooth compilation even if said headers become obsolete.
.cpp.o:
	$(MKDIR) $(*D)/$(DEPDIR)
	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
endif
-include $(DEPFILES) /dev/null

distclean: clean
	$(RM_REC) $(DEPDIRS)
	$(RM) build.rules config.h config.mak config.log