Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gmake dependencies #1005

Merged
merged 3 commits into from
Mar 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions modules/gmake2/gmake2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
---------------------------------------------------------------------------

function gmake2.phonyRules(prj)
_p('.PHONY: clean prebuild prelink')
_p('.PHONY: clean prebuild')
_p('')
end

Expand Down Expand Up @@ -349,19 +349,12 @@


function gmake2.preBuildRules(cfg, toolset)
_p('prebuild:')
_p('prebuild: | $(OBJDIR)')
_p('\t$(PREBUILDCMDS)')
_p('')
end


function gmake2.preLinkRules(cfg, toolset)
_p('prelink:')
_p('\t$(PRELINKCMDS)')
_p('')
end



include("gmake2_cpp.lua")
include("gmake2_csharp.lua")
Expand Down
24 changes: 17 additions & 7 deletions modules/gmake2/gmake2_cpp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
gmake2.objDirRules,
cpp.cleanRules,
gmake2.preBuildRules,
gmake2.preLinkRules,
cpp.customDeps,
cpp.pchRules,
}
end
Expand All @@ -658,21 +658,21 @@

function cpp.allRules(cfg, toolset)
if cfg.system == p.MACOSX and cfg.kind == p.WINDOWEDAPP then
_p('all: prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist | $(TARGETDIR) $(OBJDIR)')
_p('all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist')
_p('\t@:')
_p('')
_p('$(dir $(TARGETDIR))PkgInfo:')
_p('$(dir $(TARGETDIR))Info.plist:')
else
_p('all: prebuild prelink $(TARGET) | $(TARGETDIR) $(OBJDIR)')
_p('all: $(TARGET)')
_p('\t@:')
end
_p('')
end


function cpp.targetRules(cfg, toolset)
local targets = '$(GCH) '
local targets = ''

for _, kind in ipairs(cfg._gmake.kinds) do
if kind ~= 'OBJECTS' and kind ~= 'RESOURCES' then
Expand All @@ -686,13 +686,23 @@
end

_p('$(TARGET): %s | $(TARGETDIR)', targets)
_p('\t$(PRELINKCMDS)')
_p('\t@echo Linking %s', cfg.project.name)
_p('\t$(SILENT) $(LINKCMD)')
_p('\t$(POSTBUILDCMDS)')
_p('')
end


function cpp.customDeps(cfg, toolset)
for _, kind in ipairs(cfg._gmake.kinds) do
if kind == 'CUSTOM' or kind == 'SOURCES' then
_p('$(%s): | prebuild', kind)
end
end
end


function cpp.cleanRules(cfg, toolset)
_p('clean:')
_p('\t@echo Cleaning %s', cfg.project.name)
Expand All @@ -709,8 +719,8 @@

function cpp.pchRules(cfg, toolset)
_p('ifneq (,$(PCH))')
_p('$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) $(PCH_PLACEHOLDER)')
_p('$(GCH): $(PCH) | $(OBJDIR)')
_p('$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)')
_p('$(GCH): $(PCH) | prebuild')
_p('\t@echo $(notdir $<)')
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)
Expand All @@ -721,7 +731,7 @@
_p('\t$(SILENT) echo $null >> "$@"')
_p('endif')
_p('else')
_p('$(OBJECTS): | $(OBJDIR)')
_p('$(OBJECTS): | prebuild')
_p('endif')
_p('')
end
Expand Down
6 changes: 3 additions & 3 deletions modules/gmake2/gmake2_csharp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
gmake2.objDirRules,
gmake2.csCleanRules,
gmake2.preBuildRules,
gmake2.preLinkRules,
gmake2.csFileRules,
}
end
Expand Down Expand Up @@ -135,7 +134,7 @@
---------------------------------------------------------------------------

function gmake2.csAllRules(prj, toolset)
_p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)')
_p('all: prebuild $(EMBEDFILES) $(COPYFILES) $(TARGET)')
_p('')
end

Expand Down Expand Up @@ -304,7 +303,8 @@


function gmake2.csTargetRules(prj, toolset)
_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS) $(RESPONSE)')
_p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS) $(RESPONSE) | $(TARGETDIR)')
_p('\t$(PRELINKCMDS)')
_p('\t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) @$(RESPONSE) $(patsubst %%,/resource:%%,$(EMBEDFILES))')
_p('\t$(POSTBUILDCMDS)')
_p('')
Expand Down
6 changes: 3 additions & 3 deletions modules/gmake2/gmake2_utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@
utility.targetRules,
gmake2.targetDirRules,
utility.cleanRules,
gmake2.preBuildRules,
gmake2.preLinkRules,
}
end

Expand All @@ -309,7 +307,7 @@


function utility.allRules(cfg, toolset)
local allTargets = 'all: $(TARGETDIR) prebuild prelink $(TARGET)'
local allTargets = 'all: $(TARGETDIR) $(TARGET)'
for _, kind in ipairs(cfg._gmake.kinds) do
allTargets = allTargets .. ' $(' .. kind .. ')'
end
Expand All @@ -327,6 +325,8 @@
end

_p('$(TARGET): %s', targets)
_p('\t$(PREBUILDCMDS)')
_p('\t$(PRELINKCMDS)')
_p('\t$(POSTBUILDCMDS)')
_p('')
end
Expand Down
12 changes: 6 additions & 6 deletions modules/gmake2/tests/test_gmake2_pch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ PCH = ../../../src/host/premake.h
prepareRules()
test.capture [[
ifneq (,$(PCH))
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | $(OBJDIR)
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | prebuild
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
Expand All @@ -108,7 +108,7 @@ else
$(SILENT) echo $null >> "$@"
endif
else
$(OBJECTS): | $(OBJDIR)
$(OBJECTS): | prebuild
endif
]]
end
Expand All @@ -124,8 +124,8 @@ endif
prepareRules()
test.capture [[
ifneq (,$(PCH))
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR) $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | $(OBJDIR)
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | prebuild
@echo $(notdir $<)
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
Expand All @@ -135,7 +135,7 @@ else
$(SILENT) echo $null >> "$@"
endif
else
$(OBJECTS): | $(OBJDIR)
$(OBJECTS): | prebuild
endif
]]
end
Expand Down
4 changes: 2 additions & 2 deletions modules/gmake2/tests/test_gmake2_target_rules.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
function suite.defaultRules()
prepare()
test.capture [[
all: prebuild prelink $(TARGET) | $(TARGETDIR) $(OBJDIR)
all: $(TARGET)
@:
]]
end
Expand All @@ -51,7 +51,7 @@ all: prebuild prelink $(TARGET) | $(TARGETDIR) $(OBJDIR)
kind "WindowedApp"
prepare()
test.capture [[
all: prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist | $(TARGETDIR) $(OBJDIR)
all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist
@:

$(dir $(TARGETDIR))PkgInfo:
Expand Down