Skip to content

Commit

Permalink
GNUMakefile: use go build -trimpath
Browse files Browse the repository at this point in the history
To fix build with go.mod file present. This change also simplifies the
entire build process significantly.
  • Loading branch information
nmeum committed Feb 22, 2021
1 parent 8c4711f commit f3fe972
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@ BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
DOCDIR ?= $(PREFIX)/share/doc/$(NAME)

IMPORTPATH = src/github.com/nmeum/$(NAME)
export GOPATH = $(CURDIR)

$(NAME): $(IMPORTPATH)
cd $< && env PWD="$(CURDIR)/$<" go build -o $@
$(IMPORTPATH): $(GOPATH)
mkdir -p $(shell dirname $@)
ln -fs $< $@
$(NAME):
go build -trimpath -o $@

install: $(NAME) $(NAME).1 README.md
install -Dm755 $(NAME) "$(DESTDIR)$(BINDIR)/$(NAME)"
Expand Down

0 comments on commit f3fe972

Please sign in to comment.