-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_Base
134 lines (93 loc) · 3.46 KB
/
Makefile_Base
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
.DEFAULT_GOAL := All
CC = g++
LK = ld
AR = ar
CXXFLAGS = -std=c++20 -pthread -march=native -mtune=native -fno-pie -fdiagnostics-color=always
ifeq ($(DEBUG), true)
CXXFLAGS += -O0 -fno-lto -g3 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
else ifeq ($(PROFILE), true)
CXXFLAGS += -O0 -fno-lto -g3 -pg -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
else
CXXFLAGS += -O3 -flto -ffast-math
endif
LDFLAGS = -static-libgcc -static-libstdc++ -no-pie
ifeq ($(OS), Windows_NT)
LDFLAGS += -lopengl32 -lGLU32 -lfreeglut
else
LDFLAGS += -lGL -lGLU -lglut
endif
ifneq ($(LK),)
ifneq ($(LK), ld)
LDFLAGS += -fuse-ld=$(LK)
endif
endif
ARFLAGS = -crs
C_DEPS = -MMD -MF $(@:$(OBJ_EXT)=$(DEPS_EXT))
SRC_EXT = .cpp
HEADER_EXT = .hpp
OBJ_EXT = .o
LIB_EXT = .a
DEPS_EXT = .o.d
ifeq ($(OS), Windows_NT)
BIN_EXT = .exe
else
BIN_EXT =
endif
PROJ = $(notdir $(CURDIR))
SUBPATH_SRC = src/
SUBPATH_BIN = bin/
PATH_ROOT = ./
PATH_BASE = $(PATH_ROOT)Ateams_Base/
PATH_BINPACKING = $(PATH_ROOT)BinPacking/
PATH_FLOWSHOP = $(PATH_ROOT)FlowShop/
PATH_GRAPHCOLORING = $(PATH_ROOT)GraphColoring/
PATH_JOBSHOP = $(PATH_ROOT)JobShop/
PATH_KNAPSACK = $(PATH_ROOT)KnapSack/
PATH_TRAVELLINGSALESMAN = $(PATH_ROOT)TravellingSalesman/
PATH_BASE_SRC = $(PATH_BASE)$(SUBPATH_SRC)
PATH_BASE_BIN = $(PATH_BASE)$(SUBPATH_BIN)
PATH_PROJ_SRC = $(PATH_ROOT)$(PROJ)/$(SUBPATH_SRC)
PATH_PROJ_BIN = $(PATH_ROOT)$(PROJ)/$(SUBPATH_BIN)
BASE_NAME = Ateams_Base
BASE_SRCS = $(wildcard $(PATH_BASE_SRC)*$(SRC_EXT))
BASE_HEADERS = $(wildcard $(PATH_BASE_SRC)*$(HEADER_EXT))
BASE_OBJS = $(subst $(PATH_BASE_SRC),$(PATH_BASE_BIN),$(subst $(SRC_EXT),$(OBJ_EXT),$(BASE_SRCS)))
BASE_LIB = $(PATH_BASE_BIN)$(BASE_NAME)$(LIB_EXT)
BASE_DEPS = $(BASE_OBJS:$(OBJ_EXT)=$(DEPS_EXT))
PROJ_SRCS = $(wildcard $(PATH_PROJ_SRC)*$(SRC_EXT))
PROJ_HEADERS = $(wildcard $(PATH_PROJ_SRC)*$(HEADER_EXT))
PROJ_OBJS = $(subst $(PATH_PROJ_SRC),$(PATH_PROJ_BIN),$(subst $(SRC_EXT),$(OBJ_EXT),$(PROJ_SRCS)))
PROJ_BIN = $(PROJ_OBJS:$(OBJ_EXT)=$(BIN_EXT))
PROJ_DEPS = $(PROJ_OBJS:$(OBJ_EXT)=$(DEPS_EXT))
PATTERN_BASE_SRCS = $(PATH_BASE_SRC)%$(SRC_EXT)
PATTERN_BASE_HEADERS = $(PATH_BASE_SRC)%$(HEADER_EXT)
PATTERN_BASE_OBJS = $(PATH_BASE_BIN)%$(OBJ_EXT)
PATTERN_PROJ_SRCS = $(PATH_PROJ_SRC)%$(SRC_EXT)
PATTERN_PROJ_HEADERS = $(PATH_PROJ_SRC)%$(HEADER_EXT)
PATTERN_PROJ_OBJS = $(PATH_PROJ_BIN)%$(OBJ_EXT)
BUILD_STAT_BIN_FILE = .build_info
NINJA_BUILD_FILE = build.ninja
NINJA_OUTPUTS_FILE = .ninja_deps .ninja_log
PROFILE_OUTPUT_FILE = gmon.out profile.gprof perf.data
MKDIR = mkdir -p
RM = rm -rf
ECHO = echo
ALL := $(shell echo {A,a}ll)
CLEAN := $(shell echo {C,c}lean)
PURGE := $(shell echo {P,p}urge)
.PHONY: list print_vars
list:
@LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2> /dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^print_vars' -e '^[Aa]ll' -e '^$@$$'
print_vars:
@$(ECHO) - MAKEFILE_FLAGS: $(MAKEFLAGS)
@$(ECHO) - PROJ: $(PROJ)
@$(ECHO) - BASE_SOURCES: $(BASE_SRCS)
@$(ECHO) - BASE_HEADERS: $(BASE_HEADERS)
@$(ECHO) - BASE_DEPS: $(BASE_DEPS)
@$(ECHO) - BASE_OBJS: $(BASE_OBJS)
@$(ECHO) - BASE_LIB: $(BASE_LIB)
@$(ECHO) - PROJ_SOURCES: $(PROJ_SRCS)
@$(ECHO) - PROJ_HEADERS: $(PROJ_HEADERS)
@$(ECHO) - PROJ_DEPS: $(PROJ_DEPS)
@$(ECHO) - PROJ_OBJS: $(PROJ_OBJS)
@$(ECHO) - PROJ_BIN: $(PROJ_BIN)