-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (39 loc) · 1.93 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
################################################################################
COMPILER_PREFIX ?=
COMPILER_SUFFIX ?=
COMPILER_NAME ?= g++
COMPILER := $(COMPILER_PREFIX)$(COMPILER_NAME)$(COMPILER_SUFFIX)
ALL_CCFLAGS ?= -g -W -O3 -lstdc++fs -DNDEBUG -std=c++17 $(FLAG_FLTO)
################################################################################
ROOT_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
INCLUDES += -I$(ROOT_PATH)/
INCLUDES += -I$(ROOT_PATH)/LibParticle/PartioBgeo
INCLUDES += -I$(ROOT_PATH)/../LibCommon
INCLUDES += -I$(ROOT_PATH)/../LibCommon/Externals/debugbreak
INCLUDES += -I$(ROOT_PATH)/../LibCommon/Externals/fmt/include
INCLUDES += -I$(ROOT_PATH)/../LibCommon/Externals/glm
INCLUDES += -I$(ROOT_PATH)/../LibCommon/Externals/json/single_include/nlohmann
INCLUDES += -I$(ROOT_PATH)/../LibCommon/Externals/spdlog/include
INCLUDES += -I$(ROOT_PATH)/../LibCommon/Externals/tbb_linux/include
################################################################################
OUTPUT_DIR := ../../Build/Linux
OBJ_DIR := ../../Build/Linux/OBJS
LIB_NAME := libLibParticle.a
LIB_SRC := $(shell find $(ROOT_PATH)/LibParticle -name *.cpp)
LIB_OBJ := $(patsubst %.cpp, %.o, $(LIB_SRC))
COMPILE_OBJ := $(patsubst $(ROOT_PATH)/%, $(OBJ_DIR)/%, $(LIB_OBJ))
COMPILE_OBJ_SUBDIR := $(patsubst $(ROOT_PATH)/%, $(OBJ_DIR)/%, $(dir $(LIB_OBJ)))
################################################################################
all: create_out_dir $(OUTPUT_DIR)/$(LIB_NAME)
create_out_dir:
mkdir -p $(OUTPUT_DIR)
mkdir -p $(OBJ_DIR)
mkdir -p $(COMPILE_OBJ_SUBDIR)
$(OUTPUT_DIR)/$(LIB_NAME): $(COMPILE_OBJ)
$(GCC_PREFIX)gcc-ar$(GCC_SUFFIX) -rsv $(OUTPUT_DIR)/$(LIB_NAME) $(COMPILE_OBJ)
$(GCC_PREFIX)gcc-ranlib$(GCC_SUFFIX) $(OUTPUT_DIR)/$(LIB_NAME)
$(COMPILE_OBJ): $(OBJ_DIR)/%.o: $(ROOT_PATH)/%.cpp
$(COMPILER) $(INCLUDES) $(ALL_CCFLAGS) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)/LibParticle
rm $(OUTPUT_DIR)/$(LIB_NAME)