Skip to content

Commit 05fa4f3

Browse files
committed
Refactor package structure
1 parent 988c9ec commit 05fa4f3

File tree

202 files changed

+2025
-1330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+2025
-1330
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ MAKEFLAGS += --no-builtin-rules
1111
include build/config.mk
1212
include build/rules.mk
1313

14+
include third_party/BUILD.mk
1415
include llamafile/BUILD.mk
1516
include llama.cpp/BUILD.mk
1617
include stable-diffusion.cpp/BUILD.mk
1718
include whisper.cpp/BUILD.mk
18-
include double-conversion/BUILD.mk
19-
include stb/BUILD.mk
2019

2120
# the root package is `o//` by default
2221
# building a package also builds its sub-packages
@@ -25,7 +24,7 @@ o/$(MODE)/: o/$(MODE)/llamafile \
2524
o/$(MODE)/llama.cpp \
2625
o/$(MODE)/stable-diffusion.cpp \
2726
o/$(MODE)/whisper.cpp \
28-
o/$(MODE)/stb \
27+
o/$(MODE)/third_party \
2928
o/$(MODE)/depend.test
3029

3130
# for installing to `make PREFIX=/usr/local`

llama.cpp/llava/BUILD.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ o/$(MODE)/llama.cpp/llava/llava-quantize: \
1616
o/$(MODE)/llama.cpp/llava/llava-quantize.1.asc.zip.o \
1717
o/$(MODE)/llama.cpp/llava/llava.a \
1818
o/$(MODE)/llama.cpp/llama.cpp.a \
19-
o/$(MODE)/stb/stb.a
19+
o/$(MODE)/third_party/stb/stb.a
2020

2121
$(LLAMA_CPP_LLAVA_OBJS): llama.cpp/llava/BUILD.mk
2222

llama.cpp/llava/clip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "llama.cpp/ggml-metal.h"
1414
#include "llama.cpp/string.h"
1515

16-
#include "stb/stb_image.h"
16+
#include "third_party/stb/stb_image.h"
1717

1818
#include <cassert>
1919
#include <cmath>

llama.cpp/main/BUILD.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ o/$(MODE)/llama.cpp/main/main: \
1414
o/$(MODE)/llama.cpp/server/server.a \
1515
o/$(MODE)/llama.cpp/llava/llava.a \
1616
o/$(MODE)/llama.cpp/llama.cpp.a \
17-
o/$(MODE)/stb/stb.a \
17+
o/$(MODE)/llamafile/highlight/highlight.a \
18+
o/$(MODE)/third_party/stb/stb.a \
1819
o/$(MODE)/llama.cpp/main/main.1.asc.zip.o \
1920
$(LLAMA_CPP_SERVER_ASSETS:%=o/$(MODE)/%.zip.o)
2021

llama.cpp/server/server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "llama.cpp/llama.h"
66
#include "llama.cpp/grammar-parser.h"
77
#include "llama.cpp/llava/llava.h"
8-
#include "stb/stb_image.h"
8+
#include "third_party/stb/stb_image.h"
99
#include "utils.h"
1010
#include "oai.h"
1111
#include "llamafile/micros.h"

llamafile/BUILD.mk

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,21 @@ LLAMAFILE_INCS = $(filter %.inc,$(LLAMAFILE_FILES))
99
LLAMAFILE_SRCS_C = $(filter %.c,$(LLAMAFILE_FILES))
1010
LLAMAFILE_SRCS_CU = $(filter %.cu,$(LLAMAFILE_FILES))
1111
LLAMAFILE_SRCS_CPP = $(filter %.cpp,$(LLAMAFILE_FILES))
12-
LLAMAFILE_SRCS_GPERF = $(filter %.gperf,$(LLAMAFILE_FILES))
13-
LLAMAFILE_SRCS_GPERF_C = $(LLAMAFILE_SRCS_GPERF:%.gperf=o/$(MODE)/%.c)
14-
LLAMAFILE_SRCS = $(LLAMAFILE_SRCS_C) $(LLAMAFILE_SRCS_CPP) $(LLAMAFILE_SRCS_CU) $(LLAMAFILE_SRCS_GPERF)
12+
LLAMAFILE_SRCS = $(LLAMAFILE_SRCS_C) $(LLAMAFILE_SRCS_CPP) $(LLAMAFILE_SRCS_CU)
1513
LLAMAFILE_DOCS = $(filter %.1,$(LLAMAFILE_FILES))
1614

1715
LLAMAFILE_OBJS := \
1816
$(LLAMAFILE_SRCS_C:%.c=o/$(MODE)/%.o) \
1917
$(LLAMAFILE_SRCS_CPP:%.cpp=o/$(MODE)/%.o) \
2018
$(LLAMAFILE_FILES:%=o/$(MODE)/%.zip.o) \
21-
$(LLAMAFILE_SRCS_GPERF_C:%.c=%.o) \
2219

