-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
86 lines (69 loc) · 2.53 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
CXX := g++
CXXFLAGS := -std=c++17 -Iinclude
LDFLAGS := -lSDL2 -lSDL2_image -lSDL2_mixer -lstdc++fs
OBJS = $(addprefix build/, main.o graphics.o character.o options.o tutorial.o)
EXECNAME = OpenManifold
ICON =
ifeq ($(OS),Windows_NT)
LDFLAGS := -static-libgcc -static-libstdc++ -lmingw32 -lSDL2main $(LDFLAGS)
EXECNAME := $(addsuffix .exe,$(EXECNAME))
ICON := res/icon.res
endif
all: build $(OBJS)
$(CXX) -o bin/$(EXECNAME) $(OBJS) $(ICON) $(LDFLAGS)
$(OBJS): build/%.o: src/%.cpp
$(CXX) -c $< $(CXXFLAGS) $(LDFLAGS) -o $@
bg_test:
$(CXX) src/tests/bg_test.cpp -o bin/background_test.exe $(CXXFLAGS) $(LDFLAGS)
char_test:
$(CXX) src/tests/character_test.cpp -o bin/character_test.exe $(CXXFLAGS) $(LDFLAGS)
font_test:
$(CXX) src/tests/font_test.cpp -o bin/font_test.exe $(CXXFLAGS) $(LDFLAGS)
icon:
-rm -rf res/icon.res
-windres res/icon.rc -O coff -o res/icon.res
pkg: clean icon all
@echo Creating temporary directory...
-mkdir release-tmp
@echo Copying files...
cp bin/$(EXECNAME) ./release-tmp/$(EXECNAME)
cp README.md ./release-tmp/README.md
cp README.md ./release-tmp/README.txt
cp LICENSE ./release-tmp/LICENSE.txt
cp -r ./res/assets ./release-tmp/assets
ifeq ($(OS),Windows_NT)
@echo Copying SDL2 DLLs...
cp -r ./res/dll/. ./release-tmp/
endif
@if [ -d "./release" ]; then echo Copying release-version contents...; cp -r ./release/. ./release-tmp/assets; fi
zip: pkg
@echo Zipping via 7zip...
7z a -t7z Open-Manifold.7z ./release-tmp/*
@echo Deleting temporary directory...
rm -rf release-tmp
install:
cp -r ./res/assets ./bin/assets
cp -r ./release/. ./bin/assets
ifeq ($(OS),Windows_NT)
cp -r ./res/dll/. ./bin/
endif
build:
if [ ! -d "./build" ]; then mkdir -p build; fi
if [ ! -d "./bin" ]; then mkdir -p bin; fi
clean:
rm -f build/*.o
help:
@echo -----------------------------------------------------------------
@echo Targets:
@echo [none] - Builds the game executable.
@echo bg_test - Builds a background test program.
@echo char_test - Builds a character file test program.
@echo font_test - Builds a font-fallback test program.
@echo install - Copies game assets into bin folder.
@echo build - Creates build and bin folders.
@echo pkg - Cleans, builds the game, and makes a release folder. Requires Bash!
@echo zip - Runs make pkg, then makes the folder a ZIP. Requires 7zip!
@echo icon - Creates Windows resource file.
@echo clean - Deletes all object files.
@echo help - Prints this text.
@echo -----------------------------------------------------------------