summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 11 insertions, 6 deletions
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)