forked from danielpaulus/go-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 1.46 KB
/
Copy pathMakefile
File metadata and controls
49 lines (39 loc) · 1.46 KB
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
# Makefile to build and run go-ios and the cdc-ncm network driver
# cdc-ncm needs to be executed with sudo on Linux for USB Access and setting
# up virtual TAP network devices.
# use Make build to build both binaries.
# Make run is a simple target that just runs the cdc-ncm driver with sudo
# For development, use "make up" to rebuild and run cdc-ncm quickly
# Name of your Go binaries
GO_IOS_BINARY_NAME=ios
NCM_BINARY_NAME=go-ncm
# Define only if compiling for system different than our own
OS=
ARCH=
# Prepend each non-empty OS/ARCH definition to "go" command
GOEXEC=$(strip $(foreach v,OS ARCH,$(and $($v),GO$v=$($v) )) go)
# Build the Go program
build:
@$(GOEXEC) work use .
@$(GOEXEC) build -o $(GO_IOS_BINARY_NAME) .
@$(GOEXEC) work use ./ncm
@CGO_ENABLED=1 $(GOEXEC) build -o $(NCM_BINARY_NAME) ./cmd/cdc-ncm/main.go
# Run the Go program with sudo
run: build
@sudo ./$(NCM_BINARY_NAME) --prometheusport=8080
# Build and run
up: build run
# Run linter
lint:
@go vet ./...
# Setup development environment (installs git hooks)
setup:
@echo "Configuring git hooks..."
@git config core.hooksPath .githooks
@echo "Done! Pre-commit hooks are now active."
readme-help:
@out=$$(mktemp /tmp/go-ios.XXXXXX); trap 'rm -f "$$out"' EXIT INT TERM; \
perl -pe'BEGIN{$$/=q(<!-- help begin -->)} if($$/=~s/begin/end/){<>;$$_.="\n\n```text\n".`go run . --help`."```\n\n$$/"}' README.md > "$$out" && \
mv "$$out" README.md
# Phony targets
.PHONY: build run up lint setup readme-help