| 
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
<$GOROOT/src/mk.$GOARCH
TARG=runtime
# Set SIZE to 32 or 64.
SIZE_386=32
SIZE_amd64=64
SIZE_arm=32
SIZE=`{eval echo '$'SIZE_$GOARCH}
# Setup CFLAGS.  Add -D_64BIT on 64-bit platforms (sorry).
CFLAGS_64=-D_64BIT
# TODO(kaib): fix register allocation to honor extern register so we
# can enable optimizations again.
CFLAGS_arm=-N
CFLAGS=-I$GOOS -I$GOOS/$GOARCH -wF `{eval echo '$'CFLAGS_$SIZE} `{eval echo '$'CFLAGS_$GOARCH}
GOFILES=\
	extern.go\
	type.go\
# 386-specific object files
OFILES_386=\
	vlop.$O\
	vlrt.$O\
# arm-specific object files
OFILES_arm=\
	cas.$O\
	memset.$O\
	vlop.$O\
	vlrt.$O\
OFILES=\
	asm.$O\
	cgocall.$O\
	chan.$O\
	closure.$O\
	float.$O\
	hashmap.$O\
	iface.$O\
	malloc.$O\
	mcache.$O\
	mcentral.$O\
	mem.$O\
	mfixalloc.$O\
	mgc0.$O\
	mheap.$O\
	mheapmap$SIZE.$O\
	msize.$O\
	print.$O\
	proc.$O\
	reflect.$O\
	rune.$O\
	runtime.$O\
	rt0.$O\
	sema.$O\
	signal.$O\
	slice.$O\
	string.$O\
	symtab.$O\
	sys.$O\
	thread.$O\
	traceback.$O\
	`{eval echo '$'OFILES_$GOARCH}\
HFILES=\
	cgocall.h\
	runtime.h\
	hashmap.h\
	malloc.h\
	$GOARCH/asm.h\
	$GOOS/os.h\
	$GOOS/$GOARCH/defs.h\
CLEANFILES = cgo2c */asm.h runtime.acid.*
all: cgo2c package
<$GOROOT/src/mk.pkg
$GOARCH/asm.h: runtime.acid.$GOARCH
	./mkasmh.rc >$target.x
	mv $target.x $target
cgo2c: cgo2c.c
	$OCC $CFLAGS $prereq
	$OLD -o $target cgo2c.$O
&.c:D:	&.cgo
	./cgo2c $stem.cgo > $target.tmp
	mv $target.tmp $target
&.$O:	$GOARCH/&.c
	$CC $CFLAGS $GOARCH/$stem.c
&.$O:	$GOOS/&.c
	$CC $CFLAGS $GOOS/$stem.c
&.$O:	$GOOS/$GOARCH/&.c
	$CC $CFLAGS $GOOS/$GOARCH/$stem.c
&.$O:	$GOARCH/asm.h
&.$O:	$GOARCH/&.s
	$AS $GOARCH/$stem.s
&.$O:	$GOOS/$GOARCH/&.s
	$AS $GOOS/$GOARCH/$stem.s
# for discovering offsets inside structs when debugging
runtime.acid.$GOARCH:D: runtime.h proc.c
	$CC -a proc.c >$target
plan9/&/sys.s: /sys/src/libc/9syscall/sys.h
	@{
		cd plan9
		mk $stem/sys.s
		cd ..
	}
 |