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
|
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
|
|
|
|
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-05-05 03:04:41 +02:00
|
|
|
ifneq ($(INTERNAL_LOOP_NTIMES),)
|
|
|
|
DEFINES += -DINTERNAL_LOOP_NTIMES=$(INTERNAL_LOOP_NTIMES)
|
|
|
|
endif
|
|
|
|
|
2021-05-20 00:08:10 +02:00
|
|
|
ifneq ($(EXPLICIT_TYPES),)
|
|
|
|
DEFINES += -DEXPLICIT_TYPES
|
|
|
|
endif
|
|
|
|
|
2020-08-11 16:34:22 +02:00
|
|
|
VPATH = $(SRC_DIR)
|
|
|
|
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
|
2021-04-12 08:24:27 +02:00
|
|
|
OBJ = $(filter-out $(BUILD_DIR)/main%,$(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c)))
|
2021-03-24 08:43:44 +01:00
|
|
|
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
ifneq ($(VARIANT),)
|
|
|
|
.DEFAULT_GOAL := ${TARGET}-$(VARIANT)
|
|
|
|
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
|
|
|
|
|
|
|
asm: $(BUILD_DIR) $(ASM)
|
|
|
|
|
2021-05-22 03:26:56 +02:00
|
|
|
$(BUILD_DIR)/%.o: %.s
|
|
|
|
#$(BUILD_DIR)/%.o: %.c
|
2020-08-11 16:34:22 +02:00
|
|
|
@echo "===> COMPILE $@"
|
|
|
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
$(Q)$(CC) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.s: %.c
|
|
|
|
@echo "===> GENERATE ASM $@"
|
|
|
|
$(Q)$(CC) -S $(ASFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
tags:
|
|
|
|
@echo "===> GENERATE TAGS"
|
|
|
|
$(Q)ctags -R
|
|
|
|
|
|
|
|
|
|
|
|
$(BUILD_DIR):
|
|
|
|
@mkdir $(BUILD_DIR)
|
|
|
|
|
|
|
|
ifeq ($(findstring $(MAKECMDGOALS),clean),)
|
|
|
|
-include $(OBJ:.o=.d)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: clean distclean
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "===> CLEAN"
|
|
|
|
@rm -rf $(BUILD_DIR)
|
|
|
|
@rm -f tags
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
@echo "===> DIST CLEAN"
|
2021-04-15 14:55:02 +02:00
|
|
|
@rm -f $(TARGET)*
|
2020-08-11 16:34:22 +02:00
|
|
|
@rm -f tags
|