2020-08-11 16:34:22 +02:00
|
|
|
#CONFIGURE BUILD SYSTEM
|
2021-04-12 08:24:27 +02:00
|
|
|
TARGET = MDBench-$(TAG)
|
2020-08-11 16:34:22 +02:00
|
|
|
BUILD_DIR = ./$(TAG)
|
2021-04-12 08:24:27 +02:00
|
|
|
SRC_DIR = ./src
|
2021-06-11 09:38:34 +02:00
|
|
|
ASM_DIR = ./asm
|
2020-08-11 16:34:22 +02:00
|
|
|
MAKE_DIR = ./
|
|
|
|
Q ?= @
|
|
|
|
|
|
|
|
#DO NOT EDIT BELOW
|
2021-03-24 08:43:44 +01:00
|
|
|
include $(MAKE_DIR)/config.mk
|
2020-08-11 16:34:22 +02:00
|
|
|
include $(MAKE_DIR)/include_$(TAG).mk
|
2021-06-11 09:38:34 +02:00
|
|
|
include $(MAKE_DIR)/include_LIKWID.mk
|
2020-08-11 16:34:22 +02:00
|
|
|
INCLUDES += -I./src/includes
|
|
|
|
|
2021-03-24 08:43:44 +01:00
|
|
|
ifeq ($(strip $(DATA_LAYOUT)),AOS)
|
|
|
|
DEFINES += -DAOS
|
|
|
|
endif
|
|
|
|
ifeq ($(strip $(DATA_TYPE)),SP)
|
|
|
|
DEFINES += -DPRECISION=1
|
|
|
|
else
|
|
|
|
DEFINES += -DPRECISION=2
|
|
|
|
endif
|
|
|
|
|
2021-08-09 21:37:18 +02:00
|
|
|
ifneq ($(ASM_SYNTAX), ATT)
|
|
|
|
ASFLAGS += -masm=intel
|
|
|
|
endif
|
|
|
|
|
2021-10-12 22:39:54 +02:00
|
|
|
ifneq ($(ATOMS_LOOP_RUNS),)
|
|
|
|
DEFINES += -DATOMS_LOOP_RUNS=$(ATOMS_LOOP_RUNS)
|
|
|
|
endif
|
|
|
|
|
2021-06-16 00:56:00 +02:00
|
|
|
ifneq ($(NEIGHBORS_LOOP_RUNS),)
|
|
|
|
DEFINES += -DNEIGHBORS_LOOP_RUNS=$(NEIGHBORS_LOOP_RUNS)
|
2021-05-05 03:04:41 +02:00
|
|
|
endif
|
|
|
|
|
2021-10-26 09:11:17 +02:00
|
|
|
ifeq ($(strip $(PRINT_STATS)),true)
|
|
|
|
DEFINES += -DPRINT_STATS
|
|
|
|
endif
|
2021-06-16 00:56:00 +02:00
|
|
|
ifeq ($(strip $(EXPLICIT_TYPES)),true)
|
2021-05-20 00:08:10 +02:00
|
|
|
DEFINES += -DEXPLICIT_TYPES
|
|
|
|
endif
|
|
|
|
|
2021-06-16 00:56:00 +02:00
|
|
|
ifeq ($(strip $(MEM_TRACER)),true)
|
|
|
|
DEFINES += -DMEM_TRACER
|
|
|
|
endif
|
|
|
|
|
2021-07-09 23:49:14 +02:00
|
|
|
ifeq ($(strip $(INDEX_TRACER)),true)
|
|
|
|
DEFINES += -DINDEX_TRACER
|
|
|
|
endif
|
|
|
|
|
2021-10-12 15:04:08 +02:00
|
|
|
ifeq ($(strip $(COMPUTE_STATS)),true)
|
|
|
|
DEFINES += -DCOMPUTE_STATS
|
|
|
|
endif
|
|
|
|
|
2021-07-09 23:49:14 +02:00
|
|
|
ifneq ($(VECTOR_WIDTH),)
|
|
|
|
DEFINES += -DVECTOR_WIDTH=$(VECTOR_WIDTH)
|
|
|
|
endif
|
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
VPATH = $(SRC_DIR) $(ASM_DIR)
|
2020-08-11 16:34:22 +02:00
|
|
|
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
|
2021-06-11 09:38:34 +02:00
|
|
|
OVERWRITE:= $(patsubst $(ASM_DIR)/%-new.s, $(BUILD_DIR)/%.o,$(wildcard $(ASM_DIR)/*-new.s))
|
|
|
|
OBJ = $(filter-out $(BUILD_DIR)/main% $(OVERWRITE),$(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c)))
|
|
|
|
OBJ += $(patsubst $(ASM_DIR)/%.s, $(BUILD_DIR)/%.o,$(wildcard $(ASM_DIR)/*.s))
|
2021-03-24 08:43:44 +01:00
|
|
|
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
# $(warning $(OBJ))
|
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
ifneq ($(VARIANT),)
|
|
|
|
.DEFAULT_GOAL := ${TARGET}-$(VARIANT)
|
2021-06-16 00:56:00 +02:00
|
|
|
DEFINES += -DVARIANT=$(VARIANT)
|
2021-04-12 08:24:27 +02:00
|
|
|
endif
|
2021-03-30 01:54:56 +02:00
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
${TARGET}: $(BUILD_DIR) $(OBJ) $(SRC_DIR)/main.c
|
|
|
|
@echo "===> LINKING $(TARGET)"
|
|
|
|
$(Q)${LINKER} $(CPPFLAGS) ${LFLAGS} -o $(TARGET) $(SRC_DIR)/main.c $(OBJ) $(LIBS)
|
2021-03-30 01:54:56 +02:00
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
${TARGET}-%: $(BUILD_DIR) $(OBJ) $(SRC_DIR)/main-%.c
|
|
|
|
@echo "===> LINKING $(TARGET)-$* "
|
|
|
|
$(Q)${LINKER} $(CPPFLAGS) ${LFLAGS} -o $(TARGET)-$* $(SRC_DIR)/main-$*.c $(OBJ) $(LIBS)
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
$(BUILD_DIR)/%.o: %.c
|
|
|
|
$(info ===> COMPILE $@)
|
2020-08-11 16:34:22 +02:00
|
|
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
2021-06-11 09:38:34 +02:00
|
|
|
$(Q)$(CC) $(CPPFLAGS) -MT $@ -MM $< > $(BUILD_DIR)/$*.d
|
2020-08-11 16:34:22 +02:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%.s: %.c
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> GENERATE ASM $@)
|
2021-08-09 21:37:18 +02:00
|
|
|
$(Q)$(CC) -S $(ASFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
$(BUILD_DIR)/%.o: %.s
|
|
|
|
$(info ===> ASSEMBLE $@)
|
2021-08-10 01:19:26 +02:00
|
|
|
$(Q)$(AS) $< -o $@
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
.PHONY: clean distclean tags info asm
|
2020-08-11 16:34:22 +02:00
|
|
|
|
|
|
|
clean:
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> CLEAN)
|
2020-08-11 16:34:22 +02:00
|
|
|
@rm -rf $(BUILD_DIR)
|
|
|
|
@rm -f tags
|
|
|
|
|
|
|
|
distclean: clean
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> DIST CLEAN)
|
2021-04-15 14:55:02 +02:00
|
|
|
@rm -f $(TARGET)*
|
2020-08-11 16:34:22 +02:00
|
|
|
@rm -f tags
|
2021-06-11 09:38:34 +02:00
|
|
|
|
|
|
|
info:
|
|
|
|
$(info $(CFLAGS))
|
|
|
|
$(Q)$(CC) $(VERSION)
|
|
|
|
|
|
|
|
asm: $(BUILD_DIR) $(ASM)
|
|
|
|
|
|
|
|
tags:
|
|
|
|
$(info ===> GENERATE TAGS)
|
|
|
|
$(Q)ctags -R
|
|
|
|
|
|
|
|
$(BUILD_DIR):
|
|
|
|
@mkdir $(BUILD_DIR)
|
|
|
|
|
|
|
|
-include $(OBJ:.o=.d)
|