mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Merge pull request #30 from csaf-poc/makefile-for-build
Add Makefile for building go components
This commit is contained in:
commit
1d8b4c4c5a
2 changed files with 51 additions and 4 deletions
44
Makefile
Normal file
44
Makefile
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Simple Make file to build csaf_distribution components
|
||||||
|
|
||||||
|
SHELL=/bin/bash
|
||||||
|
BUILD = go build
|
||||||
|
MKDIR = mkdir -p bin
|
||||||
|
|
||||||
|
.PHONY: build build_win build_tag clean
|
||||||
|
|
||||||
|
all:
|
||||||
|
@echo choose a target from: build build_linux build_win build_tag clean
|
||||||
|
|
||||||
|
# Build the binaries for GNU/linux and place them under binaries/ directory.
|
||||||
|
build_linux:
|
||||||
|
@$(MKDIR)
|
||||||
|
@echo "Bulding binaries for GNU/Linux ..."
|
||||||
|
@$(BUILD) -o ./bin/ -v ./cmd/...
|
||||||
|
|
||||||
|
# Build the binaries for windows (cross build) and place them under binaries/ directory.
|
||||||
|
build_win:
|
||||||
|
@$(MKDIR)
|
||||||
|
@echo "Bulding binaries for windows (cross build) ..."
|
||||||
|
@env GOARCH=amd64 GOOS=windows $(BUILD) -o ./bin/ -v ./cmd/...
|
||||||
|
|
||||||
|
# Build the binaries for both GNU/linux and Windows and place them under binaries/ directory.
|
||||||
|
build: build_linux build_win
|
||||||
|
|
||||||
|
# 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 ./binaries/ -v ./cmd/...;
|
||||||
|
@env GOOS=windows $(BUILD) -o ./ -v ./cmd/...
|
||||||
|
@git checkout -q main
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Remove binaries directory
|
||||||
|
clean:
|
||||||
|
@rm -rf bin/
|
||||||
|
|
||||||
|
|
||||||
11
README.md
11
README.md
|
|
@ -10,10 +10,13 @@
|
||||||
- Clone the repository `git clone https://github.com/csaf-poc/csaf_distribution.git `
|
- Clone the repository `git clone https://github.com/csaf-poc/csaf_distribution.git `
|
||||||
|
|
||||||
- Build Go components
|
- Build Go components
|
||||||
``` bash
|
Makefile supplies the following targets:
|
||||||
cd csaf_distribution
|
- Build For GNU/Linux System: `make build_linux`
|
||||||
go build -v ./cmd/...
|
- Build For Windows System (cross build): `make build_win`
|
||||||
```
|
- Build For both linux and windows: `make build`
|
||||||
|
- Build from the last github-tag: `make build_tag`
|
||||||
|
|
||||||
|
These places the binaries under `bin/` directory.
|
||||||
|
|
||||||
- [Install](http://nginx.org/en/docs/install.html) **nginx**
|
- [Install](http://nginx.org/en/docs/install.html) **nginx**
|
||||||
- To configure nginx see [docs/provider-setup.md](docs/provider-setup.md)
|
- To configure nginx see [docs/provider-setup.md](docs/provider-setup.md)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue