Skip to content
This repository was archived by the owner on Mar 11, 2019. It is now read-only.

Commit 1dc8ec0

Browse files
committed
Split into 'ports' directory structure, just like MicroPython
1 parent a39ddb9 commit 1dc8ec0

File tree

11 files changed

+269
-234
lines changed

11 files changed

+269
-234
lines changed

Makefile

Lines changed: 0 additions & 220 deletions
This file was deleted.
File renamed without changes.

ports/common/rules.mk

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
GCC=$(TOOLCHAIN)gcc
3+
GCCGO=$(TOOLCHAIN)gccgo
4+
5+
clean:
6+
@echo "RMRF $(BUILD)"
7+
$(Q)rm -rf $(BUILD)
8+
9+
# Make build directories. Must always run as the first command.
10+
mkdir:
11+
@mkdir -p $(DIRS)
12+
13+
# Build a single runtime.o for all Go sources.
14+
$(BUILD)/pkg/runtime.o: $(SRC_GO_RUNTIME)
15+
@echo "Go $@"
16+
$(Q)$(GCCGO) $(GOFLAGS) -fgo-pkgpath=runtime -c -o $@ $^
17+
18+
# Build the 'main' package (with program name as filename)
19+
$(BUILD)/pkg/$(PKG).o: $(TOP)/src/$(PKG)/*.go
20+
@echo "Go $@"
21+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg
22+
23+
# Below here, you can find various packages that may or may not function.
24+
# Package unicode and strconv are functional, while fmt is unusable (but you
25+
# can reference symbols in there so it's not completely broken).
26+
27+
$(BUILD)/pkg/fmt.o: $(shell go list -f '{{ range .GoFiles }}$(PKGROOT)/fmt/{{ . }} {{end}}' $(PKGROOT)/fmt)
28+
@echo "Go $@"
29+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg -fgo-pkgpath=fmt
30+
31+
$(BUILD)/pkg/math.o: $(shell go list -f '{{ range .GoFiles }}$(PKGROOT)/math/{{ . }} {{end}}' $(PKGROOT)/math)
32+
@echo "Go $@"
33+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg -fgo-pkgpath=math
34+
35+
$(BUILD)/pkg/strconv.o: $(shell go list -f '{{ range .GoFiles }}$(PKGROOT)/strconv/{{ . }} {{end}}' $(PKGROOT)/strconv)
36+
@echo "Go $@"
37+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg -fgo-pkgpath=strconv
38+
39+
$(BUILD)/pkg/errors.o: $(shell go list -f '{{ range .GoFiles }}$(PKGROOT)/errors/{{ . }} {{end}}' $(PKGROOT)/errors)
40+
@echo "Go $@"
41+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg -fgo-pkgpath=errors
42+
43+
$(BUILD)/pkg/unicode.o: $(shell go list -f '{{ range .GoFiles }}$(PKGROOT)/unicode/{{ . }} {{end}}' $(PKGROOT)/unicode)
44+
@echo "Go $@"
45+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg -fgo-pkgpath=unicode
46+
47+
$(BUILD)/pkg/unicode/utf8.o: $(shell go list -f '{{ range .GoFiles }}$(PKGROOT)/unicode/utf8/{{ . }} {{end}}' $(PKGROOT)/unicode/utf8)
48+
@echo "Go $@"
49+
$(Q)$(GCCGO) $(GOFLAGS) -c -o $@ $^ -fgo-relative-import-path=/home/ayke/src/tinygo -I $(BUILD)/pkg -fgo-pkgpath=unicode/utf8
50+
51+
# Build libgo C sources.
52+
# TODO: this uses gnu99 to work around undefined stack_t
53+
$(BUILD)/libgo/%.o: $(GOFRONTEND)/libgo/runtime/%.c
54+
@echo "CC $^"
55+
$(Q)$(GCC) $(CFLAGS) -std=gnu99 -c -o $@ $^
56+
57+
# Build tinygo C sources.
58+
$(BUILD)/tinygo/%.o: $(TOP)/src/runtime/%.c
59+
@echo "CC $^"
60+
$(Q)$(GCC) $(CFLAGS) -std=c99 -fexceptions -c -o $@ $^
61+
62+
# Build port-specific C sources.
63+
$(BUILD)/port/%.o: %.c
64+
@echo "CC $^"
65+
$(Q)$(GCC) $(CFLAGS) -std=c99 -fexceptions -c -o $@ $^

0 commit comments

Comments
 (0)