diff --git a/.gitignore b/.gitignore index d9a9ed6..0afa3e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ macvdmtool +*.o diff --git a/Makefile b/Makefile index 202cb1c..fe0b38b 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,23 @@ CXXFLAGS := -std=c++14 -LDFLAGS := -framework CoreFoundation -framework IOKit -lc++ +LDFLAGS := -framework CoreFoundation -framework IOKit OBJS := main.o -all: macvdmtool +PREFIX ?= /usr/local +DESTDIR ?= -macvdmtool: $(OBJS) - cc -o $@ $(OBJS) $(LDFLAGS) +INSTALL := /usr/bin/install -ifeq ($(PREFIX),) - PREFIX := /usr/local -endif +all: macvdmtool -INSTALL := /usr/bin/install +macvdmtool: $(OBJS) + $(CXX) -o $@ $(OBJS) $(LDFLAGS) .PHONY: install install: macvdmtool - @sudo $(INSTALL) -d "$(PREFIX)/bin/" - @sudo $(INSTALL) -m 755 -o root -g wheel "$(<)" "$(PREFIX)/bin/" + $(INSTALL) -d "$(DESTDIR)$(PREFIX)/bin" + $(INSTALL) -m 755 "$(<)" "$(DESTDIR)$(PREFIX)/bin" + +.PHONY: clean +clean: + rm -f $(OBJS) macvdmtool