-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (33 loc) · 900 Bytes
/
Makefile
File metadata and controls
43 lines (33 loc) · 900 Bytes
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
CC = gcc
WINCC = x86_64-w64-mingw32-gcc
MUSLCC = musl-gcc
SRC = $(shell find . -name "*.c" ! -path "./test/*")
OUT = gink
PREFIX ?= /usr/local/bin
all: linux
linux:
@echo "Building Linux binary..."
$(CC) $(SRC) -O2 -s -o $(OUT)
@echo "Built: $(OUT)"
linux-static:
@echo "Building static Linux binary (musl)..."
$(MUSLCC) $(SRC) -O2 -static -s -o $(OUT)
@echo "Built: $(OUT)"
windows:
@echo "Building Windows executable..."
$(WINCC) $(SRC) -O2 -static -s -o $(OUT).exe
@echo "Built: $(OUT).exe"
install: linux
@echo "Installing $(OUT) to $(PREFIX)..."
mkdir -p "$(PREFIX)"
cp $(OUT) "$(PREFIX)/$(OUT)"
chmod +x "$(PREFIX)/$(OUT)"
@echo "Installation complete."
uninstall:
@echo "Removing $(OUT) from $(PREFIX)..."
rm -f "$(PREFIX)/$(OUT)"
@echo "Uninstall complete."
clean:
rm -f $(OUT) $(OUT).exe
release: clean linux linux-static windows
@echo "Release build complete."