-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (36 loc) · 970 Bytes
/
Copy pathMakefile
File metadata and controls
47 lines (36 loc) · 970 Bytes
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
.DEFAULT_GOAL := build_and_run
CXX = g++
# Includes
LIBPNG_INCLUDE=$(shell libpng-config --I_opts)
INCLUDES=-Ilib/headers $(LIBPNG_INCLUDE) -Isrc/*.h
#LDFlags
LIBPNG_LDFLAGS=$(shell libpng-config --L_opts)
LDFLAGS=$(LIBPNG_LDFLAGS) -lpng16 -framework OpenGL -framework GLUT -lobjc
CFLAGS_RELEASE += -O2 -s -DNDEBUG
# Compiler flags
CXXFLAGS=-std=c++17
# Source files
SRC=game.cpp
# Binary name
BIN=main
# Build rule
build: clean
@which libpng-config > /dev/null || (echo "libpng-config not found, please install libpng" && exit 1)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRC) -o $(BIN) $(LDFLAGS)
@$(MAKE) pack
run:
./$(BIN)
pack:
./$(BIN) --pack
build_and_run: build run clean
release: clean
$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRC) -o $(BIN) $(LDFLAGS) $(CFLAGS_RELEASE)
mkdir -p release
cp $(BIN) release/$(BIN)
cp *.dat release
pushd release && zip -r $(BIN).zip $(BIN) pack.dat && popd
# Clean rule
clean:
@rm -rf release
@rm -f $(BIN)
@rm -f pack.dat