-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (35 loc) · 910 Bytes
/
Makefile
File metadata and controls
44 lines (35 loc) · 910 Bytes
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
include config.mk
# Detect platform and define commands
ifeq ($(OS),Windows_NT)
SHELL := cmd.exe
MKDIR = if not exist "$(subst /,\,$1)" mkdir "$(subst /,\,$1)"
RMDIR = if exist "$(subst /,\,$1)" rmdir /s /q "$(subst /,\,$1)"
DEL = if exist "$(subst /,\,$1)" del /q "$(subst /,\,$1)"
EXE = .exe
PATHSEP = \\
else
SHELL := /bin/sh
MKDIR = mkdir -p $1
RMDIR = rm -rf $1
DEL = rm -f $1
EXE =
PATHSEP = /
endif
BIN := main$(EXE)
.PHONY: all clean
all: $(BIN)
$(BIN): $(OBJ_FILES)
$(call MKDIR,$(@D))
$(CXX) $(LDFLAGS) -o $@ $^
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
$(call MKDIR,$(dir $@))
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cc
$(call MKDIR,$(dir $@))
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cxx
$(call MKDIR,$(dir $@))
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
clean:
$(call RMDIR,$(OBJ_DIR))
$(call DEL,$(BIN))