2020-08-11 16:34:22 +02:00
|
|
|
#CONFIGURE BUILD SYSTEM
|
2024-05-15 14:20:40 +02:00
|
|
|
TAG = $(OPT_TAG)-$(TOOLCHAIN)-$(DATA_TYPE)
|
|
|
|
TARGET = MDBench-$(TAG)
|
|
|
|
BUILD_DIR = ./build/build-$(TAG)
|
|
|
|
SRC_ROOT = ./src
|
|
|
|
SRC_DIR = $(SRC_ROOT)/$(OPT_SCHEME)
|
|
|
|
COMMON_DIR = $(SRC_ROOT)/common
|
|
|
|
CUDA_DIR = $(SRC_DIR)/cuda
|
|
|
|
MAKE_DIR = ./make
|
2020-08-11 16:34:22 +02:00
|
|
|
Q ?= @
|
|
|
|
|
|
|
|
#DO NOT EDIT BELOW
|
2024-05-15 14:20:40 +02:00
|
|
|
include config.mk
|
|
|
|
include $(MAKE_DIR)/include_$(TOOLCHAIN).mk
|
2021-06-11 09:38:34 +02:00
|
|
|
include $(MAKE_DIR)/include_LIKWID.mk
|
2024-05-15 14:20:40 +02:00
|
|
|
ifneq ($(strip $(ISA)),NONE)
|
2022-03-09 02:25:39 +01:00
|
|
|
include $(MAKE_DIR)/include_ISA.mk
|
2022-04-01 15:57:54 +02:00
|
|
|
endif
|
2024-05-15 14:20:40 +02:00
|
|
|
include $(MAKE_DIR)/include_GROMACS.mk
|
|
|
|
INCLUDES += -I./$(SRC_DIR) -I./$(COMMON_DIR)
|
2022-04-01 15:57:54 +02:00
|
|
|
|
2024-05-15 14:20:40 +02:00
|
|
|
VPATH = $(SRC_DIR) $(COMMON_DIR) $(CUDA_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))
|
2024-05-15 14:20:40 +02:00
|
|
|
OBJ += $(patsubst $(COMMON_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(COMMON_DIR)/*.c))
|
2022-08-09 18:53:53 +02:00
|
|
|
ifeq ($(strip $(TAG)),NVCC)
|
|
|
|
OBJ += $(patsubst $(CUDA_DIR)/%.cu, $(BUILD_DIR)/%-cuda.o,$(wildcard $(CUDA_DIR)/*.cu))
|
|
|
|
endif
|
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
|
|
|
|
2022-08-09 18:53:53 +02:00
|
|
|
$(BUILD_DIR)/%-cuda.o: %.cu
|
|
|
|
$(info ===> COMPILE $@)
|
|
|
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
$(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)
|
|
|
|
|
2023-01-02 19:11:05 +01:00
|
|
|
cleanall:
|
|
|
|
$(info ===> CLEAN)
|
2024-05-15 14:20:40 +02:00
|
|
|
@rm -rf build
|
2023-01-16 23:05:21 +01:00
|
|
|
@rm -rf MDBench-*
|
2023-01-02 19:11:05 +01:00
|
|
|
@rm -f tags
|
|
|
|
|
2020-08-11 16:34:22 +02:00
|
|
|
distclean: clean
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> DIST CLEAN)
|
2024-05-15 14:20:40 +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):
|
2024-05-15 14:20:40 +02:00
|
|
|
@mkdir -p $(BUILD_DIR)
|
2021-06-11 09:38:34 +02:00
|
|
|
|
|
|
|
-include $(OBJ:.o=.d)
|