27 lines
704 B
Makefile
27 lines
704 B
Makefile
CXX = g++
|
|
INC_DIR = include
|
|
OBJ_DIR = object
|
|
SRC_DIR = src
|
|
EXE_DIR = bin
|
|
CFLAGS = -O3 -ffast-math -std=c++98 -pedantic -pthread
|
|
TEST_FILE = $(EXE_DIR)/SumNums
|
|
TARGET = $(EXE_DIR)/SumNums
|
|
MKDIR_P = mkdir -p
|
|
|
|
SRC = $(SRC_DIR)/ThreadPool_pthread.cpp $(SRC_DIR)/LockGuard_pthread.cpp examples/sumnums.cpp
|
|
OBJ = $(OBJ_DIR)/ThreadPool_pthread.o $(OBJ_DIR)/LockGuard_pthread.o $(OBJ_DIR)/sumnums.o
|
|
DEP = $(INC_DIR)/ThreadPool_pthread.h $(INC_DIR)/LockGuard_pthread.h
|
|
|
|
all: $(TARGET)
|
|
|
|
$(OBJ): $(SRC) $(DEP)
|
|
$(MKDIR_P) $(@D)
|
|
$(CXX) $(CFLAGS) -I$(INC_DIR) -c $< -o $@
|
|
|
|
$(TARGET): $(OBJ) $(DEP)
|
|
$(MKDIR_P) $(@D)
|
|
$(CXX) $(CFLAGS) -o $@ $(SRC) -I$(INC_DIR)
|
|
|
|
clean:
|
|
$(RM) $(OBJ_DIR)/*.o $(TARGET) $(TEST_FILE)
|