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(Makefile): GO variable, several improvements #398

Merged
merged 1 commit into from
Sep 12, 2024
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
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
PREFIX=/usr/
DESTDIR=/
BINARY_NAME=apx
PREFIX := /usr
DESTDIR := /
BINARY_NAME := apx

all: build
GO := go

build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ${BINARY_NAME}
all: clean build

build: ${BINARY_NAME}

${BINARY_NAME}:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ${GO} build -a -tags netgo -ldflags '-w -extldflags "-static"' -o $@
axtloss marked this conversation as resolved.
Show resolved Hide resolved

install: build
install -Dm755 ${BINARY_NAME} ${DESTDIR}${PREFIX}/bin/${BINARY_NAME}
Expand All @@ -22,7 +26,7 @@ install-manpages:
chmod 644 ${DESTDIR}${PREFIX}/share/man/man1/apx*

uninstall: uninstall-manpages
rm ${DESTDIR}${PREFIX}/bin/apx
rm ${DESTDIR}${PREFIX}/bin/${BINARY_NAME}
rm -rf ${DESTDIR}/etc/apx
rm -rf ${DESTDIR}${PREFIX}/share/apx

Expand All @@ -31,4 +35,4 @@ uninstall-manpages:

clean:
rm -f ${BINARY_NAME}
go clean
${GO} clean