From d9d142a7ad0bade65b6f8b777259e203dc6d5301 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Thu, 10 Apr 2025 18:58:30 -0500 Subject: Overhaul makefile --- src/Makefile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 53cd9fd..88c5344 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ CC = gcc -SHELL = /usr/bin/env -S bash +SHELL := bash # I need to get better at makefiles so I can write this in a way that isn't absolutely insane/stupid # RELEASE_CFLAGS := -O3 -fipa-pta -fipa-cp -fuse-linker-plugin -flto=auto @@ -9,24 +9,23 @@ CFLAGS = -std=c2x -Wall -Wextra -Wpedantic -pedantic-errors -fanalyzer -Wanalyze LDLIBS += $$(pkg-config --libs-only-l libsodium) LDFLAGS += $$(pkg-config --libs-only-L libsodium) -OBJECTS := $(patsubst %.c,%.o, $(wildcard *.c)) +SOURCES := $(wildcard *.c) +OBJECTS := $(patsubst %.c,%.o,$(SOURCES)) +DEPS := $(patsubst %.c,%.dep,$(SOURCES)) .PHONY: all c clean val .DELETE_ON_ERROR: +.ONESHELL: all: main main: main.o encryption.o shared.o ll.o arena.o - -$(OBJECTS): shared.h -ll.o: ll.c ll.h -main.o: main.c -arena.o: arena.c arena.h -shared.o: shared.c shared.h # Might as well put shared.h in here explicitly -encryption.o: encryption.c encryption.h +$(OBJECTS): %.o: %.dep +%.dep: %.c + ./depend.sh `dirname $*` $(CFLAGS) $*.c > $@ c clean: - -rm -rv main $(OBJECTS) $(wildcard *.test*) $(wildcard *.enc) + @-rm -rv main $(OBJECTS) $(DEPS) $(wildcard *.test*) $(wildcard *.enc) val: $(MAKE) all -- cgit v1.2.3