* platform.h
@ 2001-11-30 11:39 Paul Mackerras
0 siblings, 0 replies; only message in thread
From: Paul Mackerras @ 2001-11-30 11:39 UTC (permalink / raw)
To: linuxppc-dev
Here is the code that Keith sent me to create platform.h and
platform_serial.h. It took me a while to understand it too. :)
To make this work we need to make archdep and include/config/MARKER
depend on platformlinks.
Paul.
# h_files: List of architecture specific platform .h files.
# suffices: The standard set of suffices to generate.
# dir: The directory to hold the generated files.
# platform: The platform that has been selected. It is extracted by looking
# for the magic string in all h_files, converting the filename and
# config from each magic string to a sed command, using that sed
# command to find matching options in .config then printing the
# corresponding platform name. platform must contain exactly one
# string.
# After the platform has been identified, temporary versions of the target files
# are created from the suffix list, making empty files if necessary. The result
# is compared against the existing files which are only updated if anything has
# changed.
platformlinks:
@set -e; \
h_files="$(wildcard include/asm-$(ARCH)/platforms/*.h)"; \
suffices=".h _serial.h"; \
dir="arch/$(ARCH)"; \
platform=`grep "^/\\* Copy to platform.h if CONFIG_[^ ]*=y \\*/\$$" $$h_files | \
(echo "/^CONFIG/{h;"; \
sed -e "s%.*/\\([^/.]*\\)\\.h:.*\\(CONFIG_[^ ]*=y\\).*%g; s/^\\2\$$/\\1/p;%"; \
echo "}") | \
sed -nf - .config`; \
platform=`echo $$platform`; \
if [ -z "$$platform" ]; then echo "No $(ARCH) platform found in .config" >&2; /bin/false; fi; \
if expr "$$platform" : ".* " > /dev/null; then echo "Multiple $(ARCH) platforms ($$platform) found in .config" >&2; /bin/false; fi; \
for i in $$suffices; do \
output=$$dir/platform$$i; \
tmp_output=$$dir/.tmp_platform$$i; \
input=`echo " $$h_files " | sed -ne "\\:/$$platform$$i :s%.* \\([^ ]*/$$platform$$i\\) .*%\\1%p"`; \
rm -f $$tmp_output; \
[ -z "$$input" ] && touch $$tmp_output || cp $$input $$tmp_output; \
cmp -s $$tmp_output $$output || (echo "Updating $$output for $$platform"; mv $$tmp_output $$output); \
rm -f $$tmp_output; \
done;
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-11-30 11:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-30 11:39 platform.h Paul Mackerras
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).