diff --git a/.gitignore b/.gitignore index 7aa3fae06..950e4d84a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ *.gcov *.html *.o +*.d diff --git a/Makefile b/Makefile index 585b826c0..20ebbfd20 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ SRC = array.c \ vis-text-objects.c \ $(REGEX_SRC) OBJ = $(SRC:.c=.o) +DEP = $(OBJ:.o=.d) ELF = vis vis-menu vis-digraph EXECUTABLES = $(ELF) vis-clipboard vis-complete vis-open @@ -46,7 +47,7 @@ CONFIG_TRE ?= 0 CONFIG_ACL ?= 0 CONFIG_SELINUX ?= 0 -CFLAGS_STD ?= -std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DNDEBUG +CFLAGS_STD ?= -std=c99 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DNDEBUG -MMD CFLAGS_STD += -DVERSION=\"${VERSION}\" LDFLAGS_STD ?= -lc @@ -74,6 +75,8 @@ DOCKER?=docker all: $(ELF) +-include $(DEP) + .c.o: ${CC} ${CFLAGS} ${CFLAGS_VIS} ${CFLAGS_EXTRA} -o $@ -c $< @@ -83,9 +86,9 @@ config.h: config.mk: @touch $@ -$(OBJ): config.mk config.h +$(OBJ): config.mk -vis: config.h config.mk *.h ${OBJ} +vis: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} ${LDFLAGS_VIS} ${LDFLAGS_EXTRA} vis-menu: vis-menu.c @@ -154,7 +157,7 @@ testclean: clean: @echo cleaning - @rm -f $(ELF) $(OBJ) vis-single vis-single-payload.inc vis-*.tar.gz *.gcov *.gcda *.gcno + @rm -f $(ELF) $(OBJ) $(DEP) vis-single vis-single-payload.inc vis-*.tar.gz *.gcov *.gcda *.gcno distclean: clean testclean @echo cleaning build configuration diff --git a/configure b/configure index d71ab78b1..5d7c821bf 100755 --- a/configure +++ b/configure @@ -220,7 +220,7 @@ tryflag CFLAGS_TRY -Werror=unused-command-line-argument tryldflag LDFLAGS_TRY -Werror=unknown-warning-option tryldflag LDFLAGS_TRY -Werror=unused-command-line-argument -CFLAGS_STD="-std=c99 -D_POSIX_C_SOURCE=200809L -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG" +CFLAGS_STD="-std=c99 -D_POSIX_C_SOURCE=200809L -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DNDEBUG -MMD" LDFLAGS_STD="-lc" OS=$(uname)