Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions/make/make_cpp_project.tmpl')
-rw-r--r--src/actions/make/make_cpp_project.tmpl99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/actions/make/make_cpp_project.tmpl b/src/actions/make/make_cpp_project.tmpl
new file mode 100644
index 0000000..baf7211
--- /dev/null
+++ b/src/actions/make/make_cpp_project.tmpl
@@ -0,0 +1,99 @@
+# <%= premake.actions[_ACTION].shortname %> project makefile autogenerated by Premake
+
+ifndef CONFIG
+ CONFIG=<%= make.esc(this.configurations[1]) %>
+endif
+
+<% for cfg in premake.project.configs(this) do %>
+ifeq ($(CONFIG),<%= make.esc(cfg.name)%>)
+ TARGETDIR = <%= make.esc(path.getdirectory(cfg.target)) %>
+ TARGET = $(TARGETDIR)/<%= make.esc(path.getname(cfg.target)) %>
+ OBJDIR = <%= make.esc(premake.project.getobjdir(cfg)) %>
+ DEFINES += <%= premake.tools[_OPTIONS.cc].make_defines(cfg) %>
+ INCLUDES += <%= premake.tools[_OPTIONS.cc].make_includes(cfg) %>
+ CPPFLAGS += <%= premake.tools[_OPTIONS.cc].make_cppflags(cfg) %> $(DEFINES) $(INCLUDES)
+ CFLAGS += $(CPPFLAGS) $(ARCH) <%= premake.tools[_OPTIONS.cc].make_cflags(cfg) %> <%= table.concat(cfg.buildoptions, " ") %>
+ CXXFLAGS += $(CFLAGS) <%= premake.tools[_OPTIONS.cc].make_cxxflags(cfg) %>
+ LDFLAGS += <%= premake.tools[_OPTIONS.cc].make_ldflags(cfg) %> <%= table.concat(cfg.linkoptions, " ") %>
+ RESFLAGS += $(DEFINES) $(INCLUDES) <%= table.concat(cfg.resoptions, " ") %>
+ LDDEPS += <%= table.concat(premake.project.getlibraries(cfg, premake.project.getdependencies(cfg))) %>
+endif
+
+<% end %>
+
+OBJECTS := \
+<% for _, file in ipairs(this.files) do %>
+<% if path.iscppfile(file) then %>
+ $(OBJDIR)/<%= make.esc(path.getbasename(file)) %>.o \
+<% end %>
+<% end %>
+
+RESOURCES := \
+<% for _, file in ipairs(this.files) do %>
+<% if path.isresourcefile(file) then %>
+ $(OBJDIR)/<%= make.esc(path.getbasename(file)) %>.res \
+<% end %>
+<% end %>
+
+SHELLTYPE := msdos
+ifeq (,$(ComSpec)$(COMSPEC))
+ SHELLTYPE := posix
+endif
+ifeq (/bin,$(findstring /bin,$(SHELL)))
+ SHELLTYPE := posix
+endif
+
+ifeq (posix,$(SHELLTYPE))
+ MKDIR := mkdir -p
+ PATHSEP := /
+else
+ MKDIR := mkdir
+ PATHSEP := \\
+endif
+
+SYS_TARGET := $(subst /,$(PATHSEP),$(TARGET))
+SYS_TARGETDIR := $(subst /,$(PATHSEP),$(TARGETDIR))
+SYS_OBJDIR := $(subst /,$(PATHSEP),$(OBJDIR))
+
+.PHONY: clean
+
+<% if os.is("MacOSX") and this.kind == "WindowedExe" then %>
+all: $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist
+
+$(dir $(TARGETDIR))PkgInfo:
+
+$(dir $(TARGETDIR))Info.plist:
+<% end %>
+
+$(TARGET): $(TARGETDIR) $(OBJDIR) $(OBJECTS) $(LDDEPS) $(RESOURCES)
+ @echo Linking <%= this.name %>
+ @$(CXX) -o $@ $(LDFLAGS) $(ARCH) $(OBJECTS) $(RESOURCES)
+
+$(TARGETDIR):
+ @echo Creating $@
+ @$(MKDIR) $(SYS_TARGETDIR)
+
+$(OBJDIR):
+ @echo Creating $@
+ @$(MKDIR) $(SYS_OBJDIR)
+
+clean:
+ @echo Cleaning <%= this.name %>
+ifeq (posix,$(SHELLTYPE))
+ @rm -f $(TARGET)
+ @rm -rf $(OBJDIR)
+else
+ @if exist $(SYS_TARGET) del $(SYS_TARGET)
+ @if exist $(SYS_OBJDIR) rmdir /s /q $(SYS_OBJDIR)
+endif
+
+<% for _, file in ipairs(this.files) do %>
+<% if path.iscppfile(file) then %>
+$(OBJDIR)/<%= make.esc(path.getbasename(file)) %>.o: <%= make.esc(file) %>
+ @echo $(notdir $<)
+ @<%= premake.tools[_OPTIONS.cc].make_file_rule(file) %>
+
+<% end %>
+<% end %>
+
+-include $(OBJECTS:%.o=%.d)