diff options
| 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 |
| commit | 33647dd2c4f4af7c7cb7d99c1a6dac7f1d059a67 (patch) | |
| tree | 12925795f7ecc39e566ff78f18c3bfab5539e32f /src/Makefile | |
| parent | d5de3e243a8481ad879dd8effc5759d406dc90b7 (diff) | |
Switch to unity build
Diffstat (limited to 'src/Makefile')
| -rw-r--r-- | src/Makefile | 19 |
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 | ||
| 9 | CFLAGS = -std=c2x -Wall -Wextra -Wpedantic -pedantic-errors -fanalyzer -Wanalyzer-too-complex -ggdb -g3 -O0 | 9 | CFLAGS = -std=c2x -Wall -Wextra -Wpedantic -pedantic-errors -fanalyzer -Wanalyzer-too-complex -ggdb -g3 -O0 |
| 10 | DEPFLAGS = -MT $@ -MMD -MP -MF $*.d | ||
| 11 | 10 | ||
| 12 | CFLAGS += $$(pkg-config --cflags libsodium) | 11 | CFLAGS += $$(pkg-config --cflags libsodium) |
| 13 | LDLIBS += $$(pkg-config --libs-only-l libsodium) | 12 | LDLIBS += $$(pkg-config --libs-only-l libsodium) |
| 14 | LDFLAGS += $$(pkg-config --libs-only-L libsodium) | 13 | LDFLAGS += $$(pkg-config --libs-only-L libsodium) |
| 15 | 14 | ||
| 16 | SOURCES := $(wildcard *.c) | 15 | SOURCES := $(wildcard *.c) |
| 17 | OBJECTS := $(patsubst %.c,%.o,$(SOURCES)) | ||
| 18 | DEPS := $(patsubst %.c,%.d,$(SOURCES)) | ||
| 19 | |||
| 20 | COMPILE.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 | ||
| 26 | all: main | 21 | all: main |
| 27 | main: $(OBJECTS) | 22 | main: |
| 28 | 23 | echo "Need to update makefile to work with unity build" | |
| 29 | %.o: %.c %.d | ||
| 30 | $(COMPILE.c) $< | ||
| 31 | |||
| 32 | $(DEPS): | ||
| 33 | include $(wildcard $(DEPS)) | ||
| 34 | # Adopted from https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ | ||
| 35 | 24 | ||
| 36 | c clean: | 25 | c clean: |
| 37 | @-rm -rv main $(OBJECTS) $(DEPS) $(wildcard *.test*) $(wildcard *.enc) | 26 | @-rm -rv main $(wildcard *.test*) $(wildcard *.enc) |
| 38 | 27 | ||
| 39 | val: | 28 | val: |
| 40 | $(MAKE) all | 29 | $(MAKE) all |
