Hash :
1a08f436
Author :
Date :
2010-08-25T09:23:17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
# ========== Copyright Header Begin ==========================================
#
# Hypervisor Software File: common.mk
#
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
#
# - Do no alter or remove copyright notices
#
# - Redistribution and use of this software in source and binary forms, with
# or without modification, are permitted provided that the following
# conditions are met:
#
# - Redistribution of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# - Redistribution in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# Neither the name of Sun Microsystems, Inc. or the names of contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# This software is provided "AS IS," without a warranty of any kind.
# ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
# INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
# MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
# ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
# DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
# OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
# FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
# DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
# ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
# SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# You acknowledge that this software is not designed, licensed or
# intended for use in the design, construction, operation or maintenance of
# any nuclear facility.
#
# ========== Copyright Header End ============================================
# id: @(#)common.mk 1.22 06/02/16
# purpose:
# copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
# copyright: Use is subject to license terms.
include ${ROOT}/default.mk
include ${ROOT}/tools/depend.mk
include ${BP}/forth.mk
include ${ROOT}/release.mk
# Include the platform specific flags for building
FFLAGS += ${PLATFLAGS}
# MAGIC files:
# When you build do a touch <thing> and you get more information
# VERBOSE = show the filenames as they load
# EXTERNAL = force all fcode symbols to be external
# NOTIFY = make the Tokenizing message appear
# WARNING = enable the tokenizer warning messages
# HEADERS = include the 'headers' dropin for added symbols
# FCODE-HEADERS = force non-external fcode symbols to have headers
# FCODE-HEADERLESS = force non-external fcode symbols to be headerless
#DECOMPSIZ = ${SIZE} -f decomp.o | \
# ${AWK} -F+ '{ print $$1 $$2 }' |\
# ${AWK} -F\( ' { print $$2, $$1 }' |\
# ${AWK} '{ print $$2+($$3+3)-(($$3+3) % 4) }'
DECOMPSIZ = ${SIZE} -f decomp.o | \
${SED} -e 's/+/ /g' -e 's/(./ /g' -e 's/)//g' |\
${AWK} -f getsz.awk
DECOMPSIZE = ${DECOMPSIZ:sh}
# Dont define NormalMAP or CompressMAP; If you want to specify a mapfile
# just define MAPFILE.
GetMAP = if [ -z "${MAPFILE}" ]; \
then /bin/echo ${SUN4U}/openboot${ROMSIZE}.map; \
else /bin/echo ${MAPFILE}; \
fi
NormalMAP = ${GetMAP:sh}
VERBOSE:sh = if [ -f VERBOSE ]; \
then /bin/echo '-v'; \
elif [ -f ../../VERBOSE ]; \
then /bin/echo '-v'; \
else /bin/echo ; fi ;
COMPILER64:sh = if [ \( -f /usr/bin/optisa -a \
"`/usr/bin/optisa sparcv9`" = "sparcv9" \) ]; \
then /bin/echo '${BP}/os/unix/sparcv9/forth' ;\
else /bin/echo '${BP}/os/unix/simforth/sparc/simforth' ; fi ;
FORTH64 = ${COMPILER64}
NOTIFY:sh = if [ -f NOTIFY ]; \
then /bin/echo "/bin/echo"; \
else /bin/echo "/bin/true"; fi;
WARNINGS:sh = if [ -f WARNING ];\
then /bin/echo "off"; \
else /bin/echo "on"; fi ;
EXTERNAL:sh = if [ -f EXTERNAL ];\
then /bin/echo "force-external? on"; fi
FCODE-HEADERS:sh = if [ -f FCODE-HEADERS ];\
then /bin/echo "force-headers? on"; fi
FCODE-HEADERLESS:sh = if [ -f FCODE-HEADERLESS ];\
then /bin/echo "force-headerless? on"; fi
FTHFLAGS =
TOKFLAGS = aout-header? off\
silent ${WARNINGS}\
${EXTERNAL} ${FCODE-HEADERS} ${FCODE-HEADERLESS}
HDEBUG:sh = if [ -f HEADERS ]; \
then echo headers.di; fi
FORTHDI = ${HDEBUG}
# .SUFFIXES: .fc .tok ${SUFFIXES}
etags: ${TOOLS}/fscope fscope.idx FORCE
( BP=${BP}; export BP; \
${TOOLS}/fscope -a -e -o etags -m etag -f fscope.idx; )
tags: ${TOOLS}/fscope fscope.idx FORCE
( BP=${BP}; export BP; \
${TOOLS}/fscope -a -e -o tags -m tag -f fscope.idx; )
decomp.o: ${TOOLDIR}/decomp.c
${ECHO} Compiling $@
${RM} $@
${CC} -DSTANDALONE -fast -c ${TOOLDIR}/decomp.c -o decomp.o
# Provide mechanisms to reuse loadprom, config and dropins files from other
# platforms
#
DROPIN_SRC = if [ -z "${DROPINSRC}" ]; \
then /bin/echo ${PLATFORM}/release/dropins.src; \
else /bin/echo ${DROPINSRC}; fi
LOADPROM = if [ -z "${LOADFILE}" ]; \
then /bin/echo ${PLATFORM}/loadprom.fth; \
else /bin/echo ${LOADFILE}; fi
CONFIGLOAD = if [ -z "${CONFIG}" ]; \
then if [ -f ${PLATFORM}/setup/configload.fth -o \
-f ${PLATFORM}/setup/SCCS/s.configload.fth ]; \
then /bin/echo ${PLATFORM}/setup/configload.fth; \
else /bin/echo ; fi \
else /bin/echo ${CONFIG}; fi
# If the makefile variable or the file MINI_T32 exists then we don't build
# t16 kernels.
MINI_T = if [ -z "${MINI_T32}" -a ! -f "MINI_T32" ]; \
then /bin/echo "-t16"; \
else /bin/echo; fi
MINIFORTH = ${BP}/fm/kernel/sparc/k64mini${MINI_T:sh}
config.bin: ../config.mk ${CONFIGLOAD:sh}
config.bin: ${FORTH64} ${MINIFORTH}.dic
${NOTIFY} "Building config.bin (${MINI_T:sh})"
( BP=${BP}; export BP; ${FORTH64} -e 800 \
-d ${MINIFORTH}.dic \
${VERBOSE} ${RELEASE} ${FFLAGS} \
-D kernel-hdr-file=${MINIFORTH}.fth \
-D LOADFILE=${CONFIGLOAD:sh} \
-D SAVEFILE=config.bin \
-D MINIFORTH \
${BP}/arch/preload.fth )
${TOUCH} headers
${SORT} +1 headers > config.headers
config.idx: ${PLATFORM}/setup/configload.fth
config.idx: ${FORTH64} ${MINIFORTH}-xref.dic
${NOTIFY} Building config.idx
( BP=${BP}; export BP; ${FORTH64} -e 800 \
-D MINIFORTH ${RELEASE} -D XREF -x config.idx \
-d ${MINIFORTH}-xref.dic ${FFLAGS} \
-D XREF-PRELOAD=${MINIFORTH}-xref.dic.idx \
-D kernel-hdr-file=${MINIFORTH}-xref.fth \
-D LOADFILE=${PLATFORM}/setup/configload.fth \
${BP}/arch/preload.fth )
reset.o: ../reset.mk stand.dic
reset.o: ${FORTH64} ${RESET} ${BP}/arch/preload.fth
${NOTIFY} Building reset.o
${GREP} headerless acfheaders > headerless
${RM} $@
( BP=${BP}; export BP; ${COMPILER64} \
-D dropin-mode -D TARGET-FILE=$@ \
-D RESET -D LOADFILE=${RESET} \
-e 900 -d stand.dic ${VERBOSE} ${FFLAGS} \
-s "d# ${DECOMPSIZE} constant decomp-size" \
-s " warning off" headerless \
${BP}/arch/preload.fth )
${RM} headerless
reset.bin: decomp.o reset.o ${NormalMAP} ${ELF2BIN}
${LD} -dn -e reset -M ${NormalMAP} reset.o decomp.o -o reset.elf
${ELF2BIN} reset.elf reset.bin
${RM} reset.elf
openboot.bin: builtin.di ${MAKEPROM} reset.bin
${NOTIFY} Building $@
${MAKEPROM} ${MAKEPROM-FLAGS} -o openboot.bin -n reset.bin builtin.di
clean::
${RM} config.bin bootprom.bin reset.bin obp.bin
${RM} config.di bootprom.di resetdi.o *.idx
DATEFMT='+td %M td %H bwjoin td %d td %m bwjoin wljoin td %Y lxjoin'
stand.dic: bootprom.bin
forth.o: bootprom.bin
${ECHO} REMOVE THIS TARGET $@
FIRMWAREREL = cat ${BP}/firmware.rel
bootprom.bin: ${RESET}
bootprom.bin: ${BP}/firmware.rel ${CONFIGLOAD:sh} ${SUBREL-FILES:sh}
bootprom.bin: ${LOADPROM:sh} ${BP}/arch/preload.fth
bootprom.bin: ${FORTH64} ${KERNEL.DIC} builtin.fth
${NOTIFY} "Building Openboot forth image (bootprom.bin)"
${RM} $@ stand.dic sub-release headers
if [ ! -f revlevel ]; then echo 0 > revlevel; fi
${ECHO} "headerless" > version.fth
${ECHO} `date ${DATEFMT}` >> version.fth
${ECHO} "constant compile-signature" >> version.fth
${ECHO} "create (sub-release ,\" ${SUB-RELEASE}\"" >> version.fth
${ECHO} "create (obp-release ,\" ${FIRMWAREREL:sh}\"" >> version.fth
${ECHO} "' (sub-release is sub-release" >> version.fth
${ECHO} "' (obp-release is obp-release" >> version.fth
${ECHO} "headers" >> version.fth
${EXPR} `cat revlevel` + 1 > revlevel
( BP=${BP}; export BP; ${FORTH64} -e 800 \
-d ${KERNEL.DIC} ${VERBOSE} ${FFLAGS} ${RELEASE} \
-D kernel-hdr-file=${KERNEL}.fth \
-D LOADFILE=${LOADPROM:sh} \
-D SAVEFILE=bootprom.bin \
${BP}/arch/preload.fth )
${TOUCH} headers
${SORT} +1 headers > acfheaders
fscope.idx: ${FORTH64} ${KERNEL}-xref.dic bootprom.bin
${NOTIFY} Creating $@
( BP=${BP}; export BP; ${FORTH64} -e 800 \
-d ${KERNEL}-xref.dic ${FFLAGS} ${RELEASE} \
-D kernel-hdr-file=${KERNEL}-xref.fth \
-D XREF-PRELOAD=${KERNEL}-xref.dic.idx \
-D XREF -x fscope.idx \
-D LOADFILE=${LOADPROM:sh} \
${BP}/arch/preload.fth )
clean:: ${DIDEPEND} ${DROPIN_SRC:sh}
${RM} dropins.mk builtin.fth
${RM} forth.bin openboot.bin
${RM} forth.bin0 openboot.bin0
${RM} forth.out openboot.prom
${RM} reset.o decomp.o forth.o cforth.o
${RM} version.fth lastversion.fth stand.dic
${RM} kbdtrans.fc sun-logo.dat usbkbds.dat builtin.di
${RM} acfheaders headers revlevel-
${RM} openboot.img
${RM} `${DIDEPEND} ${PLATFLAGS} -t ${DROPIN_SRC:sh}`
${RM} `${DIDEPEND} ${PLATFLAGS} -s ${DROPIN_SRC:sh}`
${RM} *.idx *.fc *.di *.o
${RM} core HEADERS
TOKENRULE = \
( fname=".XX.YY.XX"; for i in $(?D); do \
if [ -f $$i/*.tok ]; then fname=`${ECHO} $$i/*.tok`; fi; \
done; \
if [ -f $$fname ]; then \
${NOTIFY} "Tokenizing $$fname"; \
BP=${BP}; export BP; \
${TOKENIZE} ${VERBOSE} ${RELEASE} -x $*.idx \
-s "${FTHFLAGS}" \
-s "${TOKFLAGS} tokenize $$fname $*.fc"; \
else \
${RM} $*.fc; \
${MAKE} $*.fc; \
fi )
%.fc:
${TOKENRULE}
install: backup
@${WHAT} openboot.bin
if [ -f RTARGET ]; then \
/bin/echo Installing `cat RTARGET`/openboot.bin ;\
rcp -p openboot.bin `cat RTARGET`;\
if [ -f forth.flash ]; then \
/bin/echo Installing `cat RTARGET`/forth.flash ;\
rcp -p forth.flash `cat RTARGET`;\
fi;\
fi ;\
if [ -f TARGET ]; then \
/bin/echo Installing `cat TARGET` ;\
cp -p openboot.bin `cat TARGET`;\
fi
DEPEND.MK = ../depend.mk
DEPEND.MK1 = depend.new
# As of 2004, the convention is just the current year, not a range of years.
CDATE:sh = /bin/date '+Copyright %Y Sun Microsystems, Inc.'
# depend := FFLAGS += -v
depend:: ${DEPEND.MK} ${TOOLS}/move-if-changed builtin.fth stand.dic FORCE
${RM} ${DEPEND.MK1}
${ECHO} "# id: ""%""Z""%""%""M""%" " %""I""%" " %""E""%">${DEPEND.MK1}
${ECHO} "# purpose: ""%""Y""%" >>${DEPEND.MK1}
${ECHO} "# copyright: ${CDATE} All Rights Reserved" >>${DEPEND.MK1}
${ECHO} "# copyright: Use is subject to license terms." >>${DEPEND.MK1}
${ECHO} "# This is a machine generated file" >>${DEPEND.MK1}
${ECHO} "# DO NOT EDIT IT BY HAND" >>${DEPEND.MK1}
( BP=${BP}; export BP; ${FORTH64} -e 800 -d ${KERNEL.DIC} \
-D DEPEND -D kernel-hdr-file=${KERNEL}.fth ${FFLAGS} -u -v \
-D LOADFILE=${LOADPROM:sh} \
${BP}/arch/preload.fth ) |\
${GREP} File: |\
${EGREP} -v "(version.fth| headers| loadprom.fth)" |\
${SED} -e 's/File: /bootprom.bin: /'|\
${SED} -e 's:${BP}:$${BP}:' |\
${SORT}|${UNIQ} >>${DEPEND.MK1}
${TOOLS}/move-if-changed ${DEPEND.MK} ${DEPEND.MK1}
depend:: ${DEPEND.MK} ${TOOLS}/move-if-changed builtin.fth stand.dic FORCE
( BP=${BP}; export BP; \
if [ ! -z "${CONFIGLOAD:sh}" ]; then \
${RM} ${DEPEND.MK1}; \
${ECHO} "# id: ""%""Z""%""%""M""% %""I""%" " %""E""%">${DEPEND.MK1}; \
${ECHO} "# purpose: ""%""Y""%" >>${DEPEND.MK1}; \
${ECHO} "# copyright: ${CDATE} All Rights Reserved" >>${DEPEND.MK1}; \
${ECHO} "# copyright: Use is subject to license terms." >>${DEPEND.MK1}; \
${ECHO} "# This is a machine generated file" >>${DEPEND.MK1}; \
${ECHO} "# DO NOT EDIT IT BY HAND" >>${DEPEND.MK1}; \
( ${FORTH64} -e 800 -d ${KERNEL.DIC} \
-D MINIFORTH -D DEPEND ${RELEASE} \
-D kernel-hdr-file=${KERNEL}.fth ${FFLAGS} -u -v \
-D LOADFILE=${CONFIGLOAD:sh} \
${BP}/arch/preload.fth ) |\
${GREP} File: | \
${EGREP} -v "(version.fth| headers)" |\
${SED} -e 's/File: /config.bin: /'|\
${SED} -e 's:${BP}:$${BP}:'|\
${SORT}|${UNIQ} >>${DEPEND.MK1}; \
${TOOLS}/move-if-changed ../config.mk ${DEPEND.MK1}; \
else \
exit 0; \
fi; )
depend:: ../reset.mk stand.dic decomp.o ${TOOLS}/move-if-changed FORCE
${GREP} headerless acfheaders > headerless
${RM} reset.o
${RM} ${DEPEND.MK1}
${ECHO} "# id: ""%""Z""%""%""M""%" " %""I""%" " %""E""%">${DEPEND.MK1}
${ECHO} "# purpose: ""%""Y""%" >>${DEPEND.MK1}
${ECHO} "# copyright: ${CDATE} All Rights Reserved" >>${DEPEND.MK1}
${ECHO} "# copyright: Use is subject to license terms." >>${DEPEND.MK1}
${ECHO} "# This is a machine generated file" >>${DEPEND.MK1}
${ECHO} "# DO NOT EDIT IT BY HAND" >>${DEPEND.MK1}
( BP=${BP}; export BP; ${COMPILER64} \
-D RESET -D DEPEND ${RELEASE} -D LOADFILE=${RESET} \
-e 900 -d stand.dic ${FFLAGS} -v -u \
-s "d# ${DECOMPSIZE} constant decomp-size" \
-s " warning off" headerless \
${BP}/arch/preload.fth ) |\
${GREP} File: |\
${EGREP} -v "(headerless| reset.fth)" |\
${SED} -e 's/File: /reset.o: /'|\
${SED} -e 's:${BP}:$${BP}:'|\
${SORT}|${UNIQ} >>${DEPEND.MK1}
${TOOLS}/move-if-changed ../reset.mk ${DEPEND.MK1}
${RM} headerless
backup: all ${MAKEPROM}
${RM} forth.flash
if [ -f openboot.ok ]; then \
${MAKEPROM} -o forth.flash openboot.bin openboot.ok ;\
fi
clobber::
${SCCS} clean
builtin.fth: ${DIDEPEND} ${DROPIN_SRC:sh}
${DIDEPEND} ${PLATFLAGS} -c ${DROPIN_SRC:sh} > builtin.fth
dropins.mk: ${DIDEPEND} ${DROPIN_SRC:sh}
${DIDEPEND} ${PLATFLAGS} -d ${DROPIN_SRC:sh} > dropins.mk
${ECHO} >> dropins.mk
${ECHO} "builtin.di: `${DIDEPEND} ${PLATFLAGS} -t ${DROPIN_SRC:sh}`" >> dropins.mk
headers.di: ${TOOLS}/makedi headers
${ECHO} "\\\ Forth Comment" > headers.dat
${CAT} headers >> headers.dat
${MAKEDI} headers.dat headers
${RM} headers.dat
# Get the dropins that make an image.
DIFCODE = if [ ! -f ${DROPIN_SRC:sh} ]; then \
( cd `dirname ${DROPIN_SRC:sh}`; sccs get dropins.src; ) fi; \
${DIDEPEND} ${PLATFLAGS} -s ${DROPIN_SRC:sh} | \
sed -e 's/config.bin//' -e 's/bootprom.bin//'
DITARGETS = ${DIDEPEND} ${PLATFLAGS} -t ${DROPIN_SRC:sh}
builtin.di: ${FORTH} ${TOKENIZEDIC}
builtin.di: ${DROPIN_SRC:sh} ${TOOLS}/makedi ${FORTHDI} ${DIDEPEND}
cat ${FORTHDI} ${DITARGETS:sh} > builtin.di
include dropins.mk