Added verbose flag to makefiles: verbose=yes will show commands as run

This commit is contained in:
starkos 2008-12-22 22:05:48 +00:00
parent a90a0b5782
commit 3cdd0d2442
4 changed files with 75 additions and 65 deletions

View File

@ -1,12 +1,17 @@
<% local cc = premake[_OPTIONS.cc] %>
# <%= premake.actions[_ACTION].shortname %> project makefile autogenerated by Premake
ifndef CONFIG
CONFIG=<%= _MAKE.esc(this.configurations[1]) %>
ifndef config
config=<%= _MAKE.esc(this.configurations[1]) %>
endif
ifndef verbose
SILENT = @
endif
<% for cfg in premake.eachconfig(this) do %>
ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
ifeq ($(config),<%= _MAKE.esc(cfg.name)%>)
TARGETDIR = <%= _MAKE.esc(cfg.buildtarget.directory) %>
TARGET = $(TARGETDIR)/<%= _MAKE.esc(cfg.buildtarget.name) %>
OBJDIR = <%= _MAKE.esc(cfg.objectsdir) %>
@ -70,12 +75,12 @@ endif
ifeq (posix,$(SHELLTYPE))
define MKDIR_RULE
@echo Creating $@
@mkdir -p $@
$(SILENT) mkdir -p $@
endef
else
define MKDIR_RULE
@echo Creating $@
@mkdir $(subst /,\\,$@)
$(SILENT) mkdir $(subst /,\\,$@)
endef
endif
@ -104,11 +109,11 @@ $(OBJDIR):
clean:
@echo Cleaning <%= this.name %>
ifeq (posix,$(SHELLTYPE))
@rm -f $(TARGET)
@rm -rf $(OBJDIR)
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(OBJDIR)
else
@if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
@if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild:
@ -122,15 +127,15 @@ prelink:
$(OBJDIR)/<%= _MAKE.esc(path.getbasename(file)) %>.o: <%= _MAKE.esc(file) %>
@echo $(notdir $<)
<% if (path.iscfile(file)) then %>
@$(CC) $(CFLAGS) -o $@ -c $<
$(SILENT) $(CC) $(CFLAGS) -o $@ -c $<
<% else %>
@$(CXX) $(CXXFLAGS) -o $@ -c $<
$(SILENT) $(CXX) $(CXXFLAGS) -o $@ -c $<
<% end %>
<% elseif (path.getextension(file) == ".rc") then %>
$(OBJDIR)/<%= _MAKE.esc(path.getbasename(file)) %>.res: <%= _MAKE.esc(file) %>
@echo $(notdir $<)
@windres $< -O coff -o $@ $(RESFLAGS)
$(SILENT) windres $< -O coff -o $@ $(RESFLAGS)
<% end %>
<% end %>

View File

