Add static linking for github releases

This commit is contained in:
lily 2025-12-14 09:17:13 +11:00
parent ce21da8661
commit a01f7a6699
2 changed files with 5 additions and 3 deletions

View file

@ -19,7 +19,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Build project for Linux
run: make all
run: LDFLAGS="-static" make all
working-directory: ${{ github.workspace }}
- name: Upload Linux artifact

View file

@ -1,6 +1,8 @@
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -pedantic -O3 -flto
EXTRA_CFLAGS ?=
CFLAGS ?= -Wall -Wextra -std=c99 -pedantic -O3 -flto $(EXTRA_CFLAGS)
LDFLAGS ?=
DEBUG_FLAGS = -g -DDEBUG
# Directories
@ -29,7 +31,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
# Link executable
$(TARGET): $(OBJECTS) | $(BINDIR)
$(CC) $(OBJECTS) -o $@
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
# Debug build
debug: CFLAGS += $(DEBUG_FLAGS)