|
1 | 1 | # Define the default target now so that it is always the first target
|
2 |
| -BUILD_TARGETS = main quantize quantize-stats perplexity embedding vdot train-text-from-scratch simple server libembdinput.so embd-input-test |
| 2 | +BUILD_TARGETS = main quantize quantize-stats perplexity embedding vdot train-text-from-scratch simple server embd-input-test |
3 | 3 |
|
4 | 4 | default: $(BUILD_TARGETS)
|
5 | 5 |
|
@@ -90,6 +90,28 @@ ifeq ($(UNAME_S),Haiku)
|
90 | 90 | CXXFLAGS += -pthread
|
91 | 91 | endif
|
92 | 92 |
|
| 93 | +# detect Windows |
| 94 | +ifneq ($(findstring _NT,$(UNAME_S)),) |
| 95 | + _WIN32 := 1 |
| 96 | +endif |
| 97 | + |
| 98 | +# library name prefix |
| 99 | +ifneq ($(_WIN32),1) |
| 100 | + LIB_PRE := lib |
| 101 | +endif |
| 102 | + |
| 103 | +# Dynamic Shared Object extension |
| 104 | +ifneq ($(_WIN32),1) |
| 105 | + DSO_EXT := .so |
| 106 | +else |
| 107 | + DSO_EXT := .dll |
| 108 | +endif |
| 109 | + |
| 110 | +# Windows Sockets 2 (Winsock) for network-capable apps |
| 111 | +ifeq ($(_WIN32),1) |
| 112 | + LWINSOCK2 := -lws2_32 |
| 113 | +endif |
| 114 | + |
93 | 115 | ifdef LLAMA_GPROF
|
94 | 116 | CFLAGS += -pg
|
95 | 117 | CXXFLAGS += -pg
|
@@ -294,7 +316,7 @@ libllama.so: llama.o ggml.o $(OBJS)
|
294 | 316 | $(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
|
295 | 317 |
|
296 | 318 | clean:
|
297 |
| - rm -vf *.o *.so main quantize quantize-stats perplexity embedding benchmark-matmult save-load-state server simple vdot train-text-from-scratch embd-input-test build-info.h |
| 319 | + rm -vf *.o *.so *.dll main quantize quantize-stats perplexity embedding benchmark-matmult save-load-state server simple vdot train-text-from-scratch embd-input-test build-info.h |
298 | 320 |
|
299 | 321 | #
|
300 | 322 | # Examples
|
@@ -325,14 +347,14 @@ save-load-state: examples/save-load-state/save-load-state.cpp build-info.h ggml.
|
325 | 347 | $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
326 | 348 |
|
327 | 349 | server: examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp build-info.h ggml.o llama.o common.o $(OBJS)
|
328 |
| - $(CXX) $(CXXFLAGS) -Iexamples/server $(filter-out %.h,$(filter-out %.hpp,$^)) -o $@ $(LDFLAGS) |
| 350 | + $(CXX) $(CXXFLAGS) -Iexamples/server $(filter-out %.h,$(filter-out %.hpp,$^)) -o $@ $(LDFLAGS) $(LWINSOCK2) |
329 | 351 |
|
330 |
| -libembdinput.so: examples/embd-input/embd-input.h examples/embd-input/embd-input-lib.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
| 352 | +$(LIB_PRE)embdinput$(DSO_EXT): examples/embd-input/embd-input.h examples/embd-input/embd-input-lib.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
331 | 353 | $(CXX) --shared $(CXXFLAGS) $(filter-out %.h,$(filter-out %.hpp,$^)) -o $@ $(LDFLAGS)
|
332 | 354 |
|
333 | 355 |
|
334 |
| -embd-input-test: libembdinput.so examples/embd-input/embd-input-test.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
335 |
| - $(CXX) $(CXXFLAGS) $(filter-out %.so,$(filter-out %.h,$(filter-out %.hpp,$^))) -o $@ $(LDFLAGS) -L. -lembdinput |
| 356 | +embd-input-test: $(LIB_PRE)embdinput$(DSO_EXT) examples/embd-input/embd-input-test.cpp build-info.h ggml.o llama.o common.o $(OBJS) |
| 357 | + $(CXX) $(CXXFLAGS) $(filter-out %$(DSO_EXT),$(filter-out %.h,$(filter-out %.hpp,$^))) -o $@ $(LDFLAGS) -L. -lembdinput |
336 | 358 |
|
337 | 359 | train-text-from-scratch: examples/train-text-from-scratch/train-text-from-scratch.cpp build-info.h ggml.o llama.o $(OBJS)
|
338 | 360 | $(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
|
|
0 commit comments