@ -73,8 +73,12 @@
%>
# <%= premake.actions[_ACTION].shortname %> project makefile autogenerated by Premake
ifndef CONFIG
CONFIG=<%= _MAKE.esc(this.configurations[1]) %>
ifndef config
config=<%= _MAKE.esc(this.configurations[1]) %>
endif
ifndef verbose
SILENT = @
endif
ifndef CSC
@ -85,8 +89,9 @@ ifndef RESGEN
RESGEN=resgen
endif
<% for cfg in premake.eachconfig(this) do %>
ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
ifeq ($(config),<%= _MAKE.esc(cfg.name)%>)
TARGETDIR := <%= _MAKE.esc(cfg.buildtarget.directory) %>
OBJDIR := <%= _MAKE.esc(cfg.objectsdir) %>
DEPENDS := <%= table.concat(_MAKE.esc(premake.getlinks(cfg, "dependencies", "fullpath")), " ") %>
@ -149,20 +154,20 @@ endif
ifeq (posix,$(SHELLTYPE))
define MKDIR_RULE
@echo Creating $@
@mkdir -p $@
$(SILENT) mkdir -p $@
endef
define COPY_RULE
@echo Copying $(notdir $@)
@cp -fR $^ $@
$(SILENT) cp -fR $^ $@
endef
else
define MKDIR_RULE
@echo Creating $@
@mkdir $(subst /,\\,$@)
$(SILENT) mkdir $(subst /,\\,$@)
endef
define COPY_RULE
@echo Copying $(notdir $@)
@copy /Y $(subst /,\\,$^) $(subst /,\\,$@)
$(SILENT) copy /Y $(subst /,\\,$^) $(subst /,\\,$@)
endef
endif
@ -172,7 +177,7 @@ endif
all: $(TARGET) $(COPYFILES)
$(TARGET): $(TARGETDIR) $(OBJDIR) prebuild $(SOURCES) $(EMBEDFILES) $(DEPENDS) prelink
@$(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %,/resource:%,$(EMBEDFILES))
$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %,/resource:%,$(EMBEDFILES))
$(POSTBUILDCMDS)
$(TARGETDIR):
@ -184,17 +189,17 @@ $(OBJDIR):
clean:
@echo Cleaning <%= this.name %>
ifeq (posix,$(SHELLTYPE))
@rm -f $(TARGETDIR)/<%= this.buildtarget.basename %>.* $(COPYFILES)
@rm -rf $(OBJDIR)
$(SILENT) rm -f $(TARGETDIR)/<%= this.buildtarget.basename %>.* $(COPYFILES)
$(SILENT) rm -rf $(OBJDIR)
else
@if exist $(subst /,\\,$(TARGETDIR)/<%= this.buildtarget.basename %>.*) del $(subst /,\\,$(TARGETDIR)/<%= this.buildtarget.basename %>.*)
$(SILENT) if exist $(subst /,\\,$(TARGETDIR)/<%= this.buildtarget.basename %>.*) del $(subst /,\\,$(TARGETDIR)/<%= this.buildtarget.basename %>.*)
<% for target, source in pairs(cfgpairs[anycfg]) do %>
@if exist $(subst /,\\,<%= target %>) del $(subst /,\\,<%= target %>)
$(SILENT) if exist $(subst /,\\,<%= target %>) del $(subst /,\\,<%= target %>)
<% end %>
<% for target, source in pairs(copypairs) do %>
@if exist $(subst /,\\,<%= target %>) del $(subst /,\\,<%= target %>)
$(SILENT) if exist $(subst /,\\,<%= target %>) del $(subst /,\\,<%= target %>)
<% end %>
@if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif
prebuild:
@ -206,7 +211,7 @@ prelink:
# Per-configuration copied file rules
<% for cfg in premake.eachconfig(this) do %>
ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
ifeq ($(config),<%= _MAKE.esc(cfg.name)%>)
<% for target, source in pairs(cfgpairs[cfg]) do %>
<%= _MAKE.esc(target) %>: <%= _MAKE.esc(source) %>
$(COPY_RULE)
@ -223,5 +228,5 @@ endif
# Embedded file rules
<% for _, fname in ipairs(embedded) do if path.getextension(fname) == ".resx" then %>
<%= _MAKE.esc(getresourcefilename(this, fname)) %>: <%= _MAKE.esc(fname) %>
@$(RESGEN) $^ $@
$(SILENT) $(RESGEN) $^ $@
<% end end %>

View File

@ -1,11 +1,11 @@
# <%= premake.actions[_ACTION].shortname %> solution makefile autogenerated by Premake
# Usage: make [ CONFIG=config_name ]
# Usage: make [ config=config_name ]
# Where {config_name} is one of: <%= table.implode(this.configurations, '"', '"', ', ') %>.
ifndef CONFIG
CONFIG=<%= _MAKE.esc(this.configurations[1]) %>
ifndef config
config=<%= _MAKE.esc(this.configurations[1]) %>
endif
export CONFIG
export config
PROJECTS := <%= table.concat(_MAKE.esc(table.extract(this.projects, "name")), " ") %>
@ -15,7 +15,7 @@ all: $(PROJECTS)
<% for _,prj in ipairs(this.projects) do %>
<% for cfg in premake.eachconfig(prj) do %>
ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
ifeq ($(config),<%= _MAKE.esc(cfg.name)%>)
DEPENDENCIES := <%= table.concat(_MAKE.esc(table.extract(premake.getdependencies(cfg), "name")), " ") %>
endif
<% end %>

File diff suppressed because one or more lines are too long