Implement full dependencies for rbuild: changing a header file will now automatically...
authorKJK::Hyperion <hackbunny@reactos.org>
Sun, 25 Jan 2009 16:19:45 +0000 (16:19 +0000)
committerKJK::Hyperion <hackbunny@reactos.org>
Sun, 25 Jan 2009 16:19:45 +0000 (16:19 +0000)
Full dependencies can be enabled by setting ROS_RBUILDFLAGS=-df
Whether initially enabled or not, once makefile.auto is generated, full dependencies can be enabled or disabled by setting ROS_BUILDDEPS=full or ROS_BUILDDEPS=auto

In case you missed it, full dependencies are VERY SLOW

svn path=/trunk/; revision=39093

reactos/Makefile
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/configuration.cpp
reactos/tools/rbuild/rbuild.cpp
reactos/tools/rbuild/rbuild.h

index 69ac106..1ac53b3 100644 (file)
 #            -v           Be verbose.
 #            -c           Clean as you go. Delete generated files as soon as they are not needed anymore.
 #            -dd          Disable automatic dependencies.
+#            -da          Enable automatic dependencies.
+#            -df          Enable full dependencies.
 #            -dm{module}  Check only automatic dependencies for this module.
 #            -hd          Disable precompiled headers.
 #            -mi          Let make handle creation of install directories. Rbuild will not generate the directories.
@@ -244,6 +246,7 @@ ifeq ($(HALFVERBOSEECHO),yes)
   ECHO_GENDIB  =@echo $(QUOTE)[GENDIB]   $@$(QUOTE)
   ECHO_STRIP   =@echo $(QUOTE)[STRIP]    $@$(QUOTE)
   ECHO_RGENSTAT=@echo $(QUOTE)[RGENSTAT] $@$(QUOTE)
+  ECHO_DEPENDS =@echo $(QUOTE)[DEPENDS]  $<$(QUOTE)
 else
   ECHO_CP      =
   ECHO_MKDIR   =
@@ -278,6 +281,7 @@ else
   ECHO_GENDIB  =
   ECHO_STRIP   =
   ECHO_RGENSTAT=
+  ECHO_DEPENDS =
 endif
 
 # Set host compiler/linker
