-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
44 lines (33 loc) · 828 Bytes
/
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
SRC_DIR:=src
OBJ_DIR:=obj
INCLUDES:=-Iinc/ -Ilib/include/
LIBRARIES:=`pkg-config --static --libs glfw3` -lfreeimage -lnanogui
OUTDIR:=build
GAMEFILE:=game
CFLAGS:=$(INCLUDES) -O2 $(LIBRARIES) -Llib/x64/ -lgl3w
LFLAGS:=$(INCLUDES) -O2 $(LIBRARIES) -Llib/x64/ -lgl3w
CPPS:=$(shell find $(SRC_DIR) -name *.cpp)
OBJS:=$(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(CPPS))
build: objdir $(GAMEFILE)
$(GAMEFILE): $(OBJS)
g++ -o $@ $(OBJS) $(LFLAGS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
if [ ! -d "$(dir $@)" ]; then \
mkdir -p $(dir $@); \
fi
g++ -o $@ -c $? $(CFLAGS)
.PHONY: objdir clean test
clean:
if [ -d "$(OUTDIR)" ]; then \
rm -rf $(OUTDIR); \
fi
if [ -d "$(OBJ_DIR)" ]; then \
rm -rf $(OBJ_DIR); \
fi
test:
echo $(CPPS)
echo $(OBJS)
objdir:
if [ ! -d "$(OBJ_DIR)" ]; then \
mkdir $(OBJ_DIR); \
fi