2009-05-12 17:15:52 -06:00
|
|
|
# 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.
|
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
# Set SIZE to 32 or 64.
|
|
|
|
SIZE_386=32
|
|
|
|
SIZE_amd64=64
|
|
|
|
SIZE_arm=32
|
|
|
|
SIZE=$(SIZE_$(GOARCH))
|
|
|
|
|
|
|
|
# Setup CFLAGS. Add -D_64BIT on 64-bit platforms (sorry).
|
|
|
|
CFLAGS_64=-D_64BIT
|
|
|
|
CFLAGS=-I$(GOOS) -I$(GOOS)/$(GOARCH) -wF $(CFLAGS_$(SIZE))
|
|
|
|
|
|
|
|
# Set O to right letter.
|
|
|
|
O_386=8
|
|
|
|
O_amd64=6
|
|
|
|
O_arm=5
|
|
|
|
O=$(O_$(GOARCH))
|
|
|
|
|
|
|
|
# Tools
|
|
|
|
CC=$(O)c
|
|
|
|
GC=$(O)g
|
|
|
|
AS=$(O)a
|
2009-06-08 11:38:49 -06:00
|
|
|
AR=gopack
|
2009-06-06 23:04:50 -06:00
|
|
|
|
|
|
|
LIB=runtime.a
|
|
|
|
|
|
|
|
# 386-specific object files
|
|
|
|
OFILES_386=\
|
|
|
|
vlop.$O\
|
|
|
|
vlrt.$O\
|
|
|
|
|
2009-06-10 12:53:07 -06:00
|
|
|
# arm-specific object files
|
|
|
|
OFILES_arm=\
|
|
|
|
vlop.$O\
|
|
|
|
vlrt.$O\
|
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
OFILES=\
|
|
|
|
array.$O\
|
|
|
|
asm.$O\
|
|
|
|
chan.$O\
|
|
|
|
closure.$O\
|
|
|
|
extern.$O\
|
|
|
|
float.$O\
|
|
|
|
float_go.$O\
|
|
|
|
hashmap.$O\
|
|
|
|
iface.$O\
|
|
|
|
malloc.$O\
|
|
|
|
malloc_go.$O\
|
|
|
|
mcache.$O\
|
|
|
|
mcentral.$O\
|
|
|
|
mem.$O\
|
|
|
|
mfixalloc.$O\
|
|
|
|
mgc0.$O\
|
|
|
|
mheap.$O\
|
|
|
|
mheapmap$(SIZE).$O\
|
|
|
|
msize.$O\
|
|
|
|
print.$O\
|
|
|
|
proc.$O\
|
|
|
|
rune.$O\
|
|
|
|
runtime.$O\
|
|
|
|
rt0.$O\
|
|
|
|
sema.$O\
|
|
|
|
sema_go.$O\
|
|
|
|
signal.$O\
|
|
|
|
string.$O\
|
|
|
|
symtab.$O\
|
|
|
|
sys.$O\
|
|
|
|
thread.$O\
|
|
|
|
traceback.$O\
|
|
|
|
$(OFILES_$(GOARCH))\
|
|
|
|
|
|
|
|
HFILES=\
|
|
|
|
runtime.h\
|
|
|
|
hashmap.h\
|
|
|
|
malloc.h\
|
2009-06-17 16:12:16 -06:00
|
|
|
$(GOARCH)/asm.h\
|
2009-06-06 23:04:50 -06:00
|
|
|
$(GOOS)/os.h\
|
|
|
|
$(GOOS)/$(GOARCH)/defs.h\
|
|
|
|
|
2009-06-18 14:33:28 -06:00
|
|
|
all: $(LIB) runtime.acid
|
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
install: $(LIB) runtime.acid
|
2009-06-08 11:38:49 -06:00
|
|
|
test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)
|
2009-06-06 23:04:50 -06:00
|
|
|
cp $(LIB) $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/$(LIB)
|
|
|
|
cp runtime.acid $(GOROOT)/acid/runtime.acid
|
|
|
|
|
|
|
|
$(LIB): $(OFILES)
|
|
|
|
$(AR) grc $(LIB) $(OFILES)
|
|
|
|
|
|
|
|
$(OFILES): $(HFILES)
|
|
|
|
|
|
|
|
nuke:
|
|
|
|
rm -f *.[568] *.a $(GOROOT)/lib/$(LIB)
|
2009-05-12 17:15:52 -06:00
|
|
|
|
|
|
|
clean:
|
2009-06-17 17:31:02 -06:00
|
|
|
rm -f *.[568] *.a runtime.acid cgo2c */asm.h
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: %.go
|
|
|
|
$(GC) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: %.c
|
|
|
|
$(CC) $(CFLAGS) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: $(GOARCH)/%.c
|
|
|
|
$(CC) $(CFLAGS) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: $(GOOS)/%.c
|
|
|
|
$(CC) $(CFLAGS) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: $(GOOS)/$(GOARCH)/%.c
|
|
|
|
$(CC) $(CFLAGS) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: $(GOARCH)/%.s
|
|
|
|
$(AS) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.$O: $(GOOS)/$(GOARCH)/%.s
|
|
|
|
$(AS) $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
cgo2c: cgo2c.c
|
|
|
|
quietgcc -o $@ $<
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
%.c: %.cgo cgo2c
|
|
|
|
./cgo2c $< > $@.tmp
|
|
|
|
mv -f $@.tmp $@
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
runtime.acid: runtime.h proc.c
|
|
|
|
$(CC) -a proc.c >runtime.acid
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-06 23:04:50 -06:00
|
|
|
chan.acid: runtime.h chan.c
|
|
|
|
$(CC) -a chan.c >chan.acid
|
2009-05-12 17:15:52 -06:00
|
|
|
|
2009-06-17 17:31:02 -06:00
|
|
|
$(GOARCH)/asm.h: runtime.acid mkasmh
|
2009-06-17 17:34:13 -06:00
|
|
|
./mkasmh >$@.x
|
2009-06-17 17:31:02 -06:00
|
|
|
mv -f $@.x $@
|
|
|
|
|