summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2009-07-13 00:40:35 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2009-07-13 00:40:35 +0000
commit668a769ca4cabdfee54dc53e92a964c32c9738d7 (patch)
treea4c42168e4b86d4b7e09533307ae070fd3c7bcc0 /tools
parent36eeecbe9a91a5da8bd82ee3974c359f4534dd14 (diff)
downloadrockbox-668a769ca4cabdfee54dc53e92a964c32c9738d7.tar.gz
rockbox-668a769ca4cabdfee54dc53e92a964c32c9738d7.zip
Add new asmdefs mechanism for exporting information only available to the C compiler for use in asm files, and use it in arm jpeg idct. See apps/apps.make, apps/core_asmdefs.c, and apps/recorder/jpeg_idct_arm.S for details.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21831 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/addtargetdir.pl1
-rw-r--r--tools/functions.make4
-rw-r--r--tools/root.make11
3 files changed, 14 insertions, 2 deletions
diff --git a/tools/addtargetdir.pl b/tools/addtargetdir.pl
index 6a9a72a878..2868e9027b 100755
--- a/tools/addtargetdir.pl
+++ b/tools/addtargetdir.pl
@@ -23,6 +23,7 @@ my $src;
# Split the input file on any runs of '\' and whitespace.
for (split(/[\s\\]+/m, <STDIN>)) {
/^(\/)?[^:]+(\:)?$/;
+print ">>$& $src"
# Save target and continue if this item ends in ':'
if (!($2 && ($target=$&))) {
$src = $&;
diff --git a/tools/functions.make b/tools/functions.make
index 66354ebc18..ba444267c4 100644
--- a/tools/functions.make
+++ b/tools/functions.make
@@ -25,6 +25,9 @@ preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c -include config.h $(1) |
preprocess2file = $(shell $(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\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
@@ -32,6 +35,7 @@ c2obj = $(addsuffix .o,$(basename $(subst $(ROOTDIR),$(BUILDDIR),$(1))))
mkdepfile = $(shell \
$(CC) $(PPCFLAGS) $(OTHER_INC) -MG -MM -include config.h $(2) | \
sed -e "s: lang.h: lang/lang_core.o:" \
+ -e 's:_asmdefs.o:_asmdefs.h:' \
-e "s: max_language_size.h: lang/max_language_size.h:" | \
$(TOOLSDIR)/addtargetdir.pl $(ROOTDIR) $(BUILDDIR) \
>> $(1)_)
diff --git a/tools/root.make b/tools/root.make
index 00586379c6..8a923983f9 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -51,8 +51,8 @@ endif
all: $(DEPFILE) build
-# Subdir makefiles. their primary purpose is to populate SRC & OTHER_SRC
-# but they also define special dependencies and compile rules
+# Subdir makefiles. their primary purpose is to populate SRC, OTHER_SRC &
+# ASMDEFS_SRC but they also define special dependencies and compile rules
include $(TOOLSDIR)/tools.make
include $(FIRMDIR)/firmware.make
include $(ROOTDIR)/apps/bitmaps/bitmaps.make
@@ -96,6 +96,7 @@ $(DEPFILE) dep:
@echo foo > /dev/null # there must be a "real" command in the rule
$(call mkdepfile,$(DEPFILE),$(SRC))
$(call mkdepfile,$(DEPFILE),$(OTHER_SRC))
+ $(call mkdepfile,$(DEPFILE),$(ASMDEFS_SRC))
@mv $(DEPFILE)_ $(DEPFILE)
$(call bmpdepfile,$(DEPFILE),$(BMP) $(PBMP))
@@ -317,6 +318,12 @@ $(BUILDDIR)/%.o: $(ROOTDIR)/%.S
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) $(CFLAGS) -c $< -o $@
+# generated definitions for use in .S files
+$(BUILDDIR)/%_asmdefs.h: $(ROOTDIR)/%_asmdefs.c
+ $(call PRINTS,ASMDEFS $(@F))
+ $(SILENT)mkdir -p $(dir $@)
+ $(call asmdefs2file,$<,$@)
+
# when source and object are both in BUILDDIR (generated code):
%.o: %.c
$(SILENT)mkdir -p $(dir $@)