Advertising
- Zeug
- Friday, September 28th, 2007 at 2:06:18pm MDT
- #!/bin/sh
- #
- # __________ __ ___.
- # Open \______ \ ____ ____ | | _\_ |__ _______ ___
- # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- # \/ \/ \/ \/ \/
- #
- #
- # Copyright (c) 2007 Alexander Levin
- #
- #
- # This script produces the file "menu_call_stats_list.c" containing
- # pointers to the call statistics for all menu items in the core RockBox.
- # Files with menu items that should get into this list must be compiled
- # so that all the temporary files are kept (in particular, the result of
- # the preprocessing). Usually this is done by including '-save-temps' into
- # the list of the compiler options. In that case, the preprocessed files
- # have the extension '.i' and are stored in the same directory as the
- # original '.c' files.
- BASE_NAME = $(OBJDIR)/menu_call_stats_list
- TMP_NAME = $(BASE_NAME).tmp
- OUT_NAME = $(BASE_NAME).c
- STRUCT = "struct s_call_stats"
- # Process all *.i files (results of the preprocessing), find strings where
- # stat structs are defined, isolate the definitions, and put them all to a
- # temporary file.
- find . -name "$(APPSDIR)/*.i" -exec grep "$(STRUCT) item_call" {} \; | sed -e "s/.*\($(STRUCT) item[^ ]*\) .*/\1/" | sort > $(TMP_NAME)
- #
- # Now produce the .c file with the array containing addresses of all the structs.
- #
- echo "/* This file was generated automatically. Please do not edit. */" > $(OUT_NAME)
- echo "#include \"menu.h\"" >> $(OUT_NAME)
- echo "" >> $(OUT_NAME)
- cat $(TMP_NAME) | sed -e "s/\(.*\)/extern \1;/" >> $(OUT_NAME)
- echo "" >> $(OUT_NAME)
- echo "$(STRUCT)" *menu_call_stats_list[] = {" >> $(OUT_NAME)
- cat $(TMP_NAME) | sed -e "s/.* \(.*\)/ \&\1,/" >> $(OUT_NAME)
- echo "};" >> $(OUT_NAME)
- # Delete the temporary file
- rm $(TMP_NAME)
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.