summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile17
2 files changed, 12 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index edfb0a4..f8c4fe2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/src/*.o
+/src/*.d
/udpastcp
diff --git a/Makefile b/Makefile
index bde9466..d4664b1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,20 @@
CFLAGS += -Wall -Wextra -Wwrite-strings -Wno-missing-field-initializers -std=c99 -D_BSD_SOURCE -D_DEFAULT_SOURCE
-
+CPPFLAGS += -MMD -MP
LDLIBS := -lev
-NET_OBJS := src/checksum.o src/client.o src/server.o
-OBJS := src/udpastcp.o $(NET_OBJS)
+TARGET := udpastcp
+NET_SRC := src/checksum.c src/client.c src/server.c
+SRC := src/udpastcp.c $(NET_SRC)
+OBJ := $(SRC:%.c=%.o)
+DEP := $(SRC:%.c=%.d)
-udpastcp: $(OBJS)
+$(TARGET): $(OBJ)
$(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@
# networking code needs aliasing to work at all
-$(NET_OBJS): CFLAGS+=-fno-strict-aliasing -Wno-sign-compare
+$(NET_SRC:%.c=%.o): CFLAGS+=-fno-strict-aliasing -Wno-sign-compare
+
+-include $(DEP)
clean:
- $(RM) $(OBJS)
+ $(RM) $(TARGET) $(OBJ) $(DEP)