This repository has been archived by the owner on Oct 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (70 loc) · 1.92 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
# TODO: Check include guards
PROG_SAMPLES := ebiten
PROG_TEST := ebiten_test
CXX := clang++
CXXFLAGS := \
-W -Wall -Wextra -Wmissing-prototypes -Wshorten-64-to-32 \
-std=c++0x -stdlib=libc++ \
-fPIC \
-Iinclude \
-DEBITEN_VERSION_COMMIT_UNIX_TIME="`git log --pretty="%ct" -1`" \
-DEBITEN_VERSION_COMMIT_HASH="\"`git log --pretty="%H" -1`\"" \
-DEBITEN_VERSION_COMMIT_MODIFIED="`git status --porcelain -uno | wc -l`"
LDFLAGS := \
-stdlib=libc++ -framework Cocoa -framework OpenGL -framework QuartzCore
GTEST_DIR := third_party/gtest-1.6.0
SRC_INCLUDE := $(shell find include -name "*.hpp" -or -name "*.cpp" -or -name "*.mm")
SRC_SAMPLES := $(shell find samples -name "*.hpp" -or -name "*.cpp" -or -name "*.mm")
SRC_TEST := $(shell find test -name "*.hpp" -or -name "*.cpp" -or -name "*.mm")
.PHONY: samples test clean
samples: $(PROG_SAMPLES).app
open $<
# TODO: add xcodebuild?
test: bin/$(PROG_TEST)
./$<
$(PROG_SAMPLES).app: bin/$(PROG_SAMPLES) samples/resources/*
mkdir -p $@/Contents/MacOS
cp $< $@/Contents/MacOS
mkdir -p $@/Contents/Resources
cp samples/resources/* $@/Contents/Resources
bin/$(PROG_SAMPLES): $(SRC_INCLUDE) $(SRC_SAMPLES)
$(CXX) \
$(CXXFLAGS) \
-x objective-c++ \
-fobjc-arc \
$(LDFLAGS) \
-g \
-o $@ \
-O0 \
-Llib \
samples/main.cpp
bin/$(PROG_TEST): $(SRC_INCLUDE) $(SRC_TEST) lib/libgtest_main.a
$(CXX) \
$(CXXFLAGS) \
-x objective-c++ \
-fobjc-arc \
-DGTEST_HAS_TR1_TUPLE=0 \
-Wno-variadic-macros \
$(LDFLAGS) \
-I$(GTEST_DIR)/include \
-g \
-o $@ \
-O0 \
-lpthread \
-Llib -lgtest_main \
test/main.cpp
lib/libgtest_main.a:
(cd $(GTEST_DIR)/src; \
$(CXX) \
-W -Wall -Wextra -stdlib=libc++ \
-DGTEST_HAS_TR1_TUPLE=0 \
-I.. -I../include \
-g \
-c \
gtest-all.cc gtest_main.cc)
$(AR) $(ARFLAGS) $@ $(GTEST_DIR)/src/*.o
clean:
$(RM) -rf bin/*
$(RM) -rf $(PROG_SAMPLES).app
$(RM) -rf *.dSYM
find . -name "*.o" | xargs $(RM) -rf