Intial webserver runtime

This commit is contained in:
2021-01-29 23:19:27 -05:00
parent f17f3d160c
commit 05ad9a50c3
8 changed files with 240 additions and 30 deletions

View File

@ -1,10 +1,11 @@
#include .env
PROJECTNAME="OpenSkins"
STANDALONE_LOCATION="../OpenSkins-Standalone-Plugin/bin/OpenSkins-Standalone-Plugin"
# Go related variables.
GOBASE=$(shell pwd)
GOPATH=$(GOBASE)/vendor:$(GOBASE):/home/azer/code/golang # You can remove or change the path after last colon.
GOPATH=$(GOBASE)/vendor:$(GOBASE)
GOBIN=$(GOBASE)/bin
GOFILES=$(wildcard *.go)
@ -21,36 +22,41 @@ go-compile: go-clean go-get go-build
go-build:
@echo " > Building binary..."
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -o $(GOBIN)/$(PROJECTNAME) $(GOFILES)
@go build -o $(GOBIN)/$(PROJECTNAME) $(GOFILES)
go-generate:
@echo " > Generating dependency files..."
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go generate $(generate)
@go generate $(generate)
go-get:
@echo " > Checking if there is any missing dependencies..."
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get $(get)
@go get $(get)
go-install:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go install $(GOFILES)
@echo " > Running go install..."
@go install $(GOFILES)
go-clean:
@echo " > Cleaning build cache"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go clean
@go clean
go-test:
@echo " > Running tests..."
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go test
@go test
go-run:
@echo " > Running ${PROJECTNAME}"
@-(cd $(GOBIN); ./$(PROJECTNAME))
openskins-common:
@echo " > Updating common library..."
@go get -u github.com/josephbmanley/OpenSkins-Common
## install: downloads and installs dependencies
install: go-get
install: openskins-common go-get
## clean: test
## clean: Runs go clean
clean:
@(MAKEFILE) go-clean
@ -61,7 +67,7 @@ compile:
@-$(MAKE) -s go-compile 2> $(STDERR)
@cat $(STDERR) | sed -e '1s/.*/\nError:\n/' | sed 's/make\[.*/ /' | sed "/^/s/^/ /" 1>&2
## watch: Runs go clean
## watch: Runs command on code update
watch:
@yolo -i . -e vendor -e bin -c $(run)
@ -74,6 +80,12 @@ run: go-compile go-run
## test: Run unit tests
test: go-test
## standalone: Compile project & install standalone plugin *REQUIRES BUILD IN `../OpenSkins-Standalone-Plugin/bin`*
standalone: compile
@mkdir -p ./bin/plugins
@rm -f ./bin/plugins/standalone.so
@cp $(STANDALONE_LOCATION) ./bin/plugins/standalone.so
## help: Displays help text for make commands
.DEFAULT_GOAL := help
all: help