Skip to content

Commit

Permalink
Keep Makefile simple
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoBrigitte committed Dec 1, 2024
1 parent 057b7c0 commit 4039d60
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ NAME := kimsufi-notifier

PKG := ${GROUP}/${NAME}

BUILD_DIR := build
BIN := ${BUILD_DIR}/${NAME}
BIN := ${NAME}

PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)

Expand All @@ -16,23 +15,15 @@ LD_FLAGS := -s -w \
-X github.com/prometheus/common/version.BuildUser=$(shell whoami)@$(shell hostname) \
-X github.com/prometheus/common/version.BuildDate=$(shell date --utc +%FT%T)

all: linux linux-arm darwin darwin-arm
all: build

linux:
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 \
go build -v -o ${BIN}_linux_amd64 -ldflags="${LD_FLAGS}" ${PKG}
build:
CGO_ENABLED=1 \
go build -v -o ${BIN} -ldflags="${LD_FLAGS}" ${PKG}

linux-arm:
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ \
go build -v -o ${BIN}_linux_arm64 -ldflags="-extldflags=-static ${LD_FLAGS}" ${PKG}

darwin:
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 \
go build -v -o ${BIN}_darwin_amd64 -ldflags="${LD_FLAGS}" ${PKG}

darwin-arm:
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 \
go build -v -o ${BIN}_darwin_arm64 -ldflags="${LD_FLAGS}" ${PKG}
go build -v -o ${BIN} -ldflags="-extldflags=-static ${LD_FLAGS}" ${PKG}

install:
GOOS=${OSTYPE} go install -v -ldflags="${LD_FLAGS}" ${PKG}
Expand All @@ -51,6 +42,6 @@ nancy:
go list -json -m all | nancy sleuth

clean:
rm -rf ${BUILD_DIR}
rm -rf ${BIN}

.PHONY: build install test vet lint clean
.PHONY: build linux-arm install test vet lint nancy clean

0 comments on commit 4039d60

Please sign in to comment.