diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2016-07-09 15:37:41 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2016-07-09 15:37:41 -0400 |
commit | 8b613bf677ae5f0940b112477ff3e5979ec58f36 (patch) | |
tree | d8832b2a5845118369cb57f42af5e5dd8945e668 | |
parent | 3d7bf5253af49db6436261fadaea7b5fc85be03a (diff) | |
download | udpastcp-8b613bf677ae5f0940b112477ff3e5979ec58f36.tar.xz udpastcp-8b613bf677ae5f0940b112477ff3e5979ec58f36.zip |
Add dependency generation to makefile.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 17 |
2 files changed, 12 insertions, 6 deletions
@@ -1,2 +1,3 @@ /src/*.o +/src/*.d /udpastcp @@ -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) |