chore(build): load .env.local and allow overriding Go caches (GOMODCACHE/GOCACHE/GOTMPDIR)
- commit
- 53671bc402aa4e7cbbe392b74c09817d0deb8abb
- author
- bamen · · 2025-09-09 20:36 UTC
- committer
- bamen · · 2025-09-09 21:34 UTC
- parent
- 2322edd
- signature
- unsigned
1 file · +11 -2
M Makefile +11 -2
| @@ -2,13 +2,22 @@ | |||
| 2 | 2 | ||
| 3 | 3 | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static | |
| 4 | 4 | ||
| 5 | + | # Load local overrides from .env.local if present (Makefile syntax) | |
| 6 | + | ifneq (,$(wildcard .env.local)) | |
| 7 | + | include .env.local | |
| 8 | + | export | |
| 9 | + | endif | |
| 10 | + | ||
| 5 | 11 | # Variables | |
| 6 | 12 | BINARY_NAME=dumber | |
| 7 | 13 | MAIN_PATH=. | |
| 8 | 14 | DIST_DIR=dist | |
| 9 | 15 | ||
| 10 | - | # Local caches to avoid $HOME permission issues in sandboxed environments | |
| 11 | - | GOENV=GOMODCACHE=$(PWD)/tmp/go-mod GOCACHE=$(PWD)/tmp/go-cache GOTMPDIR=$(PWD)/tmp | |
| 16 | + | # Local caches to avoid $HOME permission issues (override via .env.local) | |
| 17 | + | GOMODCACHE?=$(CURDIR)/tmp/go-mod | |
| 18 | + | GOCACHE?=$(CURDIR)/tmp/go-cache | |
| 19 | + | GOTMPDIR?=$(CURDIR)/tmp | |
| 20 | + | GOENV=GOMODCACHE=$(GOMODCACHE) GOCACHE=$(GOCACHE) GOTMPDIR=$(GOTMPDIR) | |
| 12 | 21 | ||
| 13 | 22 | # Version information from git | |
| 14 | 23 | VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "v0.0.0-dev") | |
| @@ -2,13 +2,22 @@ | |||||
| 2 | 2 | ||||
| 3 | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static | 3 | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static | ||
| 4 | 4 | ||||
| 5 | + | # Load local overrides from .env.local if present (Makefile syntax) | |||
| 6 | + | ifneq (,$(wildcard .env.local)) | |||
| 7 | + | include .env.local | |||
| 8 | + | export | |||
| 9 | + | endif | |||
| 10 | + | ||||
| 5 | # Variables | 11 | # Variables | ||
| 6 | BINARY_NAME=dumber | 12 | BINARY_NAME=dumber | ||
| 7 | MAIN_PATH=. | 13 | MAIN_PATH=. | ||
| 8 | DIST_DIR=dist | 14 | DIST_DIR=dist | ||
| 9 | 15 | ||||
| 10 | - | # Local caches to avoid $HOME permission issues in sandboxed environments | 16 | + | # Local caches to avoid $HOME permission issues (override via .env.local) |
| 11 | - | GOENV=GOMODCACHE=$(PWD)/tmp/go-mod GOCACHE=$(PWD)/tmp/go-cache GOTMPDIR=$(PWD)/tmp | 17 | + | GOMODCACHE?=$(CURDIR)/tmp/go-mod |
| 18 | + | GOCACHE?=$(CURDIR)/tmp/go-cache | |||
| 19 | + | GOTMPDIR?=$(CURDIR)/tmp | |||
| 20 | + | GOENV=GOMODCACHE=$(GOMODCACHE) GOCACHE=$(GOCACHE) GOTMPDIR=$(GOTMPDIR) | |||
| 12 | 21 | ||||
| 13 | # Version information from git | 22 | # Version information from git | ||
| 14 | VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "v0.0.0-dev") | 23 | VERSION=$(shell git describe --tags --always --dirty 2>/dev/null || echo "v0.0.0-dev") | ||