Add LIKWID Option. Allow to overwrite with asm variant.
This commit is contained in:
parent
b8b364d265
commit
b6d4753c2a
58
Makefile
58
Makefile
@ -2,12 +2,14 @@
|
|||||||
TARGET = MDBench-$(TAG)
|
TARGET = MDBench-$(TAG)
|
||||||
BUILD_DIR = ./$(TAG)
|
BUILD_DIR = ./$(TAG)
|
||||||
SRC_DIR = ./src
|
SRC_DIR = ./src
|
||||||
|
ASM_DIR = ./asm
|
||||||
MAKE_DIR = ./
|
MAKE_DIR = ./
|
||||||
Q ?= @
|
Q ?= @
|
||||||
|
|
||||||
#DO NOT EDIT BELOW
|
#DO NOT EDIT BELOW
|
||||||
include $(MAKE_DIR)/config.mk
|
include $(MAKE_DIR)/config.mk
|
||||||
include $(MAKE_DIR)/include_$(TAG).mk
|
include $(MAKE_DIR)/include_$(TAG).mk
|
||||||
|
include $(MAKE_DIR)/include_LIKWID.mk
|
||||||
INCLUDES += -I./src/includes
|
INCLUDES += -I./src/includes
|
||||||
|
|
||||||
ifeq ($(strip $(DATA_LAYOUT)),AOS)
|
ifeq ($(strip $(DATA_LAYOUT)),AOS)
|
||||||
@ -27,11 +29,15 @@ ifneq ($(EXPLICIT_TYPES),)
|
|||||||
DEFINES += -DEXPLICIT_TYPES
|
DEFINES += -DEXPLICIT_TYPES
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VPATH = $(SRC_DIR)
|
VPATH = $(SRC_DIR) $(ASM_DIR)
|
||||||
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
|
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
|
||||||
OBJ = $(filter-out $(BUILD_DIR)/main%,$(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c)))
|
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))
|
||||||
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
|
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
|
||||||
|
|
||||||
|
# $(warning $(OBJ))
|
||||||
|
|
||||||
ifneq ($(VARIANT),)
|
ifneq ($(VARIANT),)
|
||||||
.DEFAULT_GOAL := ${TARGET}-$(VARIANT)
|
.DEFAULT_GOAL := ${TARGET}-$(VARIANT)
|
||||||
endif
|
endif
|
||||||
@ -44,38 +50,42 @@ ${TARGET}-%: $(BUILD_DIR) $(OBJ) $(SRC_DIR)/main-%.c
|
|||||||
@echo "===> LINKING $(TARGET)-$* "
|
@echo "===> LINKING $(TARGET)-$* "
|
||||||
$(Q)${LINKER} $(CPPFLAGS) ${LFLAGS} -o $(TARGET)-$* $(SRC_DIR)/main-$*.c $(OBJ) $(LIBS)
|
$(Q)${LINKER} $(CPPFLAGS) ${LFLAGS} -o $(TARGET)-$* $(SRC_DIR)/main-$*.c $(OBJ) $(LIBS)
|
||||||
|
|
||||||
asm: $(BUILD_DIR) $(ASM)
|
$(BUILD_DIR)/%.o: %.c
|
||||||
|
$(info ===> COMPILE $@)
|
||||||
$(BUILD_DIR)/%.o: %.s
|
|
||||||
#$(BUILD_DIR)/%.o: %.c
|
|
||||||
@echo "===> COMPILE $@"
|
|
||||||
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
$(Q)$(CC) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
|
$(Q)$(CC) $(CPPFLAGS) -MT $@ -MM $< > $(BUILD_DIR)/$*.d
|
||||||
|
|
||||||
$(BUILD_DIR)/%.s: %.c
|
$(BUILD_DIR)/%.s: %.c
|
||||||
@echo "===> GENERATE ASM $@"
|
$(info ===> GENERATE ASM $@)
|
||||||
$(Q)$(CC) -S $(ASFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@
|
$(Q)$(CC) -S $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
tags:
|
$(BUILD_DIR)/%.o: %.s
|
||||||
@echo "===> GENERATE TAGS"
|
$(info ===> ASSEMBLE $@)
|
||||||
$(Q)ctags -R
|
$(Q)$(AS) $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
|
.PHONY: clean distclean tags info asm
|
||||||
$(BUILD_DIR):
|
|
||||||
@mkdir $(BUILD_DIR)
|
|
||||||
|
|
||||||
ifeq ($(findstring $(MAKECMDGOALS),clean),)
|
|
||||||
-include $(OBJ:.o=.d)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: clean distclean
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "===> CLEAN"
|
$(info ===> CLEAN)
|
||||||
@rm -rf $(BUILD_DIR)
|
@rm -rf $(BUILD_DIR)
|
||||||
@rm -f tags
|
@rm -f tags
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
@echo "===> DIST CLEAN"
|
$(info ===> DIST CLEAN)
|
||||||
@rm -f $(TARGET)*
|
@rm -f $(TARGET)*
|
||||||
@rm -f tags
|
@rm -f tags
|
||||||
|
|
||||||
|
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)
|
||||||
|
0
asm/.gitkeep
Normal file
0
asm/.gitkeep
Normal file
@ -1,9 +1,11 @@
|
|||||||
# Supported: GCC, CLANG, ICC
|
# Supported: GCC, CLANG, ICC
|
||||||
TAG ?= ICC
|
TAG ?= CLANG
|
||||||
|
ENABLE_LIKWID ?= false
|
||||||
# SP or DP
|
# SP or DP
|
||||||
DATA_TYPE ?= DP
|
DATA_TYPE ?= DP
|
||||||
# AOS or SOA
|
# AOS or SOA
|
||||||
DATA_LAYOUT ?= AOS
|
DATA_LAYOUT ?= AOS
|
||||||
|
|
||||||
#Feature options
|
#Feature options
|
||||||
OPTIONS += -DALIGNMENT=64 -DLIKWID_PERFMON
|
OPTIONS = -DALIGNMENT=64
|
||||||
|
#OPTIONS += More options
|
||||||
|
10
include_LIKWID.mk
Normal file
10
include_LIKWID.mk
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
LIKWID_INC ?= -I/usr/local/include
|
||||||
|
LIKWID_DEFINES ?= -DLIKWID_PERFMON
|
||||||
|
LIKWID_LIB ?= -L/usr/local/lib
|
||||||
|
|
||||||
|
ifeq ($(strip $(ENABLE_LIKWID)),true)
|
||||||
|
INCLUDES += ${LIKWID_INC}
|
||||||
|
DEFINES += ${LIKWID_DEFINES}
|
||||||
|
LIBS += -llikwid
|
||||||
|
LFLAGS += ${LIKWID_LIB}
|
||||||
|
endif
|
Loading…
Reference in New Issue
Block a user