diff --git a/.gitignore b/.gitignore index bc013f3..264b039 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.o eventfd pipes +af_inet_loopback +af_unix diff --git a/Makefile b/Makefile index dd81526..be101a2 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,19 @@ # Public domain Makefile template derived from # http://jingram.sdf.org/2014/11/09/a-makefile-template-for-simple-c-projects.html -.DEFAULT_GOAL = all +all: PROGS := pipes eventfd af_unix af_inet_loopback -SRCS := $(addsuffix .c, $(PROGS)) main.c CC := cc CFLAGS := -std=gnu11 -Wall -Wextra -Werror -MMD LDFLAGS := +LDLIBS := $(obj-common) +obj-common = main.o -$(PROGS): $(addsuffix .o, $@) main.o +$(PROGS): $(obj-common) -OBJS = $(SRCS:.c=.o) -DEPS = $(SRCS:.c=.d) +DEPS = $(PROGS:=.d) $(obj-common:.o=.d) .PHONY: all all: $(PROGS) @@ -22,7 +22,7 @@ all: $(PROGS) .PHONY: clean cleaner clean: - rm -f $(OBJS) $(DEPS) + rm -f $(DEPS) $(obj-common) cleaner: clean - rm -rf $(PROGS) + rm -f $(PROGS)