# Makefile for building and packaging ProxLB as an RPM VERSION=1.0.2 REPO_URL=https://github.com/gyptazy/ProxLB.git BUILD_DIR=$(PWD)/build PACKAGE_DIR=$(PWD)/packages REPO_DIR=$(PWD)/ProxLB .PHONY: all clean download prepare build package # Default target all: download prepare build package # Clone the repository if not already cloned download: @if [ ! -d "$(REPO_DIR)" ]; then \ echo "Cloning repository..."; \ git clone $(REPO_URL) $(REPO_DIR); \ fi # Prepare directories prepare: download mkdir -p $(PACKAGE_DIR) mkdir -p $(BUILD_DIR) cd $(REPO_DIR) && git checkout v$(VERSION) # Build the project build: prepare cd $(BUILD_DIR) && cmake $(REPO_DIR)/packaging # Package the project package: build cd $(BUILD_DIR) && cpack -G RPM . cp $(BUILD_DIR)/*.rpm $(PACKAGE_DIR) # Clean up build and package directories clean: rm -rf $(BUILD_DIR) $(PACKAGE_DIR) rm -rf $(REPO_DIR)