Skip to content

Commit

Permalink
ci: update makefile targets
Browse files Browse the repository at this point in the history
  • Loading branch information
vwhitteron committed Feb 27, 2024
1 parent 14ba010 commit 55eff94
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
MAIN_PACKAGE_PATH := ./examples/simple
BINARY_NAME := gt-telemetry


# ==================================================================================== #
# HELPERS
# ==================================================================================== #
Expand Down Expand Up @@ -41,6 +42,11 @@ audit:
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
go test -race -buildvcs -vet=off ./...

## lint: run linters
.PHONY: lint
lint:
golangci-lint run


# ==================================================================================== #
# DEVELOPMENT
Expand All @@ -57,16 +63,35 @@ test/cover:
go test -v -race -buildvcs -coverprofile=/tmp/coverage.out ./...
go tool cover -html=/tmp/coverage.out

## kaitai: compile the GT telemetry kaitai struct
.PHONY: kaitai
kaitai-struct:
## kaitai: compile the GT telemetry package from the Kaitai Struct
.PHONY: build/kaitai
build/kaitai:
ifeq (, $(shell which kaitai-struct-compiler))
$(error "kaitai-struct-compiler command not found, see https://kaitai.io/#download for installation instructions.")
endif
@kaitai-struct-compiler --target go --go-package gttelemetry --outdir internal internal/kaitai/gran_turismo_telemetry.ksy

## build: build the application
.PHONY: build
build: kaitai
build:
@go build -o examples/bin/${BINARY_NAME} ${MAIN_PACKAGE_PATH}

.PHONY: build-darwin
build-darwin:
@GOOS=darwin GOARCH=arm64 go build -o examples/bin/${BINARY_NAME}-darwin-arm64 ${MAIN_PACKAGE_PATH}

.PHONY: build-linux
build-linux:
@GOOS=linux GOARCH=amd64 go build -o examples/bin/${BINARY_NAME}-linux-amd64 ${MAIN_PACKAGE_PATH}

.PHONY: build-rpi
build-rpi:
@GOOS=linux GOARCH=arm64 go build -o examples/bin/${BINARY_NAME}-rpi-arm64 ${MAIN_PACKAGE_PATH}

.PHONY: build-windows
build-windows:
@GOOS=windows GOARCH=amd64 go build -o examples/bin/${BINARY_NAME}-amd64.exe ${MAIN_PACKAGE_PATH}

## run: run the application
.PHONY: run
run: build
Expand All @@ -75,11 +100,7 @@ run: build
## run/live: run the application with reloading on file changes
.PHONY: run/live
run/live:
@go run ${MAIN_PACKAGE_PATH}/main.go \
--build.cmd "make build" --build.bin "/tmp/bin/${BINARY_NAME}" --build.delay "100" \
--build.exclude_dir "" \
--build.include_ext "go, tpl, tmpl, html, css, scss, js, ts, sql, jpeg, jpg, gif, png, bmp, svg, webp, ico" \
--misc.clean_on_exit "true"
@go run ${MAIN_PACKAGE_PATH}/main.go

## clean: clean up project and return to a pristine state
.PHONY: clean
Expand Down

0 comments on commit 55eff94

Please sign in to comment.