kbuild: pass -g to assembler under CONFIG_DEBUG_INFO
[firefly-linux-kernel-4.4.55.git] / Makefile
index 1274084c9090aa92b529c0895a17b10d3313dcca..0ad6e8d9b0b3a04ed3d087bf3edd70fa5298146d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,9 @@ saved-output := $(KBUILD_OUTPUT)
 KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
 $(if $(KBUILD_OUTPUT),, \
      $(error output directory "$(saved-output)" does not exist))
-
+# Check that OUTPUT directory is not the same as where we have kernel src
+$(if $(filter-out $(KBUILD_OUTPUT),$(shell /bin/pwd)),, \
+     $(error Output directory (O=...) specifies kernel src dir))
 PHONY += $(MAKECMDGOALS)
 
 $(filter-out _all,$(MAKECMDGOALS)) _all:
@@ -500,6 +502,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO
 CFLAGS         += -g
+AFLAGS         += -gdwarf-2
 endif
 
 # Force gcc to behave correct even for buggy distributions
@@ -1255,8 +1258,10 @@ $(clean-dirs):
        $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
 
 clean: rm-dirs := $(MODVERDIR)
+clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
 clean: $(clean-dirs)
        $(call cmd,rmdirs)
+       $(call cmd,rmfiles)
        @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
                \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \