-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
76 lines (63 loc) · 1.46 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
CC = g++
LD = $(CC)
GITBINARY = git
FIRMWAREREPO = simulator_libraries
FEHURL = code.osu.edu
CPPFLAGS = -MMD -MP -Os -DOBJC_OLD_DISPATCH_PROTOTYPES -g
WARNINGS = -Wall
LIB_DIR = simulator_libraries
INC_DIRS = -I$(LIB_DIR) -I.
OBJS = $(LIB_DIR)/FEHLCD.o $(LIB_DIR)/FEHRandom.o $(LIB_DIR)/FEHSD.o $(LIB_DIR)/FEHUtility.o $(LIB_DIR)/tigr.o
ifeq ($(OS),Windows_NT)
LDFLAGS = -lopengl32 -lgdi32
EXEC = game.exe
SHELL := CMD
else
LDFLAGS = -framework OpenGL -framework Cocoa
EXEC = game.out
endif
SRC_FILES := $(wildcard ./*.cpp)
OBJ_FILES := $(patsubst ./%.cpp,./%.o,$(SRC_FILES))
all: pre-build $(EXEC)
pre-build:
ifeq ($(OS),Windows_NT)
# check for internet connection
@ping -n 1 -w 1000 $(FEHURL) > NUL & \
if errorlevel 1 \
( \
( echo "Warning: No internet connection!" ) \
) \
else \
( \
( \
cd $(LIB_DIR) && \
$(GITBINARY) stash && \
$(GITBINARY) pull && \
cd .. \
) \
)
else
# Mac/Linux
@ping -c 1 -W 1000 $(FEHURL) > /dev/null ; \
if [ "$$?" -ne 0 ]; then \
echo "Warning: No internet connection!"; \
else \
cd $(LIB_DIR) ; \
$(GITBINARY) stash ; \
$(GITBINARY) pull ; \
cd .. ; \
fi \
endif
$(EXEC): $(OBJ_FILES) $(OBJS)
$(CC) $(CPPFLAGS) $(WARNINGS) $(INC_DIRS) $(OBJ_FILES) $(OBJS) -o $(EXEC) $(LDFLAGS)
./%.o: ./%.cpp
$(CC) $(CPPFLAGS) $(WARNINGS) $(INC_DIRS) -c -o $@ $<
clean:
ifeq ($(OS),Windows_NT)
del $(LIB_DIR)\*.o
del $(LIB_DIR)\*.d
del *.o *.d $(EXEC)
else
rm $(LIB_DIR)/*.o $(LIB_DIR)/*.d
rm *.o *.d $(EXEC)
endif