Skip to content

Commit

Permalink
improve: builds by statically linking OpenSSL
Browse files Browse the repository at this point in the history
This commit improves FrequenC builds by including OpenSSL in the executable, removing the need of having it installed locally.
  • Loading branch information
ThePedroo committed Jun 4, 2024
1 parent 483e0fb commit 135dea1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
env:
GITHUB_COMMIT_SHA: ${{ github.sha }}
GITHUB_BRANCH: ${{ github.ref_name }}
run: CFLAGS="-Ofast -fno-signed-zeros -fno-trapping-math -funroll-loops" make
run: CFLAGS="-D_POSIX_C_SOURCE=199309L -Iinclude -Iexternal -Isources -std=c99 -Ofast -march=native -static -Wl,--strip-all" make

- name: Archive Build
uses: actions/upload-artifact@v4
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ GITHUB_BRANCH ?= unknown# The branch that the commit was made on.
SRC_DIR = lib external sources
OBJ_DIR = obj

CFLAGS ?= -std=c99 -Ofast -march=native -fno-signed-zeros -fno-trapping-math -funroll-loops
CFLAGS ?= -D_POSIX_C_SOURCE=199309L -Iinclude -Iexternal -Isources -std=c99 -Ofast -march=native -fno-signed-zeros

ifeq ($(CC),gcc)
CFLAGS += -fanalyzer -Wno-analyzer-fd-leak -flto -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -Wno-stringop-overread
CFLAGS += -fanalyzer -Wno-analyzer-fd-leak -flto -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -Wno-stringop-overread -Wl,--strip-all
else ifeq ($(CC),clang)
CFLAGS += -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -flto=thin
CFLAGS += -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -flto=thin -Xclang -fmerge-functions
else ifeq ($(CC),zig cc)
CFLAGS += -flto=thin -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow
CFLAGS += -flto=thin -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -Wl,--strip-all
else
CFLAGS += -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -Wno-stringop-overread
CFLAGS += -Wpedantic -Wall -Wextra -Werror -Wformat -Wuninitialized -Wshadow -Wno-stringop-overread -Wl,--strip-all
endif

LDFLAGS ?= -Iinclude -Iexternal -Isources
LDFLAGS ?= -Wl,-s

ifeq ($(OS),Windows_NT)
LDFLAGS += -lwsock32
Expand All @@ -60,13 +60,13 @@ FrequenC: $(OBJS)
$(CC) $^ -o $@ $(CFLAGS) $(OPTIONS) $(LDFLAGS) $(SSL_FLAGS)

$(OBJ_DIR)/%.o: lib/%.c | $(OBJ_DIR)
$(CC) -c $< -o $@ $(CFLAGS) $(OPTIONS) $(LDFLAGS)
$(CC) -c $< -o $@ $(CFLAGS) $(OPTIONS)

$(OBJ_DIR)/%.o: external/%.c | $(OBJ_DIR)
$(CC) -c $< -o $@ $(CFLAGS) $(OPTIONS) $(LDFLAGS)
$(CC) -c $< -o $@ $(CFLAGS) $(OPTIONS)

$(OBJ_DIR)/%.o: sources/%.c | $(OBJ_DIR)
$(CC) -c $< -o $@ $(CFLAGS) $(OPTIONS) $(LDFLAGS)
$(CC) -c $< -o $@ $(CFLAGS) $(OPTIONS)

$(OBJ_DIR):
mkdir -p $@
Expand Down

0 comments on commit 135dea1

Please sign in to comment.