Add Makefile
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
This commit is contained in:
parent
b9bb9a8fe0
commit
18b0d52b3f
4 changed files with 65 additions and 3 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
_DATA
|
_DATA
|
||||||
httpfs_vfsdata.go
|
httpfs_vfsdata.go
|
||||||
|
bin/
|
61
Makefile
Normal file
61
Makefile
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#-include .env
|
||||||
|
|
||||||
|
VERSION := $(shell git describe --tags)
|
||||||
|
BUILD := $(shell git rev-parse --short HEAD)
|
||||||
|
PROJECTNAME := $(shell basename "$(PWD)")
|
||||||
|
|
||||||
|
# Use linker flags to provide version/build settings
|
||||||
|
LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)"
|
||||||
|
|
||||||
|
# Make is verbose in Linux. Make it silent.
|
||||||
|
MAKEFLAGS += --silent
|
||||||
|
|
||||||
|
## run: run from code.
|
||||||
|
run:
|
||||||
|
go run cmd/distribyted/main.go examples/conf_example.yaml
|
||||||
|
|
||||||
|
## build: build binary.
|
||||||
|
build: go-generate go-build
|
||||||
|
|
||||||
|
## test: execute all tests.
|
||||||
|
test:
|
||||||
|
go test -v ./...
|
||||||
|
|
||||||
|
compile: go-generate go-compile
|
||||||
|
|
||||||
|
go-build:
|
||||||
|
@echo " > Building binary..."
|
||||||
|
go build $(LDFLAGS) -o bin/distribyted -tags "release" cmd/distribyted/main.go
|
||||||
|
|
||||||
|
go-generate:
|
||||||
|
@echo " > Generating code files..."
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
|
go-compile:
|
||||||
|
@echo " > Compiling for several platforms..."
|
||||||
|
# 32-Bit Systems
|
||||||
|
# FreeBDS
|
||||||
|
#GOOS=freebsd GOARCH=386 go build $(LDFLAGS) -o bin/main-freebsd-386 -tags "release" cmd/distribyted/main.go
|
||||||
|
# MacOS
|
||||||
|
#GOOS=darwin GOARCH=386 go build $(LDFLAGS) -o bin/main-darwin-386 -tags "release" cmd/distribyted/main.go
|
||||||
|
# Linux
|
||||||
|
GOOS=linux GOARCH=386 go build $(LDFLAGS) -o bin/main-linux-386 -tags "release" cmd/distribyted/main.go
|
||||||
|
# 64-Bit
|
||||||
|
# FreeBDS
|
||||||
|
#GOOS=freebsd GOARCH=amd64 go build $(LDFLAGS) -o bin/main-freebsd-amd64 -tags "release" cmd/distribyted/main.go
|
||||||
|
# MacOS
|
||||||
|
#GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o bin/main-darwin-amd64 -tags "release" cmd/distribyted/main.go
|
||||||
|
# Linux
|
||||||
|
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o bin/main-linux-amd64 -tags "release" cmd/distribyted/main.go
|
||||||
|
|
||||||
|
# ARM
|
||||||
|
GOOS=linux GOARCH=arm GOARM=5 go build $(LDFLAGS) -o bin/main-linux-arm -tags "release" cmd/distribyted/main.go
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
all: help
|
||||||
|
help: Makefile
|
||||||
|
@echo
|
||||||
|
@echo " Choose a command run in "$(PROJECTNAME)":"
|
||||||
|
@echo
|
||||||
|
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
|
||||||
|
@echo
|
|
@ -99,6 +99,8 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gin.SetMode(gin.ReleaseMode)
|
||||||
|
|
||||||
r := gin.New()
|
r := gin.New()
|
||||||
|
|
||||||
r.Use(ginlogrus.Logger(log), gin.Recovery())
|
r.Use(ginlogrus.Logger(log), gin.Recovery())
|
||||||
|
@ -112,8 +114,6 @@ func main() {
|
||||||
|
|
||||||
r.SetHTMLTemplate(t)
|
r.SetHTMLTemplate(t)
|
||||||
|
|
||||||
// r.LoadHTMLGlob("templates/*")
|
|
||||||
|
|
||||||
r.GET("/", func(c *gin.Context) {
|
r.GET("/", func(c *gin.Context) {
|
||||||
c.HTML(http.StatusOK, "index.html", nil)
|
c.HTML(http.StatusOK, "index.html", nil)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue