From 624928ab39adeb10a7972210297689c79b5e20db Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 4 Jul 2023 11:27:56 -0900 Subject: [PATCH] webcit-ng/Makefile: made it awesomer --- webcit-ng/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/webcit-ng/Makefile b/webcit-ng/Makefile index 7c2980cb2..7b9e2c299 100644 --- a/webcit-ng/Makefile +++ b/webcit-ng/Makefile @@ -1,13 +1,21 @@ CFLAGS := $(CFLAGS) -ggdb -Wno-format-truncation LDFLAGS := $(LDFLAGS) -# link -webcit: server/*.c - gcc $(CFLAGS) server/*.c $(LDFLAGS) -lcitadel -lpthread -lcrypto -lssl -lexpat -o webcit +SRC := server +OBJ := server + +SOURCES := $(wildcard $(SRC)/*.c) +OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES)) + +webcit: $(OBJECTS) + gcc $(CFLAGS) $(OBJECTS) $(LDFLAGS) -lcitadel -lpthread -lcrypto -lssl -lexpat -o webcit + +$(OBJ)/%.o: $(SRC)/%.c + gcc $(CFLAGS) -I$(SRC) -c $< -o $@ # remove compilation products clean: - rm -f webcit + rm -f webcit server/*.o distclean: clean -- 2.39.2