From 9be911390de5b3181dbab6a221e0dbd1c23475ca Mon Sep 17 00:00:00 2001 From: "R. Blaine Whittle" Date: Fri, 6 Oct 2017 10:20:28 -0700 Subject: [PATCH] gmake2 bug fix. When generating gmake file with pch headers for either gcc or clang, the generated make files assumed the system had the touch command. Which isn't true by default on windows. --- modules/gmake2/gmake2_cpp.lua | 6 +++++- modules/gmake2/tests/test_gmake2_pch.lua | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/gmake2/gmake2_cpp.lua b/modules/gmake2/gmake2_cpp.lua index b6b55ea946..76599ce9f6 100644 --- a/modules/gmake2/gmake2_cpp.lua +++ b/modules/gmake2/gmake2_cpp.lua @@ -717,7 +717,11 @@ local cmd = iif(p.languages.isc(cfg.language), "$(CC) -x c-header $(ALL_CFLAGS)", "$(CXX) -x c++-header $(ALL_CXXFLAGS)") _p('\t$(SILENT) %s -o "$@" -MF "$(@:%%.gch=%%.d)" -c "$<"', cmd) _p('$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)') - _p('\t$(SILENT) touch "$@"') + _p('\tifeq (posix,$(SHELLTYPE))') + _p('\t\t$(SILENT) touch "$@"') + _p('\telse') + _p('\t\t$(SILENT) echo $null >> "$@"') + _p('\tendif') _p('else') _p('$(OBJECTS): | $(OBJDIR)') _p('endif') diff --git a/modules/gmake2/tests/test_gmake2_pch.lua b/modules/gmake2/tests/test_gmake2_pch.lua index 0eeec8cbef..7630e55d7c 100644 --- a/modules/gmake2/tests/test_gmake2_pch.lua +++ b/modules/gmake2/tests/test_gmake2_pch.lua @@ -102,7 +102,11 @@ $(GCH): $(PCH) | $(OBJDIR) @echo $(notdir $<) $(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" $(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) - $(SILENT) touch "$@" + ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" + else + $(SILENT) echo $null >> "$@" + endif else $(OBJECTS): | $(OBJDIR) endif @@ -125,7 +129,11 @@ $(GCH): $(PCH) | $(OBJDIR) @echo $(notdir $<) $(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<" $(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR) - $(SILENT) touch "$@" + ifeq (posix,$(SHELLTYPE)) + $(SILENT) touch "$@" + else + $(SILENT) echo $null >> "$@" + endif else $(OBJECTS): | $(OBJDIR) endif