From 83d3304dcd904bac45db6ec9a024a86d20bc9634 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 1 Aug 2022 21:06:31 +0700 Subject: all: simplify make tasks Instead of separating different build directory for OS, use single _bin directory. If we want to build for different OS/arch, can set the GOOS and GOARCH environment variables before running make. --- .gitignore | 3 +-- Makefile | 24 +++++++----------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 591ef4f..ff0fbbd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ ## SPDX-License-Identifier: GPL-3.0-or-later /ciigo /ciigo-example -/_bin/ciigo-darwin-amd64 -/_bin/ciigo-linux-amd64 +/_bin *.html diff --git a/Makefile b/Makefile index 40b749c..14a4c4d 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,12 @@ ## SPDX-FileCopyrightText: 2019 Shulhan ## SPDX-License-Identifier: GPL-3.0-or-later -RELEASES:= \ - _bin/ciigo-linux-amd64 \ - _bin/ciigo-darwin-amd64 - -.PHONY: all lint test install serve build build-release +.PHONY: all lint test install build .FORCE: -all: test lint +DIR_BUILD=_bin + +all: test lint build lint: golangci-lint run ./... @@ -23,14 +21,6 @@ install: run-example: DEBUG=1 go run ./cmd/ciigo-example -build-release: $(RELEASES) - -_bin/ciigo-linux-amd64: .FORCE -_bin/ciigo-linux-amd64: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ - go build -o $@ ./cmd/ciigo - -_bin/ciigo-darwin-amd64: .FORCE -_bin/ciigo-darwin-amd64: - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \ - go build -o $@ ./cmd/ciigo +build: + mkdir -p $(DIR_BUILD) + CGO_ENABLED=0 go build -o $(DIR_BUILD) ./cmd/... -- cgit v1.3