BIN_NAME := oc-deploy BIN_OPTS := ################## SOURCES := $(wildcard *.go) $(wildcard */*.go) BIN_DIR = ../bin/ PLUGINS := $(wildcard ../plugins/*/*.go) OBJS := ${PLUGINS:.go=.so} %.so: %.go go build -buildmode=plugin -o $@ $< help: @echo @echo 'Usage:' @echo ' make build Génère les exécutables.' @echo ' make get-deps Dependency download' @echo ' make run BIN_OPTS=... Go run' @echo ' make run_install BIN_OPTS=... Go run' @echo ' make run_uninstall BIN_OPTS=... Go run' @echo ' make exec BIN_OPTS=... exécutable' @echo ' make exec_install BIN_OPTS=... exécutable' @echo ' make exec_uninstall BIN_OPTS=... exécutable' @echo ' make test Test.' @echo ' make test Test' @echo ' make clean Clean the directory tree.' @echo ${BIN_DIR}/${BIN_NAME}: ${SOURCES} $(OBJS) go build -o ${BIN_DIR}/${BIN_NAME} get-deps: @go mod tidy build: ${BIN_DIR}/${BIN_NAME} run: $(OBJS) @go run main.go ${BIN_OPTS} run_generate: $(OBJS) @go run main.go generate ${BIN_OPTS} run_install: $(OBJS) @go run main.go install ${BIN_OPTS} run_uninstall: $(OBJS) @go run main.go uninstall ${BIN_OPTS} exec: ${BIN_DIR}/${BIN_NAME} $(OBJS) @${BIN_DIR}/${BIN_NAME} ${BIN_OPTS} exec_install: ${BIN_DIR}/${BIN_NAME} $(OBJS) @${BIN_DIR}/${BIN_NAME} install ${BIN_OPTS} exec_uninstall: ${BIN_DIR}/${BIN_NAME} $(OBJS) @${BIN_DIR}/${BIN_NAME} uninstall ${BIN_OPTS} clean: @test ! -e ${BIN_DIR}/${BIN_NAME} || rm ${BIN_DIR}/${BIN_NAME} @test ! -e .coverage.out || rm .coverage.out @test ! -e .coverage.html || rm .coverage.html @test ! -e go.sum || rm go.sum @test ! -e .oc-deploy.log || rm .oc-deploy.log @rm -rf workspace_* .PHONY: test test: @go test ./... -coverprofile=.coverage.out -v go tool cover -html=.coverage.out -o .coverage.html