summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
author@syxhe <https://t.me/syxhe>2025-10-20 15:51:49 -0500
committer@syxhe <https://t.me/syxhe>2025-10-20 15:51:49 -0500
commit33647dd2c4f4af7c7cb7d99c1a6dac7f1d059a67 (patch)
tree12925795f7ecc39e566ff78f18c3bfab5539e32f /src/Makefile
parentd5de3e243a8481ad879dd8effc5759d406dc90b7 (diff)
Switch to unity build
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/Makefile b/src/Makefile
index 0ee5897..9293e55 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -6,35 +6,24 @@ SHELL := /usr/bin/env
6# RELEASE_CFLAGS := -O3 -fipa-pta -fipa-cp -fuse-linker-plugin -flto=auto 6# RELEASE_CFLAGS := -O3 -fipa-pta -fipa-cp -fuse-linker-plugin -flto=auto
7# RELEASE_LDFLAGS := -fuse-linker-plugin -flto=auto 7# RELEASE_LDFLAGS := -fuse-linker-plugin -flto=auto
8 8
9CFLAGS = -std=c2x -Wall -Wextra -Wpedantic -pedantic-errors -fanalyzer -Wanalyzer-too-complex -ggdb -g3 -O0 9CFLAGS = -std=c2x -Wall -Wextra -Wpedantic -pedantic-errors -fanalyzer -Wanalyzer-too-complex -ggdb -g3 -O0
10DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
11 10
12CFLAGS += $$(pkg-config --cflags libsodium) 11CFLAGS += $$(pkg-config --cflags libsodium)
13LDLIBS += $$(pkg-config --libs-only-l libsodium) 12LDLIBS += $$(pkg-config --libs-only-l libsodium)
14LDFLAGS += $$(pkg-config --libs-only-L libsodium) 13LDFLAGS += $$(pkg-config --libs-only-L libsodium)
15 14
16SOURCES := $(wildcard *.c) 15SOURCES := $(wildcard *.c)
17OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
18DEPS := $(patsubst %.c,%.d,$(SOURCES))
19
20COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) -c
21 16
22.PHONY: all c clean val 17.PHONY: all c clean val
23.DELETE_ON_ERROR: 18.DELETE_ON_ERROR:
24.ONESHELL: 19.ONESHELL:
25 20
26all: main 21all: main
27main: $(OBJECTS) 22main:
28 23 echo "Need to update makefile to work with unity build"
29%.o: %.c %.d
30 $(COMPILE.c) $<
31
32$(DEPS):
33include $(wildcard $(DEPS))
34# Adopted from https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
35 24
36c clean: 25c clean:
37 @-rm -rv main $(OBJECTS) $(DEPS) $(wildcard *.test*) $(wildcard *.enc) 26 @-rm -rv main $(wildcard *.test*) $(wildcard *.enc)
38 27
39val: 28val:
40 $(MAKE) all 29 $(MAKE) all