mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
* "build_linux": building for GNU/linux * "build": Building for both linux and windows (cross build) * Place the generate binaries under "binaries/" directory * Improve echo messages
44 lines
1.1 KiB
Makefile
44 lines
1.1 KiB
Makefile
# Simple Make file to build csaf_distribution components
|
|
|
|
SHELL=/bin/bash
|
|
BUILD = go build
|
|
MAKDIR = mkdir -p binaries
|
|
|
|
.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 ./binaries/ -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 GOOS=windows $(BUILD) -o ./binaries/ -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 binaries/
|
|
|
|
|