-OBJS := http.o main.o request.o ssl.o static.o tcp_sockets.o webserver.o ctdlclient.o admin_functions.o room_functions.o util.o caldav_reports.o messages.o ctdlfunctions.o ctdl_commands.o forum_view.o html2html.o text2html.o
-CFLAGS := -ggdb
-LDFLAGS :=
+CFLAGS := $(CFLAGS) -ggdb -Wno-format-truncation
+LDFLAGS := $(LDFLAGS)
-# link
-webcit: $(OBJS)
- gcc $(OBJS) $(LDFLAGS) -lcitadel -lpthread -lcrypto -lssl -lexpat -o webcit
+SRC := server
+OBJ := server
-# pull in dependency info for *existing* .o files
--include $(OBJS:.o=.d)
+HEADERS := $(wildcard $(SRC)/*.h)
+SOURCES := $(wildcard $(SRC)/*.c)
+OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
-# compile and generate dependency info
-%.o: %.c
- gcc -c $(CFLAGS) $*.c -o $*.o
- gcc -MM $(CFLAGS) $*.c > $*.d
+webcit: $(OBJECTS)
+ gcc $(CFLAGS) $(OBJECTS) $(LDFLAGS) -lcitadel -lpthread -lcrypto -lssl -lexpat -o webcit
+
+$(SRC)/%.c: $(HEADERS)
+ touch $@
+
+$(OBJ)/%.o: $(SRC)/%.c
+ gcc $(CFLAGS) -I$(SRC) -c $< -o $@
# remove compilation products
clean:
- rm -f webcit *.o *.d
+ rm -f webcit server/*.o
distclean: clean