-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathMakefile
42 lines (33 loc) · 1.49 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
CFLAGS=-std=c11 -Wall -Werror -Wno-unused-result -fno-common
SOURCE_FILES=src/shared/*.c src/platform/posix/*.c src/game/*.c
DEBUG_FLAGS=-g -DSPACE_SHOOTER_DEBUG
RELEASE_FLAGS=-O3
LINUX_CC=gcc
LINUX_CFLAGS=-DSOGL_MAJOR_VERSION=3 -DSOGL_MINOR_VERSION=3 -D_POSIX_C_SOURCE=199309L -o build/space-shooter
LINUX_SOURCE_FILES=src/platform/linux/*.c
LINUX_LDLIBS=-lX11 -ldl -lGL -lm -lpthread -lasound
WEB_CC=emcc
WEB_CFLAGS=-DSPACE_SHOOTER_OPENGLES -sMAX_WEBGL_VERSION=2 -sMIN_WEBGL_VERSION=2 --preload-file "./assets" -sINITIAL_MEMORY=59179008
WEB_DEBUG_FLAGS=-fdebug-compilation-dir=".."
WEB_SOURCE_FILES=src/platform/web/*.c
WEB_LDLIBS=-lopenal
WEB_DEBUG_DIR=build
WEB_RELEASE_DIR=site
linux: assets
$(LINUX_CC) $(DEBUG_FLAGS) $(CFLAGS) $(LINUX_CFLAGS) $(SOURCE_FILES) $(LINUX_SOURCE_FILES) $(LINUX_LDLIBS)
linux-release: assets
$(LINUX_CC) $(RELEASE_FLAGS) $(CFLAGS) $(LINUX_CFLAGS) $(SOURCE_FILES) $(LINUX_SOURCE_FILES) $(LINUX_LDLIBS)
web: clean
cp src/platform/web/page/* $(WEB_DEBUG_DIR)/
$(WEB_CC) $(DEBUG_FLAGS) $(WEB_DEBUG_FLAGS) $(CFLAGS) $(WEB_CFLAGS) $(SOURCE_FILES) $(WEB_SOURCE_FILES) $(WEB_LDLIBS) -o $(WEB_DEBUG_DIR)/space-shooter.js
web-release:
rm -rf $(WEB_RELEASE_DIR)
mkdir $(WEB_RELEASE_DIR)
cp src/platform/web/page/* $(WEB_RELEASE_DIR)/
$(WEB_CC) $(RELEASE_FLAGS) $(CFLAGS) $(WEB_CFLAGS) $(SOURCE_FILES) $(WEB_SOURCE_FILES) $(WEB_LDLIBS) -o $(WEB_RELEASE_DIR)/space-shooter.js
assets: clean
cp -r assets build/assets
clean:
rm -rf build
mkdir build
.PHONY: debug release assets