{"thread":{"id":"27718","subject":"[PATCH] Makefile: Use computed header dependencies if the compiler supports it","startedAt":"2011-06-28T09:21:25Z","lastAt":"2011-06-28T09:21:25Z","messageCount":1,"participants":["Fredrik Kuivinen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"170612","messageId":"1309252885-14361-1-git-send-email-frekui@gmail.com","threadId":"27718","inReplyTo":null,"subject":"[PATCH] Makefile: Use computed header dependencies if the compiler supports it","fromName":"Fredrik Kuivinen","fromEmail":"frekui@gmail.com","sentAt":"2011-06-28T09:21:25Z","receivedAt":"2011-06-28T09:21:25Z","isPatch":true,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"Previously you had to manually define COMPUTE_HEADER_DEPENDENCIES to\nenable this feature. It seemed a bit sad that such a useful feature\nhad to be enabled manually.\n\nSigned-off-by: Fredrik Kuivinen <frekui@gmail.com>\n---\n Makefile |   13 +++++++++----\n 1 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex e40ac0c..3b9efac 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -243,10 +243,6 @@ all::\n #   DEFAULT_EDITOR='$GIT_FALLBACK_EDITOR',\n #   DEFAULT_EDITOR='\"C:\\Program Files\\Vim\\gvim.exe\" --nofork'\n #\n-# Define COMPUTE_HEADER_DEPENDENCIES if your compiler supports the -MMD option\n-# and you want to avoid rebuilding objects when an unrelated header file\n-# changes.\n-#\n # Define CHECK_HEADER_DEPENDENCIES to check for problems in the hard-coded\n # dependency rules.\n #\n@@ -1211,6 +1207,15 @@ endif\n ifdef CHECK_HEADER_DEPENDENCIES\n COMPUTE_HEADER_DEPENDENCIES =\n USE_COMPUTED_HEADER_DEPENDENCIES =\n+else\n+dep_check = $(shell sh -c \\\n+\t': > ++empty.c; \\\n+\t$(CC) -c -MF /dev/null -MMD -MP ++empty.c -o /dev/null 2>&1; \\\n+\techo $$?; \\\n+\t$(RM) ++empty.c')\n+ifeq ($(dep_check),0)\n+COMPUTE_HEADER_DEPENDENCIES=YesPlease\n+endif\n endif\n \n ifdef COMPUTE_HEADER_DEPENDENCIES\n-- \n1.7.5.3.368.g8b1b7.dirty\n"}]}