-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
55 lines (39 loc) · 1 KB
/
Copy pathmakefile
File metadata and controls
55 lines (39 loc) · 1 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
PLATFORM ?= linux
CROSSCOMPILER ?=
# Compiler
CXX := $(CROSSCOMPILER)g++
# Compiler flags
CXXFLAGS := -std=c++17 -Wall -static
# Linker flags
LDFLAGS := -lstdc++fs -pthread -static-libstdc++ -static-libgcc
INC := -Iclient/${PLATFORM} -Iclient
# Target executable
TARGET := plotop
# Build directories
BUILD_DIR := build
# Source files
SRC := $(wildcard client/*.cc) $(wildcard client/${PLATFORM}/*.cc) $(wildcard client/${PLATFORM}/*.cpp) $(wildcard client/${PLATFORM}/*.cc)
# Object files
OBJ := $(SRC:%=$(BUILD_DIR)/%.o)
# Dependency files
DEP := $(OBJ:.o=.d)
# Include dependency files
-include $(DEP)
# Default target
all: $(BUILD_DIR)/$(TARGET)
cp $(BUILD_DIR)/$(TARGET) .
# Link target
$(BUILD_DIR)/$(TARGET): $(OBJ)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INC) $^ -o $@ $(LDFLAGS)
# Compile target
$(BUILD_DIR)/%.cc.o: %.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INC) -MMD -c $< -o $@
# Clean target
clean:
@rm -rf $(BUILD_DIR)
# Phony targets
.PHONY: all clean
# set default make all
.DEFAULT_GOAL := all