Skip to content

Commit

Permalink
Makefile: support DESTDIR and PREFIX
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Jun 15, 2021
1 parent 3ca53f8 commit 434e230
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Files are installed under $(DESTDIR)/$(PREFIX)
PREFIX ?= /usr/local

GO ?= go

TAR ?= tar
Expand Down Expand Up @@ -49,12 +52,17 @@ _output/share/lima/lima-guestagent.Linux-aarch64:

.PHONY: install
install:
cp -av _output/* /usr/local/
if [[ $(shell uname -s ) != Linux && ! -e /usr/local/bin/nerdctl ]]; then ln -sf nerdctl.lima /usr/local/bin/nerdctl; fi
cp -av _output/* "$(DESTDIR)/$(PREFIX)/"
if [[ $(shell uname -s ) != Linux && ! -e "$(DESTDIR)/$(PREFIX)/bin/nerdctl" ]]; then ln -sf nerdctl.lima "$(DESTDIR)/$(PREFIX)/bin/nerdctl"; fi

.PHONY: uninstall
uninstall:
rm -rf /usr/local/bin/{lima,limactl,nerdctl.lima} /usr/local/share/lima /usr/local/share/doc/lima
rm -rf \
"$(DESTDIR)/$(PREFIX)/bin/lima" \
"$(DESTDIR)/$(PREFIX)/bin/limactl" \
"$(DESTDIR)/$(PREFIX)/bin/nerdctl.lima" \
"$(DESTDIR)/$(PREFIX)/share/lima" "$(DESTDIR)/$(PREFIX)/share/doc/lima"
# TODO: remove $(DESTDIR)/$(PREFIX)/bin/nerdctl only when it is a symlink to nerdctl.lima

.PHONY: clean
clean:
Expand Down

0 comments on commit 434e230

Please sign in to comment.