1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# <%= premake.actions[_ACTION].shortname %> project makefile autogenerated by Premake
ifndef CONFIG
CONFIG=<%= _MAKE.esc(this.configurations[1]) %>
endif
<% for cfg in premake.eachconfig(this) do %>
ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
TARGETDIR = <%= _MAKE.esc(path.getdirectory(cfg.target)) %>
TARGET = $(TARGETDIR)/<%= _MAKE.esc(path.getname(premake.gettargetfile(cfg, "target", nil, true))) %>
OBJDIR = <%= _MAKE.esc(premake.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(_MAKE.gettargetdeps(cfg), " ") %>
<% if cfg.kind == "StaticLib" then %>
LINKCMD = ar -rcs $(TARGET) $(OBJECTS) $(ARCH)
<% else %>
LINKCMD = $(<%= iif(cfg.language == "C", "CC", "CXX") %>) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH)
<% end %>
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 == "WindowedApp" 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 %>
@$(LINKCMD)
$(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)
|