webcit-ng/Makefile: made it awesomer
authorArt Cancro <ajc@citadel.org>
Tue, 4 Jul 2023 20:27:56 +0000 (11:27 -0900)
committerArt Cancro <ajc@citadel.org>
Tue, 4 Jul 2023 20:27:56 +0000 (11:27 -0900)
webcit-ng/Makefile

index 7c2980cb2068de03b077442c8fbd1cf7db4e361f..7b9e2c299bcd192d8eed07845f6cb8b99caf8d1d 100644 (file)
@@ -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