Skip to content

Commit 82f0cf2

Browse files
authored
Makefile fixes (#322)
* fix deps Signed-off-by: Maroon Ayoub <[email protected]> * restore helper text Signed-off-by: Maroon Ayoub <[email protected]> --------- Signed-off-by: Maroon Ayoub <[email protected]>
1 parent aecee68 commit 82f0cf2

File tree

1 file changed

+35
-26
lines changed

1 file changed

+35
-26
lines changed

Makefile

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ TOKENIZER_LIB = lib/libtokenizers.a
5959
TOKENIZER_VERSION := $(shell grep '^ARG RELEASE_VERSION=' Dockerfile | cut -d'=' -f2)
6060

6161
.PHONY: download-tokenizer
62-
download-tokenizer: $(TOKENIZER_LIB) ## Download HuggingFace tokenizer
62+
download-tokenizer: $(TOKENIZER_LIB)
6363
$(TOKENIZER_LIB):
6464
## Download the HuggingFace tokenizer bindings.
6565
@echo "Downloading HuggingFace tokenizer bindings for version $(TOKENIZER_VERSION)..."
@@ -70,7 +70,7 @@ $(TOKENIZER_LIB):
7070
##@ Development
7171

7272
.PHONY: clean
73-
clean: ## Clean HuggingFace tokenizer from file system
73+
clean:
7474
go clean -testcache -cache
7575
rm -f $(TOKENIZER_LIB)
7676
rmdir lib
@@ -84,12 +84,12 @@ format: ## Format Go source files
8484
test: test-unit test-e2e ## Run unit tests and e2e tests
8585

8686
.PHONY: test-unit
87-
test-unit: download-tokenizer download-zmq ## Run unit tests
87+
test-unit: download-tokenizer install-dependencies ## Run unit tests
8888
@printf "\033[33;1m==== Running Unit Tests ====\033[0m\n"
8989
go test -ldflags="$(LDFLAGS)" -v $$(echo $$(go list ./... | grep -v /test/))
9090

9191
.PHONY: test-integration
92-
test-integration: download-tokenizer download-zmq ## Run integration tests
92+
test-integration: download-tokenizer install-dependencies ## Run integration tests
9393
@printf "\033[33;1m==== Running Integration Tests ====\033[0m\n"
9494
go test -ldflags="$(LDFLAGS)" -v -tags=integration_tests ./test/integration/
9595

@@ -112,7 +112,7 @@ lint: check-golangci-lint check-typos ## Run lint
112112
##@ Build
113113

114114
.PHONY: build
115-
build: check-go download-zmq download-tokenizer ## Build the project
115+
build: check-go install-dependencies download-tokenizer ## Build the project
116116
@printf "\033[33;1m==== Building ====\033[0m\n"
117117
go build -ldflags="$(LDFLAGS)" -o bin/epp cmd/epp/main.go
118118

@@ -371,34 +371,43 @@ clean-env-dev-kubernetes: check-kubectl check-kustomize check-envsubst
371371
@CLEAN=true ./scripts/kubernetes-dev-env.sh 2>&1
372372
@echo "INFO: Finished cleanup of development environment for namespace $(NAMESPACE)"
373373

374-
##@ ZMQ Setup
374+
##@ Dependencies
375375

376-
.PHONY: download-zmq
377-
download-zmq: ## Install ZMQ dependencies based on OS/ARCH
378-
@echo "Checking if ZMQ is already installed..."
379-
@if pkg-config --exists libzmq; then \
380-
echo "✅ ZMQ is already installed."; \
381-
else \
382-
echo "Installing ZMQ dependencies..."; \
383-
if [ "$(TARGETOS)" = "linux" ]; then \
384-
if [ -x "$$(command -v apt)" ]; then \
385-
apt update && apt install -y libzmq3-dev; \
386-
elif [ -x "$$(command -v dnf)" ]; then \
387-
dnf install -y zeromq-devel; \
376+
.PHONY: install-dependencies
377+
install-dependencies: ## Install development dependencies based on OS/ARCH
378+
@echo "Checking and installing development dependencies..."
379+
@if [ "$(TARGETOS)" = "linux" ]; then \
380+
if [ -x "$$(command -v apt)" ]; then \
381+
if ! dpkg -s libzmq3-dev >/dev/null 2>&1 || ! dpkg -s g++ >/dev/null 2>&1; then \
382+
echo "Installing dependencies with apt..."; \
383+
apt-get update && apt-get install -y libzmq3-dev g++; \
384+
else \
385+
echo "✅ ZMQ and g++ are already installed."; \
386+
fi; \
387+
elif [ -x "$$(command -v dnf)" ]; then \
388+
if ! dnf -q list installed zeromq-devel >/dev/null 2>&1 || ! dnf -q list installed gcc-c++ >/dev/null 2>&1; then \
389+
echo "Installing dependencies with dnf..."; \
390+
dnf install -y zeromq-devel gcc-c++; \
388391
else \
389-
echo "Unsupported Linux package manager. Install libzmq manually."; \
390-
exit 1; \
392+
echo "✅ ZMQ and gcc-c++ are already installed."; \
391393
fi; \
392-
elif [ "$(TARGETOS)" = "darwin" ]; then \
393-
if [ -x "$$(command -v brew)" ]; then \
394+
else \
395+
echo "Unsupported Linux package manager. Install libzmq and g++/gcc-c++ manually."; \
396+
exit 1; \
397+
fi; \
398+
elif [ "$(TARGETOS)" = "darwin" ]; then \
399+
if [ -x "$$(command -v brew)" ]; then \
400+
if ! brew list zeromq >/dev/null 2>&1; then \
401+
echo "Installing dependencies with brew..."; \
394402
brew install zeromq; \
395403
else \
396-
echo "Homebrew is not installed and is required to install zeromq. Install it from https://brew.sh/"; \
397-
exit 1; \
404+
echo "✅ ZeroMQ is already installed."; \
398405
fi; \
399406
else \
400-
echo "Unsupported OS: $(TARGETOS). Install libzmq manually - check https://zeromq.org/download/ for guidance."; \
407+
echo "Homebrew is not installed and is required to install zeromq. Install it from https://brew.sh/"; \
401408
exit 1; \
402409
fi; \
403-
echo "✅ ZMQ dependencies installed."; \
410+
else \
411+
echo "Unsupported OS: $(TARGETOS). Install development dependencies manually."; \
412+
exit 1; \
404413
fi

0 commit comments

Comments
 (0)