2019-03-01 03:47:50 +08:00
|
|
|
.PHONY: dist dist-win dist-macos dist-linux ensure-dist-dir build install uninstall
|
|
|
|
|
|
|
|
GOBUILD=go build -ldflags="-s -w"
|
|
|
|
INSTALLPATH=/usr/local/bin
|
|
|
|
|
|
|
|
ensure-dist-dir:
|
|
|
|
@- mkdir -p dist
|
|
|
|
|
|
|
|
dist-win: ensure-dist-dir
|
|
|
|
# Build for Windows x64
|
2019-03-01 04:03:45 +08:00
|
|
|
GOOS=windows GOARCH=amd64 $(GOBUILD) -o dist/e6dl-windows-amd64.exe src/*.go
|
2019-03-01 03:47:50 +08:00
|
|
|
|
|
|
|
dist-macos: ensure-dist-dir
|
|
|
|
# Build for macOS x64
|
2019-03-01 04:03:45 +08:00
|
|
|
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o dist/e6dl-darwin-amd64 src/*.go
|
2019-03-01 03:47:50 +08:00
|
|
|
|
|
|
|
dist-linux: ensure-dist-dir
|
|
|
|
# Build for Linux x64
|
2019-03-01 04:03:45 +08:00
|
|
|
GOOS=linux GOARCH=amd64 $(GOBUILD) -o dist/e6dl-linux-amd64 src/*.go
|
2019-03-01 03:47:50 +08:00
|
|
|
|
|
|
|
dist: dist-win dist-macos dist-linux
|
|
|
|
|
|
|
|
build:
|
|
|
|
@- mkdir -p bin
|
2019-03-01 04:03:45 +08:00
|
|
|
$(GOBUILD) -o bin/e6dl src/*.go
|
2019-03-01 03:47:50 +08:00
|
|
|
@- chmod +x bin/e6dl
|
|
|
|
|
|
|
|
install: build
|
|
|
|
mv bin/e6dl $(INSTALLPATH)/e6dl
|
|
|
|
@- rm -rf bin
|
|
|
|
@echo "e6dl was installed to $(INSTALLPATH)/e6dl. Run make uninstall to get rid of it, or just remove the binary yourself."
|
|
|
|
|
|
|
|
uninstall:
|
2019-03-01 08:58:48 +08:00
|
|
|
rm $(INSTALLPATH)/e6dl
|
|
|
|
|
|
|
|
run:
|
|
|
|
@- go run src/*.go
|