mirror of
https://github.com/xenia-project/premake-core.git
synced 2024-11-27 05:30:26 +00:00
Merge pull request #1105 from tdesveauxPKFX/gmake/fix-targetdir-dep
gmake: Add rules and dependencies for directory creation
This commit is contained in:
commit
d6dfaa3bad
@ -73,18 +73,6 @@
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Don't create $(OBJDIR) in the d-file rules
|
||||
--
|
||||
|
||||
p.override(make, "objDirInFileRules", function(oldfn, prj, node)
|
||||
-- node is nil when making pch rules
|
||||
if not node or not path.isdfile(node.abspath) then
|
||||
oldfn(prj, node)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
---
|
||||
-- Add namespace for element definition lists for p.callarray()
|
||||
|
@ -34,6 +34,9 @@
|
||||
make.cppObjects,
|
||||
make.shellType,
|
||||
make.cppTargetRules,
|
||||
make.cppCustomFilesRules,
|
||||
make.cppTargetDirRules,
|
||||
make.cppObjDirRules,
|
||||
make.cppCleanRules,
|
||||
make.preBuildRules,
|
||||
make.preLinkRules,
|
||||
@ -69,10 +72,6 @@
|
||||
_p('\t@echo $(notdir $<)')
|
||||
end
|
||||
|
||||
function make.objDirInFileRules(prj, node)
|
||||
make.mkdir('$(OBJDIR)')
|
||||
end
|
||||
|
||||
function make.cpp.generate(prj)
|
||||
p.eol("\n")
|
||||
p.callArray(cpp.elements.makefile, prj)
|
||||
@ -85,7 +84,6 @@
|
||||
cpp.elements.standardFileRules = function(prj, node)
|
||||
return {
|
||||
make.fileDependency,
|
||||
make.objDirInFileRules,
|
||||
cpp.standardFileRules,
|
||||
}
|
||||
end
|
||||
@ -93,7 +91,6 @@
|
||||
cpp.elements.customFileRules = function(prj, node)
|
||||
return {
|
||||
make.fileDependency,
|
||||
make.objDirInFileRules,
|
||||
cpp.customFileRules,
|
||||
}
|
||||
end
|
||||
@ -454,14 +451,31 @@ end
|
||||
|
||||
|
||||
function make.cppTargetRules(prj)
|
||||
_p('$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES)')
|
||||
_p('$(TARGET): $(GCH) ${CUSTOMFILES} $(OBJECTS) $(LDDEPS) $(RESOURCES) | $(TARGETDIR)')
|
||||
_p('\t@echo Linking %s', prj.name)
|
||||
make.mkdir('$(TARGETDIR)')
|
||||
_p('\t$(SILENT) $(LINKCMD)')
|
||||
_p('\t$(POSTBUILDCMDS)')
|
||||
_p('')
|
||||
end
|
||||
|
||||
function make.cppCustomFilesRules(prj)
|
||||
_p('$(CUSTOMFILES): | $(OBJDIR)')
|
||||
_p('')
|
||||
end
|
||||
|
||||
function make.cppTargetDirRules(prj)
|
||||
_p('$(TARGETDIR):')
|
||||
_p('\t@echo Creating $(TARGETDIR)')
|
||||
make.mkdir('$(TARGETDIR)')
|
||||
_p('')
|
||||
end
|
||||
|
||||
function make.cppObjDirRules(prj)
|
||||
_p('$(OBJDIR):')
|
||||
_p('\t@echo Creating $(OBJDIR)')
|
||||
make.mkdir('$(OBJDIR)')
|
||||
_p('')
|
||||
end
|
||||
|
||||
function make.cppTools(cfg, toolset)
|
||||
local tool = toolset.gettoolname(cfg, "cc")
|
||||
@ -600,14 +614,15 @@ end
|
||||
|
||||
function make.pchRules(prj)
|
||||
_p('ifneq (,$(PCH))')
|
||||
_p('$(OBJECTS): $(GCH) $(PCH)')
|
||||
_p('$(GCH): $(PCH)')
|
||||
_p('$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)')
|
||||
_p('$(GCH): $(PCH) | $(OBJDIR)')
|
||||
_p('\t@echo $(notdir $<)')
|
||||
make.objDirInFileRules(prj, nil)
|
||||
|
||||
local cmd = iif(prj.language == "C", "$(CC) -x c-header $(ALL_CFLAGS)", "$(CXX) -x c++-header $(ALL_CXXFLAGS)")
|
||||
_p('\t$(SILENT) %s -o "$@" -MF "$(@:%%.gch=%%.d)" -c "$<"', cmd)
|
||||
|
||||
_p('else')
|
||||
_p('$(OBJECTS): | $(OBJDIR)')
|
||||
_p('endif')
|
||||
_p('')
|
||||
end
|
||||
|
@ -37,19 +37,9 @@
|
||||
test.capture [[
|
||||
$(OBJDIR)/hello.o: src/greetings/hello.cpp
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/hello1.o: src/hello.cpp
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
]]
|
||||
@ -66,19 +56,9 @@ endif
|
||||
test.capture [[
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
$(OBJDIR)/test.o: src/test.cpp
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
|
||||
]]
|
||||
@ -96,11 +76,6 @@ endif
|
||||
test.capture [[
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
ifeq ($(config),debug)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
endif
|
||||
@ -109,11 +84,6 @@ ifeq ($(config),release)
|
||||
endif
|
||||
$(OBJDIR)/test.o: src/test.c
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
]]
|
||||
end
|
||||
@ -130,11 +100,6 @@ endif
|
||||
test.capture [[
|
||||
$(OBJDIR)/hello.o: src/hello.c
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
ifeq ($(config),debug)
|
||||
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
endif
|
||||
@ -143,11 +108,6 @@ ifeq ($(config),release)
|
||||
endif
|
||||
$(OBJDIR)/test.o: src/test.c
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||
]]
|
||||
end
|
||||
|
@ -93,15 +93,12 @@
|
||||
prepareRules()
|
||||
test.capture [[
|
||||
ifneq (,$(PCH))
|
||||
$(OBJECTS): $(GCH) $(PCH)
|
||||
$(GCH): $(PCH)
|
||||
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
|
||||
$(GCH): $(PCH) | $(OBJDIR)
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||
else
|
||||
$(OBJECTS): | $(OBJDIR)
|
||||
endif
|
||||
]]
|
||||
end
|
||||
@ -117,15 +114,12 @@ endif
|
||||
prepareRules()
|
||||
test.capture [[
|
||||
ifneq (,$(PCH))
|
||||
$(OBJECTS): $(GCH) $(PCH)
|
||||
$(GCH): $(PCH)
|
||||
$(OBJECTS): $(GCH) $(PCH) | $(OBJDIR)
|
||||
$(GCH): $(PCH) | $(OBJDIR)
|
||||
@echo $(notdir $<)
|
||||
ifeq (posix,$(SHELLTYPE))
|
||||
$(SILENT) mkdir -p $(OBJDIR)
|
||||
else
|
||||
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||
endif
|
||||
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||
else
|
||||
$(OBJECTS): | $(OBJDIR)
|
||||
endif
|
||||
]]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user