# ========== 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
# - 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
# ========== Copyright Header End ============================================
# id: @(#)common.mk 1.24 06/10/13
# 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 ${ROOT}/release.mk
# Include the platform specific flags for building
# 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' |\
DECOMPSIZE
= ${DECOMPSIZ
:sh
}
# Dont define NormalMAP or CompressMAP; If you want to specify a mapfile
GetMAP
= if
[ -z
"${MAPFILE}" ]; \
then
/bin
/echo
${SUN4U}/openboot
${ROMSIZE}.map
; \
else /bin
/echo
${MAPFILE}; \
VERBOSE
:sh
= if
[ -f VERBOSE
]; \
elif
[ -f ..
/..
/VERBOSE
]; \
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
;
NOTIFY
:sh
= if
[ -f NOTIFY
]; \
then
/bin
/echo
"/bin/echo"; \
else /bin
/echo
"/bin/true"; fi
;
WARNINGS
:sh
= if
[ -f WARNING
];\
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
TOKFLAGS
= aout-header? off\
${EXTERNAL} ${FCODE-HEADERS
} ${FCODE-HEADERLESS
}
HDEBUG
:sh
= if
[ -f HEADERS
]; \
# .SUFFIXES: .fc .tok ${SUFFIXES}
etags
: ${TOOLS}/fscope fscope.idx FORCE
${TOOLS}/fscope
-a
-e
-o etags
-m etag
-f fscope.idx
; )
tags: ${TOOLS}/fscope fscope.idx FORCE
${TOOLS}/fscope
-a
-e
-o
tags -m tag
-f fscope.idx
; )
decomp.o
: ${TOOLDIR}/decomp.c
${CC} -DSTANDALONE
-fast
-c
${TOOLDIR}/decomp.c
-o decomp.o
# Provide mechanisms to reuse loadprom, config and dropins files from other
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
${CONFIG}; fi
# If the makefile variable or the file MINI_T32 exists then we don't build
MINI_T
= if
[ -z
"${MINI_T32}" -a
! -f
"MINI_T32" ]; \
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 \
${VERBOSE} ${RELEASE} ${FFLAGS} \
-D kernel-hdr-file
=${MINIFORTH}.fth \
-D LOADFILE
=${CONFIGLOAD
:sh
} \
${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 \
reset.o
: ..
/reset.mk stand.dic
reset.o
: ${FORTH64} ${RESET} ${BP}/arch
/preload.fth
${NOTIFY} Building reset.o
${GREP} headerless acfheaders
> headerless
( 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 \
reset.bin
: decomp.o reset.o
${NormalMAP} ${ELF2BIN}
${LD} -s
-dn
-e reset
-M
${NormalMAP} reset.o decomp.o
-o reset.elf
${ELF2BIN} reset.elf reset.bin
openboot.bin
: builtin.di
${MAKEPROM} reset.bin
${MAKEPROM} ${MAKEPROM-FLAGS
} -o openboot.bin
-n reset.bin builtin.di
${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'
${ECHO} REMOVE THIS TARGET
$@
FIRMWAREREL
= cat
${BP}/firmware.rel
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 \
${SORT} +1 headers
> acfheaders
fscope.idx
: ${FORTH64} ${KERNEL}-xref.dic bootprom.bin
( 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 LOADFILE
=${LOADPROM
:sh
} \
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} `${DIDEPEND} ${PLATFLAGS} -t ${DROPIN_SRC:sh}`
${RM} `${DIDEPEND} ${PLATFLAGS} -s ${DROPIN_SRC:sh}`
${RM} *.idx
*.
fc *.di
*.o
( fname
=".XX.YY.XX"; for i in
$^
; do \
if
${ECHO} $$i |
${EGREP} -e
"\.tok" > /dev
/null
; then \
if
[ -f
$$fname ]; then \
${NOTIFY} "Tokenizing $$fname"; \
${TOKENIZE} ${VERBOSE} ${RELEASE} -x
$*.idx \
-s
"${TOKFLAGS} tokenize $$fname $*.fc"; \
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`;\
/bin
/echo Installing
`cat TARGET` ;\
cp
-p openboot.bin
`cat TARGET`;\
# 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
:: ${DEPEND.MK
} ${TOOLS}/move-if-changed builtin.fth stand.dic FORCE
${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
) |\
${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
if
[ ! -z
"${CONFIGLOAD:sh}" ]; then \
${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
) |\
${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
}; \
depend
:: ..
/reset.mk stand.dic decomp.o
${TOOLS}/move-if-changed FORCE
${GREP} headerless acfheaders
> headerless
${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
) |\
${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
}
if
[ -f openboot.ok
]; then \
${MAKEPROM} -o forth.flash openboot.bin openboot.ok
;\
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} "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
# 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