This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
65 lines (53 loc) · 2.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
APP = pygore
SHELL = /bin/bash
DIR = $(shell pwd)
LIBGORE_VERSION = $(shell cat libgore.version)
REPO_URL=https://joakimkennedy.keybase.pub/gore-test
# MIRROR_URL=https://joakimkennedy.keybase.pub/libgore-mirror
# DARWIN_URL=$(MIRROR_URL)/libgore-v$(LIBGORE_VERSION)-darwin-amd64.tar.gz
DARWIN_URL=https://github.com/goretk/libgore/releases/download/v$(LIBGORE_VERSION)/libgore-v$(LIBGORE_VERSION)-darwin-amd64.tar.gz
# LINUX_URL=$(MIRROR_URL)/libgore-v$(LIBGORE_VERSION)-linux-amd64.tar.gz
LINUX_URL=https://github.com/goretk/libgore/releases/download/v$(LIBGORE_VERSION)/libgore-v$(LIBGORE_VERSION)-linux-amd64.tar.gz
# WINDOWS_URL=$(MIRROR_URL)/libgore-v$(LIBGORE_VERSION)-windows.zip
WINDOWS_URL=https://github.com/goretk/libgore/releases/download/v$(LIBGORE_VERSION)/libgore-v$(LIBGORE_VERSION)-windows.zip
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
MAKE_COLOR=\033[33;01m%-20s\033[0m
PYTHON=python3
BUILD_OPTS=bdist_wheel
LIBGORE_FILES={libgore.so,libgore.dll,libgore.dylib}
.DEFAULT_GOAL := help
.PHONY: help
help:
@echo -e "$(OK_COLOR)==== $(APP) [$(VERSION)] ====$(NO_COLOR)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(MAKE_COLOR) : %s\n", $$1, $$2}'
.PHONY: build
build: ## Build pip package
@echo -e "Building $(OK_COLOR)[$(APP)] package $(NO_COLOR)"
@$(PYTHON) ./setup.py $(BUILD_OPTS)
.PHONY: clean
clean: ## Remove folders created by build
@rm -rfv build/ dist/ pygore.egg-info/ pygore/$(LIBGORE_FILES) dltmp
.PHONY: deploy_local
deploy_local: ## Deploy local libgore files
@cp -v $(LIBGORE)/$(LIBGORE_FILES) pygore/.
.PHONY: upload
upload: ## Upload package to pypi
@twine upload dist/*
.PHONY: download
download: ## Download latest release of libgore
@mkdir -p dltmp
@curl -sL $(LINUX_URL) | bsdtar -xvf - -C dltmp
@curl -sL $(DARWIN_URL) | bsdtar -xvf - -C dltmp
@curl -sL $(WINDOWS_URL) | bsdtar -xvf - -C dltmp
@cp -v dltmp/*/$(LIBGORE_FILES) pygore/.
.PHONY: fetch_data
fetch_data: ## Fetch test resources
@mkdir -p test/resources
@curl -o test/resources/golden -# -L $(REPO_URL)/gold-linux-amd64-1.12.0
@curl -o test/resources/bettercap -# -L $(REPO_URL)/bettercap
.PHONY: test
test: ## Run tests
@$(PYTHON) -m unittest discover -v -s test -t .