Socialify

Folder ..

Viewing Makefile
39 lines (33 loc) • 1.1 KB

 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
# Makefile for Yato

# Check for .env file
ifneq ($(wildcard .env),)
    include .env
    export $(shell sed 's/=.*//' .env)
endif

# Ensure required environment variables are set
ifndef MAL_CLIENT_ID
$(error MAL_CLIENT_ID is not set. Please check your .env file)
endif
ifndef MAL_CLIENT_SECRET
$(error MAL_CLIENT_SECRET is not set. Please check your .env file)
endif

# Variables
BUILD_DIR=build
BINARY_NAME=yato
MAIN_FILE=main.go
ENCODED_CLIENT_ID=$(shell printf '%s' "$(MAL_CLIENT_ID)" | base64)
ENCODED_CLIENT_SECRET=$(shell printf '%s' "$(MAL_CLIENT_SECRET)" | base64)

.PHONY: build run clean

build:
	@echo "Building Yato..."
	@echo "Encoded Client ID: $(ENCODED_CLIENT_ID)"
	@echo "Encoded Client Secret: $(ENCODED_CLIENT_SECRET)"
	@go build -ldflags '-X "yato/config.encodedClientID=$(ENCODED_CLIENT_ID)" -X "yato/config.encodedClientSecret=$(ENCODED_CLIENT_SECRET)"' -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_FILE)
	@echo "Build complete. Binary '$(BINARY_NAME)' created."

run:
	@echo "Running Yato..."
	@go run .

clean:
	@echo "Cleaning up..."
	@rm -rf $(BUILD_DIR)
	@echo "Cleanup complete."