Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (make file) : add conditional execution of build command and men… #154

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BINARY_NAME=go-fast-cdn
OS_NAME := $(shell uname -s | tr A-Z a-z)
ARCH := $(shell uname -m | tr A-Z a-z | sed 's/^aarch/arm/')
ARCH := $(shell uname -m | tr A-Z a-z | sed 's/^aarch/arm/' | sed 's/^x86_64/amd64/')

prep:
go mod tidy
Expand All @@ -13,9 +13,13 @@ build_ui:
pnpm --dir ./ui build

build_bin:
GOARCH=${ARCH} GOOS=darwin CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-darwin
CC="x86_64-linux-musl-gcc" GOARCH=${ARCH} GOOS=linux CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-linux
ifeq ($(OS_NAME),darwin)
GOARCH=${ARCH} GOOS=darwin CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-darwin
else ifeq ($(OS_NAME),linux)
CC="x86_64-linux-musl-gcc" GOARCH=${ARCH} GOOS=${OS_NAME} CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-${OS_NAME}
else ifeq ($(OS_NAME),windows)
CC="x86_64-w64-mingw32-gcc" GOARCH=${ARCH} GOOS=windows CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-windows
endif

run: build
ifeq ($(OS_NAME),)
Expand Down
Loading