1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Add Makefile for building go components

* Makefile with the following targets
	** build for (linux system)
     	** build_win  (windows system)
     	** build_tag (build from the last tag)
     	** clean  for (removing the binaries)
* Adjust README file
This commit is contained in:
Fadi Abbud 2022-01-17 17:11:15 +01:00
parent c57de75dac
commit 97ca513f9b
2 changed files with 45 additions and 4 deletions

39
Makefile Normal file
View file

@ -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

View file

@ -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)