refactor makefile

This commit is contained in:
Pierre Dubouilh 2018-12-23 01:02:00 +01:00
parent 57a9f2dbc8
commit c4aab1503b
No known key found for this signature in database
GPG key ID: 10E1A7CE67E74C0F
3 changed files with 8 additions and 11 deletions

View file

@ -1,32 +1,29 @@
build:
run:
make embed
go vet && go fmt
CGO_ENABLED=0 go build gossa.go
rm gossa.go
./gossa fixture
watch:
ls src/* | entr -rc make run
embed:
echo "embedding css and js into binary"
cp src/main.go gossa.go
perl -pe 's/template_will_be_here/`cat src\/page.tmpl`/ge' -i gossa.go
perl -pe 's/template_will_be_here/`cat src\/template.go`/ge' -i gossa.go
perl -pe 's/css_will_be_here/`cat src\/style.css`/ge' -i gossa.go
perl -pe 's/theme_will_be_here/`cat src\/theme.css`/ge' -i gossa.go
perl -pe 's/js_will_be_here/`cat src\/script.js`/ge' -i gossa.go
perl -pe 's/favicon_will_be_here/`base64 -w0 src\/favicon.png`/ge' -i gossa.go
run:
make build
./gossa fixture
ci:
cd src && go vet && go fmt
timeout 10 make run &
cd src && sleep 5 && go test
cp src/gossa_test.go . && sleep 5 && go test; rm gossa gossa_test.go
ci-watch:
ls src/* | entr -rc make ci
watch:
ls src/* | entr -rc make run
build-all:
make embed
env GOOS=linux GOARCH=amd64 go build gossa.go