|
58 | 58 | function cpp.initialize() |
59 | 59 | rule 'cpp' |
60 | 60 | fileExtension { ".cc", ".cpp", ".cxx", ".mm" } |
61 | | - buildoutputs { "$(OBJDIR)/%{file.objname}.o" } |
| 61 | + buildoutputs { "$(OBJDIR)/%{file.objname}%{premake.modules.gmake.cpp.gettooloutputext('cxx', cfg)}" } |
62 | 62 | buildmessage '$(notdir $<)' |
63 | 63 | buildcommands {'$(CXX) %{premake.modules.gmake.cpp.fileFlags(cfg, file)} $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'} |
64 | 64 |
|
65 | 65 | rule 'cc' |
66 | 66 | fileExtension {".c", ".s", ".m"} |
67 | | - buildoutputs { "$(OBJDIR)/%{file.objname}.o" } |
| 67 | + buildoutputs { "$(OBJDIR)/%{file.objname}%{premake.modules.gmake.cpp.gettooloutputext('cc', cfg)}" } |
68 | 68 | buildmessage '$(notdir $<)' |
69 | 69 | buildcommands {'$(CC) %{premake.modules.gmake.cpp.fileFlags(cfg, file)} $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"'} |
70 | 70 |
|
71 | 71 | rule 'resource' |
72 | 72 | fileExtension ".rc" |
73 | | - buildoutputs { "$(OBJDIR)/%{file.objname}.res" } |
| 73 | + buildoutputs { "$(OBJDIR)/%{file.objname}%{premake.modules.gmake.cpp.gettooloutputext('rc', cfg)}" } |
74 | 74 | buildmessage '$(notdir $<)' |
75 | 75 | buildcommands {'$(RESCOMP) $< -O coff -o "$@" $(ALL_RESFLAGS)'} |
76 | 76 |
|
77 | 77 | global(nil) |
78 | 78 | end |
79 | 79 |
|
| 80 | + function cpp.gettooloutputext(tool, cfg) |
| 81 | + local toolset = gmake.getToolSet(cfg) |
| 82 | + if toolset.gettooloutputext ~= nil then |
| 83 | + return toolset.gettooloutputext(tool) |
| 84 | + end |
| 85 | + |
| 86 | + return iif(tool == "rc", ".res", ".o") |
| 87 | + end |
80 | 88 |
|
81 | 89 | function cpp.createRuleTable(prj) |
82 | 90 | local rules = {} |
|
690 | 698 | _p('\t$(SILENT) rm -rf $(OBJDIR)') |
691 | 699 | _p('else') |
692 | 700 | _p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGET)) del $(subst /,\\\\,$(TARGET))') |
693 | | - _p('\t$(SILENT) if exist $(subst /,\\\\,$(GENERATED)) del /s /q $(subst /,\\\\,$(GENERATED))') |
| 701 | + _p('\t$(SILENT) $(foreach f,$(subst /,\\\\,$(GENERATED)),if exist $(f) del /s /q $(f) >nul &)') |
694 | 702 | _p('\t$(SILENT) if exist $(subst /,\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\,$(OBJDIR))') |
695 | 703 | _p('endif') |
696 | 704 | _p('') |
|
0 commit comments