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