-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 948 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# A wrapper for project-specific building
LLAMA_CPP_DIR = ./llama.cpp-b2430
SRC_DIR = ./src
TEST_DIR = ./test
ifdef LAMM_DEBUG
export LLAMA_DEBUG
LAMM_FLAGS += -DLAMM_DEBUG
endif
ifndef NLA_LLAMA
export LLAMA_LOONGARCH = 1
endif
ifdef FORCE
MK_FORCE = -B
endif
ifdef LAMM_OPT_LEVEL
LAMM_FLAGS += -DLAMM_OPT_LEVEL=$(LAMM_OPT_LEVEL)
else
LAMM_FLAGS += -DLAMM_OPT_LEVEL=3
endif
export LAMM_FLAGS
.PHONY: all
all: benchmark main
.PHONY: benchmark
benchmark: $(SRC_DIR)/loongarch_matmul.o
$(MAKE) -C $(LLAMA_CPP_DIR) la-benchmark-matmult $(MK_FORCE) -j8
.PHONY: main
main: $(SRC_DIR)/loongarch_matmul.o
$(MAKE) -C $(LLAMA_CPP_DIR) main $(MK_FORCE) -j8
cp $(LLAMA_CPP_DIR)/main $(SRC_DIR)/main
$(SRC_DIR)/loongarch_matmul.o:
$(MAKE) -C $(LLAMA_CPP_DIR) lamm
.PHONY: clean
clean:
rm -f $(SRC_DIR)/*.o $(SRC_DIR)/la-benchmark-matmult $(SRC_DIR)/main
.PHONY: format
format:
clang-format -i $(SRC_DIR)/*.h $(SRC_DIR)/*.hpp $(SRC_DIR)/*.cpp