index 12b88e3..0a6d846 100644 (file)
@@ -313,7 +313,7 @@ MingwBackend::Process ()
 void
 MingwBackend::CheckAutomaticDependenciesForModuleOnly ()
 {
-       if ( configuration.AutomaticDependencies )
+       if ( configuration.Dependencies == AutomaticDependencies )
        {
                Module* module = ProjectNode.LocateModule ( configuration.CheckDependenciesForModuleOnlyModule );
                if ( module == NULL )
@@ -519,6 +519,15 @@ MingwBackend::GenerateProjectLFLAGS () const
 void
 MingwBackend::GenerateGlobalVariables () const
 {
+       if ( configuration.Dependencies == FullDependencies )
+       {
+               fprintf ( fMakefile,
+                                 "ifeq ($(ROS_BUILDDEPS),)\n"
+                                 "ROS_BUILDDEPS:=%s\n"
+                                 "endif\n",
+                                 "full" );
+       }
+
        fprintf ( fMakefile,
                  "PREFIX := %s\n",
                  compilerPrefix.c_str () );
@@ -715,7 +724,7 @@ MingwBackend::GenerateProxyMakefiles ()
 void
 MingwBackend::CheckAutomaticDependencies ()
 {
-       if ( configuration.AutomaticDependencies )
+       if ( configuration.Dependencies == AutomaticDependencies )
        {
                printf ( "Checking automatic dependencies..." );
                AutomaticDependency automaticDependency ( ProjectNode );
index 732a290..424e31d 100644 (file)
@@ -1059,10 +1059,17 @@ Rule arHostRule2 ( "\t$(ECHO_HOSTAR)\n"
                    "\t${host_ar} -rc $@ $($(module_name)_OBJS)\n",
                    NULL );
 Rule gasRule ( "$(source): ${$(module_name)_precondition}\n"
-               "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
+               "ifeq ($(ROS_BUILDDEPS),full)\n"
+               "$(intermediate_path_unique).o.d: $(source) | $(intermediate_dir)\n"
+               "\t$(ECHO_DEPENDS)\n"
+               "\t${gcc} -x assembler-with-cpp -MF $@ -D__ASM__ $($(module_name)_CFLAGS) -M -MP -MT $@ $<\n"
+               "-include $(intermediate_path_unique).o.d\n"
+               "endif\n"
+               "$(intermediate_path_unique).o: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).o.d)$(dependencies) | $(intermediate_dir)\n"
                "\t$(ECHO_GAS)\n"
                "\t${gcc} -x assembler-with-cpp -o $@ -D__ASM__ $($(module_name)_CFLAGS) -c $<\n",
                "$(intermediate_path_unique).o",
+               "$(intermediate_path_unique).o.d",
                "$(intermediate_dir)$(SEP)", NULL );
 Rule bootRule ( "$(source): ${$(module_name)_precondition}\n"
                 "$(module_output): $(source)$(dependencies) | $(OUTPUT)$(SEP)$(source_dir)\n"
@@ -1076,7 +1083,13 @@ Rule nasmRule ( "$(source): ${$(module_name)_precondition}\n"
                 "$(intermediate_path_unique).o",
                 "$(intermediate_dir)$(SEP)", NULL );
 Rule windresRule ( "$(source): ${$(module_name)_precondition}\n"
-                   "$(intermediate_path_unique).coff: $(source)$(dependencies) $(WRC_TARGET) | $(intermediate_dir) $(TEMPORARY)\n"
+                                  "ifeq ($(ROS_BUILDDEPS),full)\n"
+                   "$(intermediate_path_unique).coff.d: $(source) | $(intermediate_dir) $(TEMPORARY)\n"
+                   "\t$(ECHO_DEPENDS)\n"
+                   "\t${gcc} -xc -M -MP -MT $@ -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) -MF $@\n"
+                   "-include $(intermediate_path_unique).coff.d\n"
+                   "endif\n"
+                   "$(intermediate_path_unique).coff: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).coff.d)$(dependencies) $(WRC_TARGET) | $(intermediate_dir) $(TEMPORARY)\n"
                    "\t$(ECHO_WRC)\n"
                    "\t${gcc} -xc -E -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) > $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp\n"
                    "\t$(Q)$(WRC_TARGET) ${$(module_name)_RCFLAGS} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp\n"
@@ -1084,6 +1097,7 @@ Rule windresRule ( "$(source): ${$(module_name)_precondition}\n"
                    "\t${windres} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp -o $@\n"
                    "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp 2>$(NUL)\n",
                    "$(intermediate_path_unique).coff",
+                   "$(intermediate_path_unique).coff.d",
                    "$(intermediate_dir)$(SEP)", NULL );
 Rule wmcRule ( "$(intermediate_path_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h: $(WMC_TARGET) $(source) | $(intermediate_dir)\n"
                "\t$(ECHO_WMC)\n"
@@ -1091,24 +1105,38 @@ Rule wmcRule ( "$(intermediate_path_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)
                "$(intermediate_path_noext).rc",
                "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h",
                "$(intermediate_dir)$(SEP)", NULL );
-Rule winebuildPDefRule ( "$(intermediate_path_unique).spec: $(source)$(dependencies) | $(intermediate_dir)\n"
+Rule winebuildPDefRule ( "ifeq ($(ROS_BUILDDEPS),full)\n"
+                         "$(intermediate_path_unique).spec.d: $(source) | $(intermediate_dir)\n"
+                         "\t$(ECHO_DEPENDS)\n"
+                         "\t${gcc} -xc -M -MP -MT $@ ${$(module_name)_RCFLAGS} $(source) -MF $@\n\n"
+                         "-include $(intermediate_path_unique).spec.d\n"
+                         "endif\n"
+                         "$(intermediate_path_unique).spec: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).spec.d)$(dependencies) | $(intermediate_dir)\n"
                          "\t$(ECHO_CPP)\n"
                          "\t${gcc} -xc -E ${$(module_name)_RCFLAGS} $(source) > $(intermediate_path_unique).spec\n\n"
                                                 "$(intermediate_path_unique).auto.def: $(intermediate_path_unique).spec $(WINEBUILD_TARGET) | $(intermediate_dir)\n"
                          "\t$(ECHO_WINEBLD)\n"
                          "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(intermediate_path_unique).auto.def --def -E $(intermediate_path_unique).spec --filename $(module_dllname)\n\n",
                          "$(intermediate_path_unique).spec",
+                         "$(intermediate_path_unique).spec.d",
                          "$(intermediate_path_unique).auto.def",
                          "$(intermediate_dir)$(SEP)", NULL );
 Rule winebuildPRule ( "$(intermediate_path_unique).stubs.c: $(intermediate_path_unique).spec $(WINEBUILD_TARGET) | $(intermediate_dir)\n"
                       "\t$(ECHO_WINEBLD)\n"
                       "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $@ --pedll $(intermediate_path_unique).spec --filename $(module_dllname)\n\n"
-                      "$(intermediate_path_unique).stubs.o: $(intermediate_path_unique).stubs.c | $(intermediate_dir)\n"
+                      "ifeq ($(ROS_BUILDDEPS),full)\n"
+                      "$(intermediate_path_unique).stubs.o.d: $(intermediate_path_unique).stubs.c | $(intermediate_dir)\n"
+                      "\t$(ECHO_DEPENDS)\n"
+                      "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
+                                         "-include $(intermediate_path_unique).stubs.o.d\n"
+                      "endif\n"
+                      "$(intermediate_path_unique).stubs.o: $(intermediate_path_unique).stubs.c$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).stubs.o.d) | $(intermediate_dir)\n"
                       "\t$(ECHO_CC)\n"
                       "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
                       "$(intermediate_path_unique).spec",
                       "$(intermediate_path_unique).stubs.c",
                       "$(intermediate_path_unique).stubs.o",
+                      "$(intermediate_path_unique).stubs.o.d",
                       "$(intermediate_dir)$(SEP)", NULL );
 Rule winebuildDefRule ( "$(intermediate_path_unique).auto.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(intermediate_dir)\n"
                         "\t$(ECHO_WINEBLD)\n"
@@ -1119,87 +1147,144 @@ Rule winebuildDefRule ( "$(intermediate_path_unique).auto.def: $(source)$(depend
 Rule winebuildRule ( "$(intermediate_path_unique).stubs.c: $(source) $(WINEBUILD_TARGET)\n"
                      "\t$(ECHO_WINEBLD)\n"
                      "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $@ --pedll $(source) --filename $(module_dllname)\n"
-                     "$(intermediate_path_unique).stubs.o: $(intermediate_path_unique).stubs.c$(dependencies) | $(intermediate_dir)\n"
+                     "ifeq ($(ROS_BUILDDEPS),full)\n"
+                     "$(intermediate_path_unique).stubs.o.d: $(intermediate_path_unique).stubs.c | $(intermediate_dir)\n"
+                     "\t$(ECHO_DEPENDS)\n"
+                     "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
+                     "-include $(intermediate_path_unique).stubs.o.d\n"
+                     "endif\n"
+                     "$(intermediate_path_unique).stubs.o: $(intermediate_path_unique).stubs.c$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).stubs.o.d)$(dependencies) | $(intermediate_dir)\n"
                      "\t$(ECHO_CC)\n"
                      "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
                      "$(intermediate_path_unique).stubs.c",
                      "$(intermediate_path_unique).stubs.o",
+                     "$(intermediate_path_unique).stubs.o.d",
                      "$(intermediate_dir)$(SEP)", NULL );
 Rule widlHeaderRule ( "$(source): ${$(module_name)_precondition}\n"
-                      "$(intermediate_path_noext).h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
+                                         "$(intermediate_path_noext).h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext).h $(source)\n",
                       "$(intermediate_path_noext).h",
                       "$(intermediate_dir)$(SEP)", NULL );
 Rule widlServerRule ( "$(source): ${$(module_name)_precondition}\n"
-                      "$(intermediate_path_noext)_s.c $(intermediate_path_noext)_s.h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
+                                         "$(intermediate_path_noext)_s.c $(intermediate_path_noext)_s.h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext)_s.h -s -S $(intermediate_path_noext)_s.c $(source)\n"
-                      "$(intermediate_path_noext)_s.o: $(intermediate_path_noext)_s.c $(intermediate_path_noext)_s.h$(dependencies) | $(intermediate_dir)\n"
+                      "ifeq ($(ROS_BUILDDEPS),full)\n"
+                      "$(intermediate_path_noext)_s.o.d: $(intermediate_path_noext)_s.c | $(intermediate_dir)\n"
+                      "\t$(ECHO_DEPENDS)\n"
+                      "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -M -MP -MT $@ $<\n"
+                      "-include $(intermediate_path_noext)_s.o.d\n"
+                      "endif\n"
+                      "$(intermediate_path_noext)_s.o: $(intermediate_path_noext)_s.c $(intermediate_path_noext)_s.h$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext)_s.o.d)$(dependencies) | $(intermediate_dir)\n"
                       "\t$(ECHO_CC)\n"
                       "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
                       "$(intermediate_path_noext)_s.h",
                       "$(intermediate_path_noext)_s.c",
                       "$(intermediate_path_noext)_s.o",
+                      "$(intermediate_path_noext)_s.o.d",
                       "$(intermediate_dir)$(SEP)", NULL );
 Rule widlClientRule ( "$(source): ${$(module_name)_precondition}\n"
-                      "$(intermediate_path_noext)_c.c $(intermediate_path_noext)_c.h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
+                                         "$(intermediate_path_noext)_c.c $(intermediate_path_noext)_c.h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext)_c.h -c -C $(intermediate_path_noext)_c.c $(source)\n"
-                      "$(intermediate_path_noext)_c.o: $(intermediate_path_noext)_c.c $(intermediate_path_noext)_c.h$(dependencies) | $(intermediate_dir)\n"
+                      "ifeq ($(ROS_BUILDDEPS),full)\n"
+                      "$(intermediate_path_noext)_c.o.d: $(intermediate_path_noext)_c.c | $(intermediate_dir)\n"
+                      "\t$(ECHO_DEPENDS)\n"
+                      "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -M -MP -MT $@ $<\n"
+                      "-include $(intermediate_path_noext)_c.o.d\n"
+                      "endif\n"
+                      "$(intermediate_path_noext)_c.o: $(intermediate_path_noext)_c.c $(intermediate_path_noext)_c.h$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext)_c.o.d)$(dependencies) | $(intermediate_dir)\n"
                       "\t$(ECHO_CC)\n"
                       "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
                       "$(intermediate_path_noext)_c.h",
                       "$(intermediate_path_noext)_c.c",
                       "$(intermediate_path_noext)_c.o",
+                      "$(intermediate_path_noext)_c.o.d",
                       "$(intermediate_dir)$(SEP)", NULL );
 Rule widlProxyRule ( "$(source): ${$(module_name)_precondition}\n"
-                     "$(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
+                                        "$(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
                      "\t$(ECHO_WIDL)\n"
                      "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(intermediate_path_noext)_p.h -p -P $(intermediate_path_noext)_p.c $(source)\n"
-                     "$(intermediate_path_noext)_p.o: $(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h$(dependencies) | $(intermediate_dir)\n"
+                     "ifeq ($(ROS_BUILDDEPS),full)\n"
+                     "$(intermediate_path_noext)_p.o.d: $(intermediate_path_noext)_p.c | $(intermediate_dir)\n"
+                     "\t$(ECHO_DEPENDS)\n"
+                     "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -M -MP -MT $@ $<\n"
+                     "-include $(intermediate_path_noext)_p.o.d\n"
+                     "endif\n"
+                     "$(intermediate_path_noext)_p.o: $(intermediate_path_noext)_p.c $(intermediate_path_noext)_p.h$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext)_p.o.d)$(dependencies) | $(intermediate_dir)\n"
                      "\t$(ECHO_CC)\n"
                      "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -fno-unit-at-a-time -c $<\n",
                      "$(intermediate_path_noext)_p.h",
                      "$(intermediate_path_noext)_p.c",
                      "$(intermediate_path_noext)_p.o",
+                     "$(intermediate_path_noext)_p.o.d",
                      "$(intermediate_dir)$(SEP)", NULL );
 Rule widlDlldataRule ( "$(source): $(dependencies) ${$(module_name)_precondition} $(WIDL_TARGET) | $(intermediate_dir)\n"
-                   "\t$(ECHO_WIDL)\n"
-                     "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) --dlldata-only --dlldata=$(source) $(bare_dependencies)\n"
-                     "$(intermediate_path_noext).o: $(source) $(dependencies) | $(intermediate_dir)\n"
-                      "\t$(ECHO_CC)\n"
-                                         "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
-                     "$(intermediate_path_noext).o", NULL );
+                       "\t$(ECHO_WIDL)\n"
+                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) --dlldata-only --dlldata=$(source) $(bare_dependencies)\n"
+                       "ifeq ($(ROS_BUILDDEPS),full)\n"
+                       "$(intermediate_path_noext).o.d: $(source) | $(intermediate_dir)\n"
+                       "\t$(ECHO_DEPENDS)\n"
+                       "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
+                       "-include $(intermediate_path_noext).o.d\n"
+                       "endif\n"
+                       "$(intermediate_path_noext).o: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_noext).o.d)$(dependencies) | $(intermediate_dir)\n"
+                       "\t$(ECHO_CC)\n"
+                       "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
+                       "$(intermediate_path_noext).o",
+                       "$(intermediate_path_noext).o.d", NULL );
 Rule widlTlbRule ( "$(source): ${$(module_name)_precondition}\n"
-                   "$(intermediate_dir)$(SEP)$(module_name).tlb: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
+                                  "$(intermediate_dir)$(SEP)$(module_name).tlb: $(source)$(dependencies) $(WIDL_TARGET) | $(intermediate_dir)\n"
                    "\t$(ECHO_WIDL)\n"
                    "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -t -T $(intermediate_path_noext).tlb $(source)\n",
                    "$(intermediate_dir)$(SEP)", NULL );
 Rule gccRule ( "$(source): ${$(module_name)_precondition}\n"
-               "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
+               "ifeq ($(ROS_BUILDDEPS),full)\n"
+               "$(intermediate_path_unique).o.d: $(source) | $(intermediate_dir)\n"
+               "\t$(ECHO_DEPENDS)\n"
+               "\t${gcc} -MF $@ $($(module_name)_CFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
+               "-include $(intermediate_path_unique).o.d\n"
+               "endif\n"
+               "$(intermediate_path_unique).o: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).o.d)$(dependencies) | $(intermediate_dir)\n"
                "\t$(ECHO_CC)\n"
                "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
-               "$(intermediate_path_unique).o", NULL );
+               "$(intermediate_path_unique).o",
+               "$(intermediate_path_unique).o.d", NULL );
 Rule gccHostRule ( "$(source): ${$(module_name)_precondition}\n"
-                   "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
+                                  "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
                    "\t$(ECHO_HOSTCC)\n"
                    "\t${host_gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
                    "$(intermediate_path_unique).o", NULL );
 Rule gppRule ( "$(source): ${$(module_name)_precondition}\n"
-               "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
+               "ifeq ($(ROS_BUILDDEPS),full)\n"
+               "$(intermediate_path_unique).o.d: $(source) | $(intermediate_dir)\n"
+               "\t$(ECHO_DEPENDS)\n"
+               "\t${gpp} -MF $@ $($(module_name)_CXXFLAGS)$(compiler_flags) -M -MP -MT $@ $<\n"
+               "-include $(intermediate_path_unique).o.d\n"
+               "endif\n"
+               "$(intermediate_path_unique).o: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_path_unique).o.d)$(dependencies) | $(intermediate_dir)\n"
                "\t$(ECHO_CC)\n"
                "\t${gpp} -o $@ $($(module_name)_CXXFLAGS)$(compiler_flags) -c $<\n",
-               "$(intermediate_path_unique).o", NULL );
+               "$(intermediate_path_unique).o",
+               "$(intermediate_path_unique).o.d", NULL );
 Rule gppHostRule ( "$(source): ${$(module_name)_precondition}\n"
-                   "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
+                                  "$(intermediate_path_unique).o: $(source)$(dependencies) | $(intermediate_dir)\n"
                    "\t$(ECHO_HOSTCC)\n"
                    "\t${host_gpp} -o $@ $($(module_name)_CXXFLAGS)$(compiler_flags) -c $<\n",
                    "$(intermediate_path_unique).o", NULL );
-Rule pchRule ( "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch: $(source)$(dependencies) | $(intermediate_dir)$(SEP).gch_$(module_name)\n"
+Rule pchRule ( "$(source): ${$(module_name)_precondition}\n"
+               "ifeq ($(ROS_BUILDDEPS),full)\n"
+                          "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d: $(source) | $(intermediate_dir)\n"
+                          "\t$(ECHO_DEPENDS)\n"
+                          "\t$(pch_cc) -MF $@ $(pch_ccflags)$(compiler_flags) -x $(pch_language) -M -MP -MT $@ $<\n"
+                          "-include $(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d\n"
+                          "endif\n"
+                          "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch: $(source)$(if $(subst _full,,_$(ROS_BUILDDEPS)),, $(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d)$(dependencies) | $(intermediate_dir)$(SEP).gch_$(module_name)\n"
                           "\t$(ECHO_PCH)\n"
                           "\t$(pch_cc) -o $@ $(pch_ccflags)$(compiler_flags) -x $(pch_language) -c $<\n",
-                          "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch", NULL );
+                          "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch",
+                          "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d", NULL );
 Rule emptyRule ( "", NULL );
 
 void
index 84188c1..d9a358c 100644 (file)
@@ -24,7 +24,7 @@ Configuration::Configuration ()
 {
        Verbose = false;
        CleanAsYouGo = false;
-       AutomaticDependencies = true;
+       Dependencies = AutomaticDependencies;
        CheckDependenciesForModuleOnly = false;
        CompilationUnitsEnabled = true;
        PrecompiledHeadersEnabled = true;
index d81fd3b..292cb45 100644 (file)
@@ -45,7 +45,13 @@ ParseAutomaticDependencySwitch (
        switch ( switchChar2 )
        {
                case 'd':
-                       configuration.AutomaticDependencies = false;
+                       configuration.Dependencies = NoDependencies;
+                       break;
+               case 'a':
+                       configuration.Dependencies = AutomaticDependencies;
+                       break;
+               case 'f':
+                       configuration.Dependencies = FullDependencies;
                        break;
                case 'm':
                        if ( strlen ( switchStart ) <= 3 )
@@ -293,6 +299,8 @@ main ( int argc, char** argv )
                printf ( "  -c            Clean as you go. Delete generated files as soon as they are not\n" );
                printf ( "                needed anymore.\n" );
                printf ( "  -dd           Disable automatic dependencies.\n" );
+               printf ( "  -da           Enable automatic dependencies.\n" );
+               printf ( "  -df           Enable full dependencies.\n" );
                printf ( "  -dm{module}   Check only automatic dependencies for this module.\n" );
                printf ( "  -ud           Disable multiple source files per compilation unit.\n" );
                printf ( "  -mi           Let make handle creation of install directories. Rbuild will\n" );
index 0365926..5d6bafa 100644 (file)
@@ -148,6 +148,12 @@ private:
                            bool verbose );
 };
 
+enum DependenciesType
+{
+       NoDependencies,
+       AutomaticDependencies,
+       FullDependencies
+};
 
 class Configuration
 {
@@ -156,7 +162,7 @@ public:
        ~Configuration ();
        bool Verbose;
        bool CleanAsYouGo;
-       bool AutomaticDependencies;
+       DependenciesType Dependencies;
        bool CheckDependenciesForModuleOnly;
        bool CompilationUnitsEnabled;
        bool PrecompiledHeadersEnabled;