kbuild: support for %.symtypes files
[linux-2.6.git] / scripts / Makefile.build
index e8e7d27..3cb445c 100644 (file)
@@ -140,6 +140,15 @@ cmd_cc_i_c       = $(CPP) $(c_flags)   -o $@ $<
 %.i: %.c FORCE
        $(call if_changed_dep,cc_i_c)
 
+quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
+cmd_cc_symtypes_c         = \
+               $(CPP) -D__GENKSYMS__ $(c_flags) $<                     \
+               | $(GENKSYMS) -T $@ >/dev/null;                         \
+               test -s $@ || rm -f $@
+
+%.symtypes : %.c FORCE
+       $(call if_changed_dep,cc_symtypes_c)
+
 # C (.c) files
 # The C file is compiled and updated dependency information is generated.
 # (See cmd_cc_o_c + relevant part of rule_cc_o_c)
@@ -166,7 +175,8 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
 cmd_modversions =                                                      \
        if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then     \
                $(CPP) -D__GENKSYMS__ $(c_flags) $<                     \
-               | $(GENKSYMS) -a $(ARCH)                                \
+               | $(GENKSYMS) $(if $(KBUILD_SYMTYPES),                  \
+                             -T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH)   \
                > $(@D)/.tmp_$(@F:.o=.ver);                             \
                                                                        \
                $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F)              \