Socialify

Folder ..

Viewing Makefile
38 lines (32 loc) • 756.0 B

 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
# Variables
BINARY_NAME=yuzaki
BINARY_BUILD_PATH=bin/$(BINARY_NAME)
MAIN_PATH=yuzaki/main.go
ENV_FILE=.env

.PHONY: all build clean dev run setup

setup:
	@echo "Setting up environment..."
	@if [ ! -f $(ENV_FILE) ]; then \
		cp .env.example $(ENV_FILE); \
		echo "Created .env file from example"; \
	fi
	go install github.com/air-verse/air@latest
	go mod download
	
build:
	@echo "Building binary..."
	go build -o $(BINARY_BUILD_PATH) $(MAIN_PATH)

clean:
	@echo "Cleaning up..."
	rm -rf bin

dev:
	@echo "Running with air in development mode..."
	air

run:
	@echo "Checking if binary exists..."
	@if [ ! -f $(BINARY_BUILD_PATH) ]; then \
		make build; \
	fi
	@echo "Running binary..."
	$(BINARY_BUILD_PATH)

all: clean setup build
	@echo "Build complete!"