aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e82d3308806e8f1f98a45d290e16d961e32f46f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
BINARY_NAME = dove
BUILD_PATH = bin/$(BINARY_NAME)
MAIN_PATH = $(BINARY_NAME)/main.go
TAILWIND = toolchain/tailwind

.PHONY: setup clean tidy embed build run dev css watch all

setup:
	@echo "Setting up environment..."
	@go mod download
	@go mod tidy
	@./scripts/tailwind.setup.sh
	@./scripts/htmx.setup.sh
	@echo "Environment setup complete."

clean:
	@echo "Cleaning up..."
	@rm -rf bin
	@rm -rf tmp
	@rm -rf *.db
	@rm -rf data/
	@echo "Cleanup complete."

tidy:
	@echo "Tidying modules..."
	@go mod tidy
	@echo "Modules tidied."

embed:
	@cp example.config.toml config/example.config.toml

build: css embed
	@echo "Building..."
	@go build -o $(BUILD_PATH) $(MAIN_PATH)
	@echo "Build complete."

run:
	@if [ ! -f $(BUILD_PATH) ]; then echo "Binary not found. Building..."; $(MAKE) -s build; fi
	@echo "Running..."
	@$(BUILD_PATH)

dev: css embed
	@echo "Running in development mode..."
	@go run $(MAIN_PATH)

css:
	@if [ ! -f $(TAILWIND) ]; then echo "Tailwind not found. Installing..."; ./scripts/tailwind.setup.sh; fi
	@echo "Building CSS..."
	@$(TAILWIND) -i static/css/tailwind.css -o static/css/style.css --minify

watch:
	@if [ ! -f $(TAILWIND) ]; then echo "Tailwind not found. Installing..."; ./scripts/tailwind.setup.sh; fi
	@echo "Watching CSS..."
	@$(TAILWIND) -i static/css/tailwind.css -o static/css/style.css --watch

all: setup clean build run

.SILENT: