github.com/wostzone/hub/auth@v0.0.0-20220118060317-7bb375743b17/Makefile (about)

     1  # Makefile to build and test the WoST Hub
     2  # To build including generating certificates: make all
     3  DIST_FOLDER=./dist
     4  INSTALL_HOME=~/bin/wosthub
     5  
     6  .DEFAULT_GOAL := help
     7  
     8  .PHONY: 
     9  
    10  all: auth authservice  ## Build auth and authservice 
    11  
    12  install:  all ## Install the auth app 
    13  	mkdir -p $(INSTALL_HOME)/bin
    14  	mkdir -p $(INSTALL_HOME)/config
    15  	mkdir -p $(INSTALL_HOME)/logs
    16  	cp $(DIST_FOLDER)/bin/* $(INSTALL_HOME)/bin
    17  	#cp -n $(DIST_FOLDER)/config/* $(INSTALL_HOME)/config/  
    18  
    19  dist: clean   ## Build binary distribution tarball 
    20  		tar -czf $(PKG_NAME) -C $(DIST_FOLDER) .
    21  
    22  test: all .PHONY ## Run tests sequentially
    23  	go test -failfast -p 1 -v ./...
    24  
    25  clean: ## Clean distribution files
    26  	go mod tidy
    27  	go clean
    28  	rm -f test/certs/*
    29  	rm -f test/logs/*
    30  	rm -f $(DIST_FOLDER)/bin/*
    31  	rm -f debug $(PKG_NAME)
    32  	mkdir -p $(DIST_FOLDER)/bin
    33  	mkdir -p $(DIST_FOLDER)/config
    34  
    35  auth: ## Build authentication CLI to generate certificates, set password and set ACLs
    36  	mkdir -p $(DIST_FOLDER)/bin
    37  	go build -o $(DIST_FOLDER)/bin/$@ ./cmd/$@/main.go
    38  	@echo "> SUCCESS. The executable '$@' can be found in $(DIST_FOLDER)/bin/$@"
    39  
    40  
    41  authservice: ## Build authentication service to run at startup
    42  	go build -o $(DIST_FOLDER)/bin/$@ ./cmd/$@/main.go
    43  	 
    44  
    45  upgrade:
    46  	go get -u all
    47  	go mod tidy
    48  
    49  help: ## Show this help
    50  	@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
    51