From 27c509fc552013ba07e80cfcee1be1e8bf813dbc Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Sat, 21 Aug 2010 18:07:12 +0000 Subject: makefiles - some functions don't need to return their output, drop $(shell ... ) and prefix with $(SILENT), make V=1 will show the complete scripts being run - tweak make.dep generation: make the temporary file appear in root.make only, and remove a useless "real command", there is already a real command (mv) - make addtargetdir.pl terminate its output with a newline ($(shell) did that for us) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27855 a1c6a512-1295-4272-9138-f99709370657 --- tools/addtargetdir.pl | 1 + tools/functions.make | 20 +++++++++----------- tools/root.make | 13 ++++++------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/tools/addtargetdir.pl b/tools/addtargetdir.pl index 6a9a72a878..bf5fe8a144 100755 --- a/tools/addtargetdir.pl +++ b/tools/addtargetdir.pl @@ -39,3 +39,4 @@ for (split(/[\s\\]+/m, )) { print " \\\n $src"; } } +print "\n"; diff --git a/tools/functions.make b/tools/functions.make index 748263359e..0d8518c0ff 100644 --- a/tools/functions.make +++ b/tools/functions.make @@ -22,33 +22,31 @@ preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) | grep -v '^\#' | \ sed -e 's:^..*:$(dir $(1))&:') -preprocess2file = $(shell $(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \ - grep -v '^\#' | grep -v "^$$" > $(2)) +preprocess2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -E -P -x c -include config.h $(1) | \ + grep -v '^\#' | grep -v "^$$" > $(2) -asmdefs2file = $(shell $(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \ - perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $2) +asmdefs2file = $(SILENT)$(CC) $(PPCFLAGS) $(3) -S -x c -o - -include config.h $(1) | \ + perl -ne 'if(/^_?AD_(\w+):$$/){$$var=$$1}else{/^\W\.(?:word|long)\W(.*)$$/ && $$var && print "\#define $$var $$1\n";$$var=0}' > $(2) c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1)))) -# calculate dependencies for a list of source files $(2) and output them -# to a file $(1)_, to be later renamed to $(1). -mkdepfile = $(shell \ - perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \ +# calculate dependencies for a list of source files $(2) and output them to $(1) +mkdepfile = $(SILENT)perl $(TOOLSDIR)/multigcc.pl $(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h -- $(2) | \ sed -e "s: lang.h: lang/lang.h:" \ -e 's:_asmdefs.o:_asmdefs.h:' \ -e "s: max_language_size.h: lang/max_language_size.h:" | \ $(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \ - >> $(1)_) + >> $(1) # function to create .bmp dependencies -bmpdepfile = $(shell \ +bmpdepfile = $(SILENT) \ for each in $(2); do \ obj=`echo $$each | sed -e 's/\.bmp/.o/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \ src=`echo $$each | sed -e 's/\.bmp/.c/' -e 's:$(ROOTDIR):$(BUILDDIR):'`; \ echo $$obj: $$src; \ echo $$src: $$each; \ done \ - >> $(1); ) + >> $(1) ifndef V SILENT:=@ diff --git a/tools/root.make b/tools/root.make index 6ed1fc343b..4aff793abc 100644 --- a/tools/root.make +++ b/tools/root.make @@ -110,12 +110,11 @@ $(RBINFO): $(BUILDDIR)/$(BINARY) $(DEPFILE) dep: $(call PRINTS,Generating dependencies) - @echo foo > /dev/null # there must be a "real" command in the rule - $(call mkdepfile,$(DEPFILE),$(SRC)) - $(call mkdepfile,$(DEPFILE),$(OTHER_SRC:%.lua=)) - $(call mkdepfile,$(DEPFILE),$(ASMDEFS_SRC)) + $(call mkdepfile,$(DEPFILE)_,$(SRC)) + $(call mkdepfile,$(DEPFILE)_,$(OTHER_SRC:%.lua=)) + $(call mkdepfile,$(DEPFILE)_,$(ASMDEFS_SRC)) + $(call bmpdepfile,$(DEPFILE)_,$(BMP) $(PBMP)) @mv $(DEPFILE)_ $(DEPFILE) - $(call bmpdepfile,$(DEPFILE),$(BMP) $(PBMP)) bin: $(DEPFILE) $(TOOLS) $(BUILDDIR)/$(BINARY) $(RBINFO) rocks: $(DEPFILE) $(TOOLS) $(ROCKS) @@ -220,8 +219,8 @@ $(BUILDDIR)/rombox.ucl: $(BUILDDIR)/rombox.bin $(MAXOUTFILE) $(MAXOUTFILE): $(call PRINTS,Creating $(@F)) - $(SILENT)$(shell echo '#include "config.h"' > $(MAXINFILE)) - $(SILENT)$(shell echo "ROM_START" >> $(MAXINFILE)) + $(SILENT)echo '#include "config.h"' > $(MAXINFILE) + $(SILENT)echo "ROM_START" >> $(MAXINFILE) $(call preprocess2file,$(MAXINFILE),$(MAXOUTFILE)) $(SILENT)rm $(MAXINFILE) -- cgit