2016-06-10 14:36:41 +00:00
|
|
|
## simple makefile to log workflow
|
|
|
|
.PHONY: all test clean build install
|
|
|
|
|
|
|
|
GOFLAGS ?= $(GOFLAGS:)
|
2016-12-18 14:12:24 +00:00
|
|
|
dbtype=$(shell grep dbtype config.json | cut -d \" -f 4)
|
|
|
|
dbname=$(shell grep dbname config.json | cut -d \" -f 4)
|
|
|
|
dbtable=$(shell grep dbtable config.json | cut -d \" -f 4)
|
2016-06-10 14:36:41 +00:00
|
|
|
|
|
|
|
all: clean install build
|
|
|
|
|
|
|
|
build:
|
2016-12-18 14:12:24 +00:00
|
|
|
gofmt -w pastebin.go
|
2016-07-14 02:09:25 +00:00
|
|
|
go build $(GOFLAGS) ./...
|
2016-12-18 14:12:24 +00:00
|
|
|
ifeq ($(dbtype),sqlite3)
|
|
|
|
cat database.sql | sed 's/pastebin/$(dbtable)/' | sqlite3 $(dbname)
|
|
|
|
endif
|
2016-06-10 14:36:41 +00:00
|
|
|
|
|
|
|
install:
|
2016-07-14 02:09:25 +00:00
|
|
|
go get github.com/dchest/uniuri
|
|
|
|
go get github.com/ewhal/pygments
|
2016-12-18 14:12:24 +00:00
|
|
|
go get github.com/mattn/go-sqlite3
|
2016-07-14 02:09:25 +00:00
|
|
|
go get github.com/gorilla/mux
|
2016-12-18 14:12:24 +00:00
|
|
|
go get github.com/go-sql-driver/mysql
|
|
|
|
go get github.com/lib/pq
|
2016-06-10 14:36:41 +00:00
|
|
|
|
|
|
|
test: install
|
2016-07-15 05:13:59 +00:00
|
|
|
go install $(GOFLAGS) ./...
|
2016-06-10 14:36:41 +00:00
|
|
|
|
|
|
|
bench: install
|
2016-07-14 02:09:25 +00:00
|
|
|
go test -run=NONE -bench=. $(GOFLAGS) ./...
|
2016-06-10 14:36:41 +00:00
|
|
|
|
|
|
|
clean:
|
2016-07-14 02:09:25 +00:00
|
|
|
go clean $(GOFLAGS) -i ./...
|
2016-12-18 14:12:24 +00:00
|
|
|
rm -rf ./build
|
|
|
|
rm -rf pastebin.db
|