From b2b45db93fd8812a73b2a718cbc28c66880a3bb3 Mon Sep 17 00:00:00 2001 From: ochafik Date: Mon, 15 Apr 2024 18:30:46 +0100 Subject: [PATCH] build: don't use xxd in Makefile (od hackery instead) --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 74db04d07..5f864c935 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,7 @@ BUILD_TARGETS = \ main quantize quantize-stats perplexity imatrix embedding vdot q8dot train-text-from-scratch convert-llama2c-to-ggml \ simple batched batched-bench save-load-state server gguf gguf-split eval-callback llama-bench libllava.a llava-cli baby-llama beam-search \ - retrieval speculative infill tokenize benchmark-matmult parallel finetune export-lora lookahead lookup passkey gritlm tests/test-c.o \ - examples/server/index.html.hpp examples/server/index.js.hpp examples/server/completion.js.hpp examples/server/json-schema-to-grammar.mjs.hpp + retrieval speculative infill tokenize benchmark-matmult parallel finetune export-lora lookahead lookup passkey gritlm tests/test-c.o # Binaries only useful for tests TEST_TARGETS = \ @@ -793,8 +792,10 @@ server: examples/server/server.cpp examples/server/utils.hpp examples/server/htt $(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<) $(CXX) $(CXXFLAGS) $(filter-out %.h %.hpp $<,$^) -Iexamples/server $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LWINSOCK2) +# Portable equivalent of `cd examples/server/public && xxd -i $(notdir $<) ../$(notdir $<).hpp`: examples/server/%.hpp: examples/server/public/% - ( cd examples/server/public && xxd -i $(notdir $<) ../$(notdir $<).hpp ) + @echo "unsigned char $(subst .,_,$(subst -,_,$(notdir $<)))[] = {$(shell cat $< | od -v -t x1 -An | sed -E 's/([0-9a-fA-F]+)/0x\1, /g' )}; \ + unsigned int $(subst .,_,$(subst -,_,$(notdir $<)))_len = $(shell cat $< | wc -c );" > $@ gguf: examples/gguf/gguf.cpp ggml.o $(OBJS) $(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)