diff options
Diffstat (limited to 'src/~Makefile')
| -rw-r--r-- | src/~Makefile | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/~Makefile b/src/~Makefile new file mode 100644 index 0000000..b045807 --- /dev/null +++ b/src/~Makefile | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | CC = gcc | ||
| 2 | SHELL := /usr/bin/env | ||
| 3 | .SHELLFLAGS := -S bash -c | ||
| 4 | |||
| 5 | # I need to get better at makefiles so I can write this in a way that isn't absolutely insane/stupid | ||
| 6 | # RELEASE_CFLAGS := -O3 -fipa-pta -fipa-cp -fuse-linker-plugin -flto=auto | ||
| 7 | # RELEASE_LDFLAGS := -fuse-linker-plugin -flto=auto | ||
| 8 | |||
| 9 | CFLAGS = -std=c2x -Wall -Wextra -Wpedantic -pedantic-errors -fanalyzer -Wanalyzer-too-complex -ggdb -g3 -O0 $$(pkg-config --cflags libsodium) | ||
| 10 | LDLIBS += $$(pkg-config --libs-only-l libsodium) | ||
| 11 | LDFLAGS += $$(pkg-config --libs-only-L libsodium) | ||
| 12 | DEPFLAGS = -MT $@ -MMD -MP -MF $*.d | ||
| 13 | |||
| 14 | SOURCES := $(wildcard *.c) | ||
| 15 | OBJECTS := $(patsubst %.c,%.o,$(SOURCES)) | ||
| 16 | DEPS := $(patsubst %.c,%.d,$(SOURCES)) | ||
| 17 | |||
| 18 | COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) -c | ||
| 19 | |||
| 20 | .PHONY: all c clean val | ||
| 21 | .DELETE_ON_ERROR: | ||
| 22 | .ONESHELL: | ||
| 23 | |||
| 24 | all: main | ||
| 25 | main: $(OBJECTS) | ||
| 26 | |||
| 27 | %.o: %.c %.d | ||
| 28 | $(COMPILE.c) $< | ||
| 29 | |||
| 30 | $(DEPS): | ||
| 31 | include $(wildcard $(DEPS)) | ||
| 32 | # Adopted from https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ | ||
| 33 | |||
| 34 | c clean: | ||
| 35 | @-rm -rv main $(OBJECTS) $(DEPS) $(wildcard *.test*) $(wildcard *.enc) | ||
| 36 | |||
| 37 | val: | ||
| 38 | $(MAKE) all | ||
| 39 | valgrind --leak-check=yes ./main \ No newline at end of file | ||