2320
$(LLAMAFILE_OBJS): private CCFLAGS += -g
2421

2522
# this executable defines its own malloc(), free(), etc.
2623
# therefore we want to avoid it going inside the .a file
2724
LLAMAFILE_OBJS := $(filter-out o/$(MODE)/llamafile/zipalign.o,$(LLAMAFILE_OBJS))
2825

26+
include llamafile/highlight/BUILD.mk
2927
include llamafile/server/BUILD.mk
3028

3129
o/$(MODE)/llamafile/zipalign: \
@@ -57,9 +55,6 @@ o/$(MODE)/llamafile: \
5755
o/$(MODE)/llamafile/addnl \
5856
o/$(MODE)/llamafile/high \
5957
o/$(MODE)/llamafile/datauri_test.runs \
60-
o/$(MODE)/llamafile/highlight_c_test.runs \
61-
o/$(MODE)/llamafile/highlight_python_test.runs \
62-
o/$(MODE)/llamafile/highlight_test.runs \
6358
o/$(MODE)/llamafile/parse_cidr_test.runs \
6459
o/$(MODE)/llamafile/pool_cancel_test.runs \
6560
o/$(MODE)/llamafile/pool_test.runs \
@@ -170,34 +165,15 @@ o/$(MODE)/llamafile/pool_test: \
170165
o/$(MODE)/llamafile/crash.o \
171166
o/$(MODE)/llamafile/pool.o \
172167

173-
o/$(MODE)/llamafile/highlight_test: \
174-
o/$(MODE)/llamafile/highlight_test.o \
175-
o/$(MODE)/llama.cpp/llama.cpp.a \
176-
177-
o/$(MODE)/llamafile/highlight_c_test: \
178-
o/$(MODE)/llamafile/highlight_c_test.o \
179-
o/$(MODE)/llamafile/highlight_c.o \
180-
o/$(MODE)/llamafile/is_keyword_c.o \
181-
o/$(MODE)/llamafile/is_keyword_c_constant.o \
182-
o/$(MODE)/llamafile/is_keyword_c_type.o \
183-
o/$(MODE)/llamafile/is_keyword_c_pod.o \
184-
o/$(MODE)/llamafile/is_keyword_cpp.o \
185-
186-
o/$(MODE)/llamafile/highlight_python_test: \
187-
o/$(MODE)/llamafile/highlight_python_test.o \
188-
o/$(MODE)/llamafile/highlight_python.o \
189-
o/$(MODE)/llamafile/is_keyword_python.o \
190-
o/$(MODE)/llamafile/is_keyword_python_builtin.o \
191-
o/$(MODE)/llamafile/is_keyword_python_constant.o \
192-
193168
o/$(MODE)/llamafile/datauri_test: \
194169
o/$(MODE)/llamafile/datauri_test.o \
195170
o/$(MODE)/llama.cpp/llama.cpp.a \
196-
o/$(MODE)/stb/stb.a \
171+
o/$(MODE)/third_party/stb/stb.a \
197172

198-
o/$(MODE)/llamafile/high: \
199-
o/$(MODE)/llamafile/high.o \
200-
o/$(MODE)/llama.cpp/llama.cpp.a \
173+
o/$(MODE)/llamafile/high: \
174+
o/$(MODE)/llamafile/high.o \
175+
o/$(MODE)/llamafile/highlight/highlight.a \
176+
o/$(MODE)/llama.cpp/llama.cpp.a \
201177

202178
o/$(MODE)/llamafile/hex2xterm: \
203179
o/$(MODE)/llamafile/hex2xterm.o \
@@ -257,5 +233,4 @@ o/$(MODE)/llamafile/pick_a_warp_kernel.o: private CFLAGS += -fopenmp
257233

258234
.PHONY: o/$(MODE)/llamafile/check
259235
o/$(MODE)/llamafile/check: \
260-
$(LLAMAFILE_SRCS_GPERF_C) \
261236
o/$(MODE)/llamafile/tinyblas_test.runs

llamafile/chatbot_repl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "llama.cpp/llama.h"
2727
#include "llamafile/bestline.h"
2828
#include "llamafile/color.h"
29-
#include "llamafile/highlight.h"
29+
#include "llamafile/highlight/highlight.h"
3030
#include "llamafile/llama.h"
3131

3232
namespace lf {

llamafile/high.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
#include "highlight.h"
18+
#include "llamafile/highlight/highlight.h"
1919
#include "string.h"
2020
#include <fcntl.h>
2121
#include <stdio.h>

0 commit comments

Comments
 (0)