-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (65 loc) · 1.54 KB
/
Makefile
File metadata and controls
85 lines (65 loc) · 1.54 KB
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
84
85
#
#
#
#
CC = clang
XCC =clang++
LD =clang++
SZ=llvm-size
TARGET = uvConvertor-CLI
#===========
DEFS = \
CXX_INCLUDE = \
tinyxml2 \
json/include \
CLI11/include \
C_INCLUDE = \
#=============
CXX_SOURCES = \
main.cpp \
uvconvertor.cpp \
tinyxml2/tinyxml2.cpp \
utils.cpp
C_SOURCES = \
#=============
LIBPATH = \
LIBS = \
#-----------------------------------------------
CXXFLAGS = \
$(patsubst %, -D%, $(DEFS)) \
$(patsubst %, -I%, $(CXX_INCLUDE)) \
-std=c++17 \
-g
CFLAGS = \
-std=c99 \
$(patsubst %, -D%, $(DEFS)) \
$(patsubst %, -I%, $(C_INCLUDE)) \
LDFLAGS = \
$(patsubst %, -L%, $(LIBPATH)) \
$(patsubst %, -l%, $(LIBS)) \
-std=c++17
DEBUG = \
-O0
#-----------------------------------------------
BUILD_DIR = build
#-----------------------------------------------
C_OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
CXX_OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(CXX_SOURCES:.cpp=.o)))
OBJECTS = $(C_OBJECTS) $(CXX_OBJECTS)
vpath %.c $(sort $(dir $(C_SOURCES)))
vpath %.cpp $(sort $(dir $(CXX_SOURCES)))
#-----------------------------------------------
$(TARGET).exe: $(OBJECTS) Makefile
$(LD) $(OBJECTS) $(LDFLAGS) $(DEBUG) -o $@
$(SZ) $@
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
$(XCC) --driver-mode=gcc $(DEBUG) -c $(CXXFLAGS) $< -o $@
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) --driver-mode=gcc $(DEBUG) -c $(CFLAGS) $< -o $@
$(BUILD_DIR):
mkdir $@
#-----------------------------------------------
.PHONY: clean
clean:
find $(BUILD_DIR) -name "*.o" |xargs rm -rf
#find . -type f | grep .o$ | xargs rm -r