Merge pull request #595 from tsipinakis/makefile-deps
Fix makefile not recompiling on header change
This commit is contained in:
commit
10ce9f36af
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
*.o
|
*.o
|
||||||
|
*.d
|
||||||
*.gcda
|
*.gcda
|
||||||
*.gcno
|
*.gcno
|
||||||
*.gcov
|
*.gcov
|
||||||
|
14
Makefile
14
Makefile
@ -42,13 +42,15 @@ $(error "$(PKG_CONFIG) failed!")
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS := ${DEFAULT_CPPFLAGS} ${CPPFLAGS} ${DEFAULT_CFLAGS} ${CFLAGS} ${INCS}
|
CFLAGS := ${DEFAULT_CPPFLAGS} ${CPPFLAGS} ${DEFAULT_CFLAGS} ${CFLAGS} ${INCS} -MMD -MP
|
||||||
LDFLAGS := ${DEFAULT_LDFLAGS} ${LDFLAGS} ${LIBS}
|
LDFLAGS := ${DEFAULT_LDFLAGS} ${LDFLAGS} ${LIBS}
|
||||||
|
|
||||||
SRC := $(sort $(shell find src/ -name '*.c'))
|
SRC := $(sort $(shell find src/ -name '*.c'))
|
||||||
OBJ := ${SRC:.c=.o}
|
OBJ := ${SRC:.c=.o}
|
||||||
TEST_SRC := $(sort $(shell find test/ -name '*.c'))
|
TEST_SRC := $(sort $(shell find test/ -name '*.c'))
|
||||||
TEST_OBJ := $(TEST_SRC:.c=.o)
|
TEST_OBJ := $(TEST_SRC:.c=.o)
|
||||||
|
DEPS := ${SRC:.c=.d} ${TEST_SRC:.c=.d}
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all debug
|
.PHONY: all debug
|
||||||
all: doc dunst service
|
all: doc dunst service
|
||||||
@ -58,11 +60,13 @@ debug: LDFLAGS += ${LDFLAGS_DEBUG}
|
|||||||
debug: CPPFLAGS += ${CPPFLAGS_DEBUG}
|
debug: CPPFLAGS += ${CPPFLAGS_DEBUG}
|
||||||
debug: all
|
debug: all
|
||||||
|
|
||||||
|
-include $(DEPS)
|
||||||
|
|
||||||
|
${OBJ} ${TEST_OBJ}: Makefile config.mk
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
${CC} -o $@ -c $< ${CFLAGS}
|
${CC} -o $@ -c $< ${CFLAGS}
|
||||||
|
|
||||||
${OBJ}: config.mk
|
|
||||||
|
|
||||||
dunst: ${OBJ} main.o
|
dunst: ${OBJ} main.o
|
||||||
${CC} -o ${@} ${OBJ} main.o ${CFLAGS} ${LDFLAGS}
|
${CC} -o ${@} ${OBJ} main.o ${CFLAGS} ${LDFLAGS}
|
||||||
|
|
||||||
@ -122,7 +126,7 @@ endif
|
|||||||
clean: clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run
|
clean: clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run
|
||||||
|
|
||||||
clean-dunst:
|
clean-dunst:
|
||||||
rm -f dunst ${OBJ} main.o
|
rm -f dunst ${OBJ} main.o main.d ${DEPS}
|
||||||
rm -f org.knopwob.dunst.service
|
rm -f org.knopwob.dunst.service
|
||||||
rm -f dunst.systemd.service
|
rm -f dunst.systemd.service
|
||||||
|
|
||||||
@ -136,7 +140,7 @@ clean-doc:
|
|||||||
rm -fr docs/internal/coverage
|
rm -fr docs/internal/coverage
|
||||||
|
|
||||||
clean-tests:
|
clean-tests:
|
||||||
rm -f test/test test/*.o
|
rm -f test/test test/*.o test/*.d
|
||||||
|
|
||||||
clean-coverage: clean-coverage-run
|
clean-coverage: clean-coverage-run
|
||||||
find . -type f -name '*.gcno' -delete
|
find . -type f -name '*.gcno' -delete
|
||||||
|
Loading…
x
Reference in New Issue
Block a user