# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
+all: package
package: _obj/$(TARG).a
testpackage: _test/$(TARG).a
elem=$(lastword $(subst /, ,$(TARG)))
-dir=$(patsubst %/$(elem),%,$(TARG))
+dir=$(patsubst %/$(elem),%,./$(TARG))
pkgdir=$(GOROOT)/pkg/$(GOOS)_$(GOARCH)
$(GC) -o $@ $(GOFILES) $(GOTESTFILES)
%.$O: %.c
- $(CC) $*.c
+ $(CC) $(CFLAGS) $*.c
%.$O: %.s
$(AS) $*.s
importpath:
@echo $(TARG)
+dir:
+ @echo $(dir)
+
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
+include $(GOROOT)/src/Make.$(GOARCH)
+
+TARG=runtime
+
# Set SIZE to 32 or 64.
SIZE_386=32
SIZE_amd64=64
CFLAGS_arm=-N
CFLAGS=-I$(GOOS) -I$(GOOS)/$(GOARCH) -wF $(CFLAGS_$(SIZE)) $(CFLAGS_$(GOARCH))
-# 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
-AR=gopack
-
-LIB=runtime.a
+GOFILES=\
+ extern.go\
+ type.go\
# 386-specific object files
OFILES_386=\
asm.$O\
chan.$O\
closure.$O\
- extern.$O\
float.$O\
hashmap.$O\
iface.$O\
sys.$O\
thread.$O\
traceback.$O\
- type.$O\
$(OFILES_$(GOARCH))\
HFILES=\
$(GOOS)/os.h\
$(GOOS)/$(GOARCH)/defs.h\
-all: $(LIB) runtime.acid
-
-TARG=$(GOROOT)/pkg/$(GOOS)_$(GOARCH)/$(LIB)
-
-install: $(TARG)
-
-$(TARG): $(LIB) runtime.acid
- test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)
- cp $(LIB) $(TARG)
- cp runtime.acid $(GOROOT)/acid/runtime.acid
+include $(GOROOT)/src/Make.pkg
-$(LIB): $(OFILES)
- $(AR) grc $(LIB) $(OFILES)
+clean: clean-local
-$(OFILES): $(HFILES)
+clean-local:
+ rm -f runtime.acid cgo2c */asm.h
-nuke:
- rm -f *.[568] *.a $(TARG)
-
-clean:
- rm -f *.[568] *.a runtime.acid cgo2c */asm.h
+$(GOARCH)/asm.h: runtime.acid mkasmh
+ ./mkasmh >$@.x
+ mv -f $@.x $@
-%.$O: %.go
- $(GC) $<
+cgo2c: cgo2c.c
+ quietgcc -o $@ $<
-%.$O: %.c
- $(CC) $(CFLAGS) $<
+%.c: %.cgo cgo2c
+ ./cgo2c $< > $@.tmp
+ mv -f $@.tmp $@
%.$O: $(GOARCH)/%.c
$(CC) $(CFLAGS) $<
%.$O: $(GOOS)/$(GOARCH)/%.c
$(CC) $(CFLAGS) $<
-%.$O: $(GOARCH)/%.s
+%.$O: $(GOARCH)/%.s $(GOARCH)/asm.h
$(AS) $<
-%.$O: $(GOOS)/$(GOARCH)/%.s
+%.$O: $(GOOS)/$(GOARCH)/%.s $(GOARCH)/asm.h
$(AS) $<
-cgo2c: cgo2c.c
- quietgcc -o $@ $<
-%.c: %.cgo cgo2c
- ./cgo2c $< > $@.tmp
- mv -f $@.tmp $@
+# acid support files
+
+all: runtime.acid
+
+install: $(GOROOT)/acid/runtime.acid
+
+$(GOROOT)/acid/runtime.acid: runtime.acid
+ cp runtime.acid $@
runtime.acid: runtime.h proc.c
$(CC) -a proc.c >runtime.acid
chan.acid: runtime.h chan.c
$(CC) -a chan.c >chan.acid
-$(GOARCH)/asm.h: runtime.acid mkasmh.sh
- ./mkasmh.sh >$@.x
- mv -f $@.x $@
-