-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
30 lines (24 loc) · 1.15 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.PHONY: all build-example bin/c_compiler install_go install_go_modules test
export PATH := $(HOME)/go/bin:$(HOME)/.go/bin:$(PATH)
all: bin/c_compiler
build-example:
@nex -o internal/firsttest/rp.nn.go internal/firsttest/rp.nex
@goyacc -o internal/firsttest/y.go -v internal/firsttest/y.output internal/firsttest/rp.y
@go build -o bin/example ./cmd/example/*.go
install_go_modules:
@echo "Installing goyacc and nex via Golang install"
@GOPATH="$(HOME)/go" GOROOT="$(HOME)/.go" go install golang.org/x/tools/cmd/[email protected]
@GOPATH="$(HOME)/go" GOROOT="$(HOME)/.go" go install github.com/blynn/nex@master
install_go:
@echo "Installing Golang 1.17 to $(HOME)/go and $(HOME)/.go"
@./goinstall.sh
bin/c_compiler : install_go install_go_modules
@echo "Building lexer files"
@GOPATH="$(HOME)/go" GOROOT="$(HOME)/.go" nex -o pkg/c90/c90.nn.go pkg/c90/c90.nex
@echo "Building parser files"
@GOPATH="$(HOME)/go" GOROOT="$(HOME)/.go" goyacc -o pkg/c90/y.go -v pkg/c90/y.output pkg/c90/grammar.y
@echo "Building compiler"
@mkdir -p bin
@GOPATH="$(HOME)/go" GOROOT="$(HOME)/.go" go build -o bin/see90 ./cmd/see90/*.go
@cp bin/see90 bin/c_compiler
@echo "Build complete"