-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
56 lines (42 loc) · 1.06 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
CC = g++
INCLUDE = -I ./include
LIBF = -L ./lib
CXXFLAGS = -Werror -O3 -std=c++17 -pthread $(INCLUDE) $(LIBF)
# -DDEBUG -g
LFLAGS =
LIBS = -lGLTF -ldraco -ldracoenc -ldracodec
OUT = out
APP = 3dtg
# Get Current platfrom name
ifeq ($(OS),Windows_NT)
uname_S := Windows
else
uname_S := $(shell uname -s)
endif
# Get output application extension (.exe for Windows, no extension for other systems)
ifeq ($(uname_S), Windows)
target = $(APP).exe
endif
ifeq ($(uname_S), Linux)
target = $(APP)
endif
ifeq ($(uname_S), Darwin)
target = $(APP)
endif
# Create OUT dir if not exists
ifeq (,$(wildcard $(OUT)))
createDirs := $(shell mkdir $("-p") $(OUT))
endif
EXECUTABLE = $(OUT)/$(target)
# Make does not offer a recursive wildcard function, so here's one:
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
SRC = $(call rwildcard,src,*.cpp)
OBJ = $(SRC:.cpp=.o)
CLEAN = $(foreach dir,$(OBJ),"$(dir)")
.PHONY: clean all app
all: app
app: $(OBJ)
$(CC) $(CXXFLAGS) $(OBJ) -o $(EXECUTABLE) $(LFLAGS) $(LIBS)
clean:
rm -f $(OBJ)
rm -f $(EXECUTABLE)