This repository has been archived by the owner on Nov 2, 2024. It is now read-only.
forked from ElspethThePict/TeamForever-v4-1.3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
164 lines (129 loc) · 3.56 KB
/
Makefile
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
.DEFAULT_GOAL := all
NAME = s1fs2a
SUFFIX =
PKGCONFIG = pkg-config
DEBUG ?= 0
STATIC ?= 1
VERBOSE ?= 0
PROFILE ?= 0
STRIP ?= strip
# -fsigned-char required to prevent hang in LoadStageCollisions
CFLAGS ?= -fsigned-char -std=c++17
# =============================================================================
# Detect default platform if not explicitly specified
# =============================================================================
ifeq ($(OS),Windows_NT)
PLATFORM ?= Windows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
PLATFORM ?= Linux
endif
ifeq ($(UNAME_S),Darwin)
PLATFORM ?= macOS
endif
endif
ifdef EMSCRIPTEN
PLATFORM = Emscripten
endif
PLATFORM ?= Unknown
# =============================================================================
OUTDIR = bin/$(PLATFORM)
OBJDIR = obj/$(PLATFORM)
include Makefile_cfgs/Platforms/$(PLATFORM).cfg
# =============================================================================
ifeq ($(STATIC),1)
PKGCONFIG += --static
endif
ifeq ($(DEBUG),1)
CFLAGS += -g
STRIP = :
else
CFLAGS += -O3
endif
ifeq ($(PROFILE),1)
CFLAGS += -pg -g -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls -fno-default-inline
endif
ifeq ($(VERBOSE),0)
CC := @$(CC)
CXX := @$(CXX)
endif
# =============================================================================
CFLAGS += `$(PKGCONFIG) --cflags sdl2 ogg vorbis theora vorbisfile theoradec`
LIBS += `$(PKGCONFIG) --libs-only-l --libs-only-L sdl2 ogg vorbis theora vorbisfile theoradec`
#CFLAGS += -Wno-strict-aliasing -Wno-narrowing -Wno-write-strings
ifeq ($(STATIC),1)
CFLAGS += -static
endif
INCLUDES += \
-I./RSDKv4/ \
-I./RSDKv4/NativeObjects/ \
-I./dependencies/all/asio/asio/include/ \
-I./dependencies/all/stb-image/ \
-I./dependencies/all/tinyxml2/ \
-I./dependencies/all/theoraplay/
INCLUDES += $(LIBS)
install:
make
install -Dp -m755 bin/Linux/s1fs2a $(prefix)/bin/s1fs2a
# Main Sources
SOURCES = \
RSDKv4/Animation \
RSDKv4/Audio \
RSDKv4/Collision \
RSDKv4/Debug \
RSDKv4/Drawing \
RSDKv4/Ini \
RSDKv4/Input \
RSDKv4/Math \
RSDKv4/ModAPI \
RSDKv4/Networking \
RSDKv4/Object \
RSDKv4/Palette \
RSDKv4/Reader \
RSDKv4/Renderer \
RSDKv4/RetroEngine \
RSDKv4/Scene \
RSDKv4/Scene3D \
RSDKv4/Script \
RSDKv4/Sprite \
RSDKv4/String \
RSDKv4/Text \
RSDKv4/Userdata \
RSDKv4/Video \
RSDKv4/main \
RSDKv4/NativeObjects/All \
dependencies/all/theoraplay/theoraplay \
dependencies/all/tinyxml2/tinyxml2
ifneq ($(FORCE_CASE_INSENSITIVE),)
CXXFLAGS_ALL += -DFORCE_CASE_INSENSITIVE
SOURCES += RSDKv4/fcaseopen
endif
PKGSUFFIX ?= $(SUFFIX)
BINPATH = $(OUTDIR)/$(NAME)$(SUFFIX)
PKGPATH = $(OUTDIR)/$(NAME)$(PKGSUFFIX)
OBJECTS += $(addprefix $(OBJDIR)/, $(addsuffix .o, $(SOURCES)))
$(shell mkdir -p $(OUTDIR))
$(shell mkdir -p $(OBJDIR))
$(OBJDIR)/%.o: %.c
@mkdir -p $(@D)
@echo -n Compiling $<...
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
@echo " Done!"
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(@D)
@echo -n Compiling $<...
$(CXX) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
@echo " Done!"
$(BINPATH): $(OBJDIR) $(OBJECTS)
@echo -n Linking...
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
@echo " Done!"
$(STRIP) $@
ifeq ($(BINPATH),$(PKGPATH))
all: $(BINPATH)
else
all: $(PKGPATH)
endif
clean:
rm -rf $(OBJDIR) && rm -rf $(BINPATH)