diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..914fc65 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +# Simple Make file to build csaf_distribution components + +SHELL=/bin/bash +BUILD = go build +buildMsg = "Building binaries..." + +.PHONY: build build_win build_tag clean + +all: + @echo choose a target from: build build_win build_tag clean + +# Build all the binaries and place them in the current directory level. +build: + @echo $(buildMsg) + @$(BUILD) -o ./ -v ./cmd/... + +# Build the binaries for windows and place them in the current directory level. +build_win: + @echo $(buildMsg) + @env GOOS=windows $(BUILD) -o ./ -v ./cmd/... + +# Build the binaries from the latest github tag. +TAG = $(shell git tag --sort=-version:refname | head -n 1) +build_tag: +ifeq ($(TAG),) + @echo "No Tag found" +else + @git checkout -q tags/${TAG}; + @echo $(buildMsg) + @$(BUILD) -o ./ -v ./cmd/...; + @env GOOS=windows $(BUILD) -o ./ -v ./cmd/... + @git checkout -q main +endif + +# Remove binary files +clean: + @rm -f csaf_checker csaf_provider csaf_uploader csaf_checker.exe csaf_provider.exe csaf_uploader.exe + + diff --git a/README.md b/README.md index f058e58..e1815ec 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,12 @@ - Clone the repository `git clone https://github.com/csaf-poc/csaf_distribution.git ` - Build Go components - ``` bash - cd csaf_distribution - go build -v ./cmd/... -``` + Makefile supplies the following builds: + - For Linux Systems :`make build` + - For Windows platform: `make build_win` + - Build from the last tag: `make build_tag` + +These places the binares in the current directory. - [Install](http://nginx.org/en/docs/install.html) **nginx** - To configure nginx see [docs/provider-setup.md](docs/provider-setup.md)