-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (44 loc) · 1.55 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
export GO111MODULE=on
TARGET=./build
ARCHS=amd64 386
LDFLAGS="-s -w"
GCFLAGS="all=-trimpath=$(shell pwd)"
ASMFLAGS="all=-trimpath=$(shell pwd)"
PROG=gochro
.DEFAULT_GOAL := all
all: clean windows linux darwin
docker-update:
wget https://raw.githubusercontent.com/jessfraz/dotfiles/master/etc/docker/seccomp/chrome.json -O ./chrome.json
docker pull golang:latest
docker pull alpine:latest
docker build --tag ${PROG}:dev .
docker-run: docker-update
docker run --rm -p 8000:8000 --security-opt seccomp=chrome.json ${PROG}:dev -host 0.0.0.0:8000
docker-run-daemon: docker-update
docker run --rm -d -p 8000:8000 --security-opt seccomp=chrome.json ${PROG}:dev -host 0.0.0.0:8000
windows:
@mkdir -p ${TARGET} ; \
for GOARCH in ${ARCHS}; do \
echo "Building for windows $${GOARCH} ..." ; \
GOOS=windows GOARCH=$${GOARCH} go build -ldflags=${LDFLAGS} -gcflags=${GCFLAGS} -asmflags=${ASMFLAGS} -o ${TARGET}/${PROG}-windows-$${GOARCH}.exe ; \
done;
linux:
@mkdir -p ${TARGET} ; \
for GOARCH in ${ARCHS}; do \
echo "Building for linux $${GOARCH} ..." ; \
GOOS=linux GOARCH=$${GOARCH} go build -ldflags=${LDFLAGS} -gcflags=${GCFLAGS} -asmflags=${ASMFLAGS} -o ${TARGET}/${PROG}-linux-$${GOARCH} ; \
done;
darwin:
@mkdir -p ${TARGET} ; \
for GOARCH in ${ARCHS}; do \
echo "Building for darwin $${GOARCH} ..." ; \
GOOS=darwin GOARCH=$${GOARCH} go build -ldflags=${LDFLAGS} -gcflags=${GCFLAGS} -asmflags=${ASMFLAGS} -o ${TARGET}/${PROG}-darwin-$${GOARCH} ; \
done;
clean:
@rm -rf ${TARGET}/*
build:
go build -v ./...
test:
go test -v ./...
upgrade:
go get -u