-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (48 loc) · 1.53 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
# phzd
# Makefile generated by 'gomaker'
NAME ?= phzd
VERSION ?=
# with a common install location, scripts should work on most platforms.
#
# default shebang: #!/usr/local/bin/phz
PREFIX ?= /usr/local/bin
VER ?= X
COMMIT != git rev-parse --verify --short HEAD
COMMIT ?= ${VER}
RELEASE ?= ${VERSION}${COMMIT}
all: ${NAME} phz-cli
# build web server
build: phzd
phzd:
@echo 'Building ${NAME} version ${RELEASE}'
go get -d -x -v .
go build -o ${NAME} -x --ldflags "-s -extldflags='-static' -X main.version=${RELEASE}" ./cmd/phzd
@echo 'Successfully built ${NAME}'
phz-cli: build
go build -o phz-cli -x --ldflags "-s -extldflags='-static' -X main.version=${RELEASE}" ./cmd/phz-cli
# install web server
install-phzd:
@echo 'PREFIX=${PREFIX}'
@mkdir -p ${PREFIX}
@install ${NAME} ${PREFIX}/${NAME}
@echo 'Successfully installed ${NAME} to ${PREFIX}'
clean:
@rm -fv ${NAME} phz-cli
test: build
go test -v ./phz/...
go test -v ./cmd/...
@echo Running the phz command line interpreter:
./phz-cli test.phz
# for heroku
run-demo: build
./phzd -conf config.toml.default -addr 0.0.0.0:80 -v
run: build
env -i myapikey=secret11223344 PATH=/usr/bin:/bin:/usr/local/bin ./phzd -conf config.toml.default -addr 0.0.0.0:8080 -v
# install phz-cli to /usr/local/bin/phz
install: install-phzd
@echo 'PREFIX=${PREFIX}'
@mkdir -p ${PREFIX}
@install phz-cli ${PREFIX}/phz
@echo "Successfully installed phz interpreter"
@echo "Now you can use '#!/usr/local/bin/phz' in your scripts!"
@echo "Try some of the executable scripts in testdata, such as testdata/phzzr"