-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 1.19 KB
/
Makefile
File metadata and controls
62 lines (47 loc) · 1.19 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
################################################################################
#
# POSIX Makefile
#
################################################################################
# Config #######################################################################
OUT := out
SRCS := \
$(OUT)/c-flags/lib/c-flags.c \
$(OUT)/c-flags/lib/string-view.c \
ullm/llama2.c \
util/log.c \
util/status.c \
sys/file.c \
sys/memory.c \
sys/time.c \
tools/ullm.c
OPT := 2
BIN := ullm
# build ########################################################################
BIN := $(OUT)/$(BIN)
OBJS := $(patsubst %.c, $(OUT)/%.o, $(SRCS))
CFLAGS := \
-I . \
-I out/c-flags/lib \
-std=c99 \
-Wall \
-O$(OPT)
LDFLAGS := \
-lm
.PHONY:
all: $(BIN).elf
size $(BIN).elf
.PHONY:
fetchdeps:
@mkdir -p $(OUT)
cd $(OUT); git clone https://github.com/DieTime/c-flags.git
cd $(OUT); git clone https://github.com/karpathy/llama2.c.git
cd $(OUT); curl -L -O https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
$(BIN).elf: $(OBJS)
cc $(CFLAGS) $^ $(LDFLAGS) -o $@
$(OUT)/%.o: %.c
@mkdir -p $(dir $@)
cc $(CFLAGS) -c $< -o $@
.PHONY:
clean:
rm -rf $(OUT)