2017-04-01 22:26:44 +01:00
|
|
|
## Copyright (C) 2016 Jeremiah Orians
|
2017-03-30 11:46:15 +01:00
|
|
|
## This file is part of stage0.
|
|
|
|
##
|
|
|
|
## stage0 is free software: you an redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation, either version 3 of the License, or
|
|
|
|
## (at your option) any later version.
|
|
|
|
##
|
|
|
|
## stage0 is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with stage0. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2017-05-27 16:45:48 +01:00
|
|
|
# Don't rebuild the built things in bin or roms
|
|
|
|
VPATH = bin:roms
|
2017-03-30 11:46:15 +01:00
|
|
|
|
2017-04-08 20:08:12 +01:00
|
|
|
# Collections of tools
|
2017-05-27 17:36:05 +01:00
|
|
|
all: libvm.so vm ALL-ROMS
|
2016-08-17 23:25:34 +01:00
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
production: libvm-production.so vm-production asm dis ALL-ROMS
|
2017-04-08 20:08:12 +01:00
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
development: vm libvm.so asm dis ALL-ROMS
|
2017-04-08 20:08:12 +01:00
|
|
|
|
|
|
|
# VM Builds
|
2017-05-27 16:58:30 +01:00
|
|
|
vm-minimal: vm.h vm_minimal.c vm_instructions.c vm_decode.c | bin
|
|
|
|
gcc vm.h vm_minimal.c vm_instructions.c vm_decode.c -o bin/vm-minimal
|
2016-08-17 23:25:34 +01:00
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
vm: vm.h vm.c vm_instructions.c vm_decode.c tty.c | bin
|
2016-08-22 00:23:45 +01:00
|
|
|
gcc -ggdb -Dtty_lib=true vm.h vm.c vm_instructions.c vm_decode.c tty.c -o bin/vm
|
2016-08-17 23:25:34 +01:00
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
vm-production: vm.h vm.c vm_instructions.c vm_decode.c | bin
|
|
|
|
gcc vm.h vm.c vm_instructions.c vm_decode.c -o bin/vm-production
|
2017-04-08 20:08:12 +01:00
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
vm-trace: vm.h vm.c vm_instructions.c vm_decode.c tty.c dynamic_execution_trace.c | bin
|
2016-09-03 22:35:06 +01:00
|
|
|
gcc -ggdb -Dtty_lib=true -DTRACE=true vm.h vm.c vm_instructions.c vm_decode.c tty.c dynamic_execution_trace.c -o bin/vm
|
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
# Build the roms
|
|
|
|
ALL-ROMS: stage0_monitor stage1_assembler-0 SET stage1_assembler-1 stage1_assembler-2 M0 CAT lisp forth
|
2016-08-17 23:25:34 +01:00
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
stage0_monitor: hex stage0/stage0_monitor.hex0 | roms
|
|
|
|
./bin/hex < stage0/stage0_monitor.hex0 > roms/stage0_monitor
|
|
|
|
|
|
|
|
stage1_assembler-0: hex stage1/stage1_assembler-0.hex0 | roms
|
|
|
|
./bin/hex < stage1/stage1_assembler-0.hex0 > roms/stage1_assembler-0
|
|
|
|
|
|
|
|
SET: stage1_assembler-0 vm stage1/SET.hex0 | roms
|
|
|
|
./bin/vm --rom roms/stage1_assembler-0 --tape_01 stage1/SET.hex0 --tape_02 roms/SET
|
|
|
|
|
|
|
|
stage1_assembler-1: stage1_assembler-0 vm stage1/stage1_assembler-1.hex0 | roms
|
|
|
|
./bin/vm --rom roms/stage1_assembler-0 --tape_01 stage1/stage1_assembler-1.hex0 --tape_02 roms/stage1_assembler-1
|
|
|
|
|
|
|
|
stage1_assembler-2: stage1_assembler-1 vm stage1/stage1_assembler-2.hex1 | roms
|
|
|
|
./bin/vm --rom roms/stage1_assembler-1 --tape_01 stage1/stage1_assembler-2.hex1 --tape_02 roms/stage1_assembler-2
|
|
|
|
|
|
|
|
M0: stage1_assembler-2 vm stage1/M0-macro.hex2 | roms
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 stage1/M0-macro.hex2 --tape_02 roms/M0 --memory 48K
|
|
|
|
|
|
|
|
CAT: M0 stage1_assembler-2 vm High_level_prototypes/defs stage1/CAT.s | roms
|
|
|
|
cat High_level_prototypes/defs stage1/CAT.s >| temp
|
|
|
|
./bin/vm --rom roms/M0 --tape_01 temp --tape_02 temp2 --memory 48K
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/CAT --memory 48K
|
|
|
|
|
|
|
|
lisp: M0 stage1_assembler-2 vm High_level_prototypes/defs stage2/lisp.s | roms
|
|
|
|
cat High_level_prototypes/defs stage2/lisp.s > temp
|
|
|
|
./bin/vm --rom roms/M0 --tape_01 temp --tape_02 temp2 --memory 256K
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/lisp --memory 48K
|
|
|
|
|
|
|
|
forth: M0 stage1_assembler-2 vm High_level_prototypes/defs stage2/forth.s | roms
|
|
|
|
cat High_level_prototypes/defs stage2/forth.s > temp
|
|
|
|
./bin/vm --rom roms/M0 --tape_01 temp --tape_02 temp2 --memory 128K
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/forth --memory 48K
|
2016-08-17 23:25:34 +01:00
|
|
|
|
2017-04-08 20:08:12 +01:00
|
|
|
# Primitive development tools, not required but it was handy
|
2017-05-27 16:58:30 +01:00
|
|
|
asm: High_level_prototypes/asm.c | bin
|
2016-08-20 18:30:03 +01:00
|
|
|
gcc -ggdb High_level_prototypes/asm.c -o bin/asm
|
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
dis: High_level_prototypes/disasm.c | bin
|
2016-08-20 18:30:03 +01:00
|
|
|
gcc -ggdb High_level_prototypes/disasm.c -o bin/dis
|
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
hex: Linux\ Bootstrap/hex.c | bin
|
|
|
|
gcc Linux\ Bootstrap/hex.c -o bin/hex
|
|
|
|
|
|
|
|
# libVM Builds for Development tools
|
|
|
|
libvm.so: wrapper.c vm_instructions.c vm_decode.c vm.h tty.c
|
|
|
|
gcc -ggdb -Dtty_lib=true -shared -Wl,-soname,libvm.so -o libvm.so -fPIC wrapper.c vm_instructions.c vm_decode.c vm.h tty.c
|
|
|
|
|
|
|
|
libvm-production.so: wrapper.c vm_instructions.c vm_decode.c vm.h
|
|
|
|
gcc -shared -Wl,-soname,libvm.so -o libvm-production.so -fPIC wrapper.c vm_instructions.c vm_decode.c vm.h
|
|
|
|
|
2017-05-30 04:08:33 +01:00
|
|
|
# Tests
|
|
|
|
Generate-rom-test: ALL-ROMS
|
|
|
|
mkdir -p test
|
|
|
|
sha256sum roms/* | sort -k2 >| test/SHA256SUMS
|
|
|
|
|
|
|
|
test: ALL-ROMS test/SHA256SUMS
|
|
|
|
sha256sum -c test/SHA256SUMS
|
|
|
|
|
2017-04-08 20:08:12 +01:00
|
|
|
# Clean up after ourselves
|
2017-05-27 16:58:30 +01:00
|
|
|
.PHONY: clean
|
2016-08-20 18:30:03 +01:00
|
|
|
clean:
|
2017-05-27 16:58:30 +01:00
|
|
|
rm -f libvm.so libvm-production.so bin/vm bin/vm-production
|
2016-08-20 18:30:03 +01:00
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
.PHONY: clean-hard
|
|
|
|
clean-hard: clean
|
2017-05-27 16:45:48 +01:00
|
|
|
rm -rf bin/ roms/
|
2016-08-20 18:30:03 +01:00
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
.PHONY: clean-hardest
|
2017-05-27 17:57:57 +01:00
|
|
|
clean-hardest:
|
|
|
|
git reset --hard
|
|
|
|
git clean -fd
|
|
|
|
|
|
|
|
clean-SO-hard-You-probably-do-NOT-want-this-option-because-it-will-destory-everything:
|
2017-05-27 18:03:13 +01:00
|
|
|
@echo "I REALLY REALLY HOPE you know what you are doing"
|
2017-05-27 16:45:48 +01:00
|
|
|
git reset --hard
|
2017-05-27 17:02:46 +01:00
|
|
|
git clean -xdf
|
2017-05-27 16:58:30 +01:00
|
|
|
|
|
|
|
# Our essential folders
|
|
|
|
bin:
|
|
|
|
mkdir -p bin
|
|
|
|
|
|
|
|
roms:
|
|
|
|
mkdir -p roms
|