scalometer/Makefile

45 lines
860 B
Makefile

CXX ?= g++
OPTFLAGS ?= -O3 -march=native
VECTOR_SIZE ?= 268435456
ENABLE_EVENTIFY ?= YES
CXXFLAGS = -std=c++20 -fopenmp
CPPFLAGS = -DVECTOR_SIZE=$(VECTOR_SIZE)
INCLUDES = -I./include
LDFLAGS = -fopenmp
ifeq ($(ENABLE_EVENTIFY), YES)
CPPFLAGS += -DENABLE_EVENTIFY
INCLUDES += -I$(EVENTIFY_ROOT)/include
LDFLAGS += -L$(EVENTIFY_ROOT)/lib -leventify
endif
CXXFLAGS += $(CPPFLAGS) $(INCLUDES) $(OPTFLAGS)
SRC_DIR = src
INCLUDE_DIR = include
OBJ_DIR = obj
BIN_DIR = bin
SRCS = $(wildcard $(SRC_DIR)/*.cpp)
OBJS = $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
TARGET = $(BIN_DIR)/benchmark
# Default rule to build the program
all: $(TARGET)
$(TARGET): $(OBJS)
@mkdir -p $(BIN_DIR)
$(CXX) $(LDFLAGS) $(OBJS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(OBJ_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -rf $(BIN_DIR) $(OBJ_DIR)
.PHONY: all clean