aboutsummaryrefslogtreecommitdiff
path: root/Makefile.common
blob: 0ef447dcd2396d6a4bf54884f022632f88d838fe (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
# $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)

# 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

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

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

# List of all sub modules (note: order is important, don't mess with it)
# TODO - the nested ones (scumm/smush, backends/...) should be handled from the
# module.mk of their parents. In fact the only reason they are listed here is to ensure the
# DEPDIRS directive works correctly.
MODULES += \
	scumm \
	simon \
	sky \
	common \
	gui \
	backends \
	sound \
	scumm/smush \
	backends/fs/posix \
	backends/fs/morphos \
	backends/fs/windows \
	backends/midi

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

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

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

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

.PHONY: all clean dist distclean

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


# If you use GCC, disable the above and enable this for intelligent
# dependency tracking. 
DEPDIRS = $(patsubst %,%/$(DEPDIR),$(MODULES))
DEPFILES = $(wildcard $(patsubst %,%/*.d,$(DEPDIRS)))

.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"

# 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 it in the wrong moment.
#.cpp.o:
#	$(MKDIR) $(*D)/$(DEPDIR)
#	$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o

-include $(DEPFILES) /dev/null

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