Skip to content

Commit 9d51600

Browse files
committed
Makefile: Simplify Makefile.unikernel
Move file generation rules (.config, model.h, tokenizer.h) out of `Makefile.unikernel` and into `Makefile`. This simplifies `Makefile.unikernel` making it Unikraft-specific. And making it easy to reuse as part of `make -f Makefile.unikraft ...` rules. Signed-off-by: Razvan Deaconescu <[email protected]>
1 parent ba202b0 commit 9d51600

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ run_clang_static_strlit: ## - Optimized Static clang + embedded model build
201201
./strlit -i emb_Model_data $(MOD_PATH) model.h
202202
./strlit -i emb_Tokenizer_data $(TOK_PATH) tokenizer.h
203203
clang -Ofast -static -march=native -D STRLIT -D LLOOP run.c -lm -o run
204+
205+
# Unikraft Unikernel build
206+
.PHONY: run_unik_qemu_x86_64
207+
run_unik_qemu_x86_64: run.c
208+
[ ! -d "UNIK" ] && echo "Cloning unikraft and musl sources..." || true
209+
[ ! -d "UNIK/unikraft" ] && git clone https://github.com/unikraft/unikraft UNIK/unikraft || true
210+
[ ! -d "UNIK/libs/musl" ] && git clone https://github.com/unikraft/lib-musl UNIK/libs/musl || true
211+
UK_DEFCONFIG=$(shell pwd)/defconfigs/qemu-x86_64 make -f Makefile.unikernel defconfig
212+
gcc -Ofast strliteral.c -o strlit
213+
./strlit -i emb_Model_data $(MOD_PATH) model.h
214+
./strlit -i emb_Tokenizer_data $(TOK_PATH) tokenizer.h
215+
make -f Makefile.unikernel
204216

205217
# Build for termux on Android
206218
##@ ---> Android

Makefile.unikernel

-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
UK_ROOT ?= $(PWD)/UNIK/unikraft
22
UK_LIBS ?= $(PWD)/UNIK/libs
33
LIBS := $(UK_LIBS)/musl
4-
# Model / Tokenizer Paths
5-
MOD_PATH = out/model.bin
6-
TOK_PATH = tokenizer.bin
74

85
all:
9-
UK_DEFCONFIG=$(shell pwd)/defconfigs/qemu-x86_64 make -f Makefile.unikernel defconfig
10-
gcc -Ofast strliteral.c -o strlit
11-
./strlit -i emb_Model_data $(MOD_PATH) model.h
12-
./strlit -i emb_Tokenizer_data $(TOK_PATH) tokenizer.h
136
@$(MAKE) -C $(UK_ROOT) A=$(PWD) L=$(LIBS)
147

158
$(MAKECMDGOALS):

0 commit comments

Comments
 (0)