Makefile.common 6.25 KB
Newer Older
RobLoach's avatar
RobLoach committed
1
# ChaiLove
RobLoach's avatar
RobLoach committed
2
3
SOURCES_CXX += $(wildcard \
	src/*.cpp \
RobLoach's avatar
RobLoach committed
4
5
6
7
8
9
	src/Modules/*.cpp \
	src/Types/*.cpp \
	src/Types/Audio/*.cpp \
	src/Types/Graphics/*.cpp \
	src/Types/Input/*.cpp \
	src/Types/System/*.cpp \
RobLoach's avatar
RobLoach committed
10
11
12
	test/*.cpp \
)

RobLoach's avatar
RobLoach committed
13
14
15
16
17
18
# filesystem
FLAGS += -Ivendor/filesystem

# libretro-common
FLAGS += -Ivendor/libretro-common/include

19
20
21
22
23
24
25
26
27
28
29
30
31
32
# zlib
SOURCES_C += \
	vendor/zlib/crc32.c \
	vendor/zlib/deflate.c \
	vendor/zlib/trees.c \
	vendor/zlib/inftrees.c \
	vendor/zlib/adler32.c \
	vendor/zlib/zutil.c \
	vendor/zlib/inflate.c \
	vendor/zlib/infback.c \
	vendor/zlib/inffast.c
FLAGS += -Ivendor/zlib
FLAGS += -DWANT_ZLIB

RobLoach's avatar
RobLoach committed
33
# PhysFS
RobLoach's avatar
RobLoach committed
34
35
36
FLAGS += -Ivendor/physfs/src
FLAGS += -Ivendor/physfs/extras
FLAGS += -DPHYSFS_NO_CDROM_SUPPORT=1
RobLoach's avatar
RobLoach committed
37
38
39
40
SOURCES_C += $(wildcard \
	vendor/physfs/extras/physfsrwops.c \
	vendor/physfs/src/*.c \
)
RobLoach's avatar
RobLoach committed
41
42
43
ifeq ($(platform), osx)
	FLAGS += -DPHYSFS_PLATFORM_MACOSX
endif
RobLoach's avatar
RobLoach committed
44
45

# SDL_tty
RobLoach's avatar
RobLoach committed
46
FLAGS += -Ivendor/SDL_tty/include
RobLoach's avatar
RobLoach committed
47
48
49
50
51
52
SOURCES_C += $(wildcard \
	vendor/SDL_tty/src/SDL_tty.c \
	vendor/SDL_tty/src/SDL_fnt.c \
)

# SDL_gfx
RobLoach's avatar
RobLoach committed
53
FLAGS += -Ivendor/sdl-libretro/tests/SDL_gfx-2.0.26
RobLoach's avatar
RobLoach committed
54
55
56
57
SOURCES_C += $(wildcard \
	vendor/sdl-libretro/tests/SDL_gfx-2.0.26/*.c \
)

RobLoach's avatar
RobLoach committed
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
# FreeType
# See https://github.com/emscripten-ports/FreeType/blob/master/builds/amiga/makefile
FLAGS += -Ivendor/libretro-deps/freetype/include
FLAGS += -DFT2_BUILD_LIBRARY \
	-DFT_USE_AUTOFIT \
	-DFT_USE_RASTER \
	-DFT_USE_SMOOTH \
	-DFT_USE_TT \
	-DFT_USE_T1 \
	-DFT_USE_T42 \
	-DFT_USE_T1CID \
	-DFT_USE_CFF \
	-DFT_USE_OTV \
	-DFT_USE_GXV

SOURCES_C += \
	vendor/libretro-deps/freetype/src/base/ftbase.c \
	vendor/libretro-deps/freetype/src/base/ftinit.c \
	vendor/libretro-deps/freetype/src/base/ftsystem.c \
	vendor/libretro-deps/freetype/src/base/ftdebug.c \
	vendor/libretro-deps/freetype/src/base/ftbbox.c \
	vendor/libretro-deps/freetype/src/base/ftbdf.c \
	vendor/libretro-deps/freetype/src/base/ftstroke.c \
	vendor/libretro-deps/freetype/src/base/ftbitmap.c \
	vendor/libretro-deps/freetype/src/base/ftcid.c \
	vendor/libretro-deps/freetype/src/base/ftfntfmt.c \
	vendor/libretro-deps/freetype/src/base/ftfstype.c \
	vendor/libretro-deps/freetype/src/base/ftgasp.c \
	vendor/libretro-deps/freetype/src/base/ftglyph.c \
	vendor/libretro-deps/freetype/src/base/ftgxval.c \
	vendor/libretro-deps/freetype/src/base/ftlcdfil.c \
	vendor/libretro-deps/freetype/src/base/ftmm.c \
	vendor/libretro-deps/freetype/src/base/ftotval.c \
	vendor/libretro-deps/freetype/src/base/ftpatent.c \
	vendor/libretro-deps/freetype/src/base/ftpfr.c \
	vendor/libretro-deps/freetype/src/base/ftsynth.c \
	vendor/libretro-deps/freetype/src/base/fttype1.c \
	vendor/libretro-deps/freetype/src/base/ftwinfnt.c \
	vendor/libretro-deps/freetype/src/autofit/autofit.c \
	vendor/libretro-deps/freetype/src/pshinter/pshinter.c \
	vendor/libretro-deps/freetype/src/psaux/psaux.c \
	vendor/libretro-deps/freetype/src/psnames/psnames.c \
	vendor/libretro-deps/freetype/src/raster/raster.c \
	vendor/libretro-deps/freetype/src/smooth/smooth.c \
	vendor/libretro-deps/freetype/src/cache/ftcache.c \
	vendor/libretro-deps/freetype/src/bdf/bdf.c \
	vendor/libretro-deps/freetype/src/cff/cff.c \
	vendor/libretro-deps/freetype/src/pcf/pcf.c \
	vendor/libretro-deps/freetype/src/winfonts/winfnt.c \
	vendor/libretro-deps/freetype/src/sfnt/sfnt.c \
	vendor/libretro-deps/freetype/src/pfr/pfr.c \
	vendor/libretro-deps/freetype/src/truetype/truetype.c \
	vendor/libretro-deps/freetype/src/type1/type1.c \
	vendor/libretro-deps/freetype/src/type42/type42.c \
	vendor/libretro-deps/freetype/src/cid/type1cid.c \
	vendor/libretro-deps/freetype/src/gzip/ftgzip.c \
	vendor/libretro-deps/freetype/src/bzip2/ftbzip2.c \
	vendor/libretro-deps/freetype/src/lzw/ftlzw.c

RobLoach's avatar
RobLoach committed
117
# SDL_ttf
RobLoach's avatar
RobLoach committed
118
119
FLAGS += -Ivendor/sdl-libretro/tests/SDL_ttf-2.0.11/VisualC/external/include
SOURCES_C += vendor/sdl-libretro/tests/SDL_ttf-2.0.11/SDL_ttf.c
RobLoach's avatar
RobLoach committed
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

# SDL_stbimage
FLAGS += -Ivendor/Snippets

# STB
FLAGS += -Ivendor/stb

# ChaiScript
ifeq ($(HAVE_CHAISCRIPT),)
	FLAGS += -Ivendor/chaiscript/include
	FLAGS += -Ivendor/RobLoachChaiScript_Extras/include
	FLAGS += -D__HAVE_CHAISCRIPT__
	FLAGS += -DCHAISCRIPT_NO_THREADS -DCHAISCRIPT_NO_THREADS_WARNING -DCHAISCRIPT_NO_DYNLOAD
	FLAGS += -DCHAISCRIPT_EXTRAS_MATH_DISABLE_ISINF -DCHAISCRIPT_EXTRAS_MATH_DISABLE_ISNAN
endif

RobLoach's avatar
RobLoach committed
136
137
# SDL
ifeq ($(platform), win)
RobLoach's avatar
RobLoach committed
138
	SOURCES_C += $(wildcard ./vendor/sdl-libretro/src/*.c  ./vendor/sdl-libretro/src/audio/*.c  ./vendor/sdl-libretro/src/cdrom/dummy/*.c  ./vendor/sdl-libretro/src/cdrom/*.c  ./vendor/sdl-libretro/src/cpuinfo/*.c  ./vendor/sdl-libretro/src/events/*.c  ./vendor/sdl-libretro/src/file/*.c  ./vendor/sdl-libretro/src/stdlib/*.c  ./vendor/sdl-libretro/src/thread/*.c  ./vendor/sdl-libretro/src/timer/*.c  ./vendor/sdl-libretro/src/video/*.c  ./vendor/sdl-libretro/src/joystick/*.c  ./vendor/sdl-libretro/src/video/libretro/*.c  ./vendor/sdl-libretro/src/joystick/libretro/*.c  ./vendor/sdl-libretro/src/timer/libretro/*.c  ./vendor/sdl-libretro/src/audio/libretro/*.c  ./vendor/sdl-libretro/src/thread/win32/SDL_sysmutex.c ./vendor/sdl-libretro/src/thread/win32/SDL_syssem.c ./vendor/sdl-libretro/src/thread/win32/SDL_systhread.c ./vendor/sdl-libretro/src/thread/generic/SDL_syscond.c ./vendor/sdl-libretro/src/loadso/dummy/*.c)
RobLoach's avatar
RobLoach committed
139
else
RobLoach's avatar
RobLoach committed
140
	SOURCES_C += $(wildcard ./vendor/sdl-libretro/src/*.c ./vendor/sdl-libretro/src/audio/*.c  ./vendor/sdl-libretro/src/cdrom/dummy/*.c  ./vendor/sdl-libretro/src/cdrom/*.c  ./vendor/sdl-libretro/src/cpuinfo/*.c  ./vendor/sdl-libretro/src/events/*.c  ./vendor/sdl-libretro/src/file/*.c  ./vendor/sdl-libretro/src/stdlib/*.c  ./vendor/sdl-libretro/src/thread/*.c  ./vendor/sdl-libretro/src/timer/*.c  ./vendor/sdl-libretro/src/video/*.c  ./vendor/sdl-libretro/src/joystick/*.c  ./vendor/sdl-libretro/src/video/libretro/*.c  ./vendor/sdl-libretro/src/thread/generic/*.c ./vendor/sdl-libretro/src/joystick/libretro/*.c  ./vendor/sdl-libretro/src/timer/libretro/*.c  ./vendor/sdl-libretro/src/audio/libretro/*.c  ./vendor/sdl-libretro/src/loadso/dummy/*.c)
RobLoach's avatar
RobLoach committed
141
endif
RobLoach's avatar
RobLoach committed
142
FLAGS += -DSDL_THREADS_DISABLED -DSDL_CDROM_DISABLED
RobLoach's avatar
RobLoach committed
143
144
FLAGS += -Ivendor/sdl-libretro/include

RobLoach's avatar
RobLoach committed
145
OBJECTS += $(SOURCES_CXX:.cpp=.o) $(SOURCES_C:.c=.o)
RobLoach's avatar
RobLoach committed
146
147
148
149
150
151
152
153
154
155

# Build all the dependencies, and the core.
all: | dependencies	$(TARGET)

ifeq ($(DEBUG), 0)
   FLAGS += -O3 -ffast-math -fomit-frame-pointer
else
   FLAGS += -O0 -g
endif

RobLoach's avatar
RobLoach committed
156
LDFLAGS +=  $(fpic) $(SHARED) $(EXTRA_LDF)
RobLoach's avatar
RobLoach committed
157
158
159
160
161
162

WARNINGS :=

ifneq ($(HAVE_TESTS),)
	FLAGS += -D__HAVE_TESTS__
endif