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
|
2017-06-04 03:51:13 +01:00
|
|
|
VPATH = bin:roms:prototypes:stage1/High_level_prototypes:stage2/High_level_prototypes
|
2017-03-30 11:46:15 +01:00
|
|
|
|
2017-04-08 20:08:12 +01:00
|
|
|
# Collections of tools
|
2017-06-04 03:51:13 +01:00
|
|
|
all: libvm.so vm ALL-ROMS ALL-PROTOTYPES
|
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
|
2017-12-12 03:55:03 +00:00
|
|
|
gcc -ggdb -DVM32=true -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
|
2017-06-04 01:48:38 +01:00
|
|
|
ALL-ROMS: stage0_monitor stage1_assembler-0 SET DEHEX 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
|
|
|
|
|
2018-03-21 00:45:33 +00:00
|
|
|
SET: stage1_assembler-2 vm stage1/SET.hex2 | roms
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 stage1/SET.hex2 --tape_02 roms/SET
|
2017-05-27 17:36:05 +01:00
|
|
|
|
2017-06-04 01:48:38 +01:00
|
|
|
DEHEX: stage1_assembler-0 vm stage1/dehex.hex0 | roms
|
|
|
|
./bin/vm --rom roms/stage1_assembler-0 --tape_01 stage1/dehex.hex0 --tape_02 roms/DEHEX
|
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
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
|
2017-06-04 02:35:47 +01:00
|
|
|
cat High_level_prototypes/defs stage1/CAT.s >| CAT_TEMP
|
|
|
|
./bin/vm --rom roms/M0 --tape_01 CAT_TEMP --tape_02 CAT_TEMP2 --memory 48K
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 CAT_TEMP2 --tape_02 roms/CAT --memory 48K
|
|
|
|
rm CAT_TEMP CAT_TEMP2
|
2017-05-27 17:36:05 +01:00
|
|
|
|
|
|
|
lisp: M0 stage1_assembler-2 vm High_level_prototypes/defs stage2/lisp.s | roms
|
2017-06-04 02:35:47 +01:00
|
|
|
cat High_level_prototypes/defs stage2/lisp.s > lisp_TEMP
|
|
|
|
./bin/vm --rom roms/M0 --tape_01 lisp_TEMP --tape_02 lisp_TEMP2 --memory 256K
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 lisp_TEMP2 --tape_02 roms/lisp --memory 48K
|
|
|
|
rm lisp_TEMP lisp_TEMP2
|
2017-05-27 17:36:05 +01:00
|
|
|
|
|
|
|
forth: M0 stage1_assembler-2 vm High_level_prototypes/defs stage2/forth.s | roms
|
2017-06-04 02:35:47 +01:00
|
|
|
cat High_level_prototypes/defs stage2/forth.s > forth_TEMP
|
|
|
|
./bin/vm --rom roms/M0 --tape_01 forth_TEMP --tape_02 forth_TEMP2 --memory 128K
|
|
|
|
./bin/vm --rom roms/stage1_assembler-2 --tape_01 forth_TEMP2 --tape_02 roms/forth --memory 48K
|
|
|
|
rm forth_TEMP forth_TEMP2
|
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
|
|
|
|
|
2017-06-03 17:34:28 +01:00
|
|
|
xeh: Linux\ Bootstrap/xeh.c | bin
|
|
|
|
gcc Linux\ Bootstrap/xeh.c -o bin/xeh
|
|
|
|
|
2017-05-27 17:36:05 +01:00
|
|
|
# libVM Builds for Development tools
|
|
|
|
libvm.so: wrapper.c vm_instructions.c vm_decode.c vm.h tty.c
|
2017-12-12 03:55:03 +00:00
|
|
|
gcc -ggdb -DVM32=true -Dtty_lib=true -shared -Wl,-soname,libvm.so -o libvm.so -fPIC wrapper.c vm_instructions.c vm_decode.c vm.h tty.c
|
2017-05-27 17:36:05 +01:00
|
|
|
|
|
|
|
libvm-production.so: wrapper.c vm_instructions.c vm_decode.c vm.h
|
2017-12-12 03:55:03 +00:00
|
|
|
gcc -DVM32=true -shared -Wl,-soname,libvm.so -o libvm-production.so -fPIC wrapper.c vm_instructions.c vm_decode.c vm.h
|
2017-05-27 17:36:05 +01:00
|
|
|
|
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-06-04 03:51:13 +01:00
|
|
|
# Prototypes
|
|
|
|
ALL-PROTOTYPES: prototype_dehex prototype_M0 prototype_more prototype_SET prototype_stage1_assembler-1 prototype_stage1_assembler-2 prototype_lisp
|
|
|
|
|
|
|
|
prototype_dehex: dehex.c | prototypes
|
|
|
|
gcc stage1/High_level_prototypes/dehex.c -o prototypes/prototype_dehex
|
|
|
|
|
|
|
|
prototype_M0: M0-macro.c | prototypes
|
|
|
|
gcc stage1/High_level_prototypes/M0-macro.c -o prototypes/prototype_M0
|
|
|
|
|
|
|
|
prototype_more: more.c tty.c | prototypes
|
|
|
|
gcc stage1/High_level_prototypes/more.c tty.c -o prototypes/prototype_more
|
|
|
|
|
|
|
|
prototype_SET: SET.c tty.c | prototypes
|
|
|
|
gcc stage1/High_level_prototypes/SET.c tty.c -o prototypes/prototype_SET
|
|
|
|
|
|
|
|
prototype_stage1_assembler-1: stage1_assembler-1.c | prototypes
|
|
|
|
gcc stage1/High_level_prototypes/stage1_assembler-1.c -o prototypes/prototype_stage1_assembler-1
|
|
|
|
|
|
|
|
prototype_stage1_assembler-2: stage1_assembler-2.c | prototypes
|
|
|
|
gcc stage1/High_level_prototypes/stage1_assembler-2.c -o prototypes/prototype_stage1_assembler-2
|
|
|
|
|
|
|
|
prototype_lisp: lisp.c lisp.h lisp_cell.c lisp_eval.c lisp_print.c lisp_read.c | prototypes
|
|
|
|
gcc -O2 stage2/High_level_prototypes/lisp.h \
|
|
|
|
stage2/High_level_prototypes/lisp.c \
|
|
|
|
stage2/High_level_prototypes/lisp_cell.c \
|
|
|
|
stage2/High_level_prototypes/lisp_eval.c \
|
|
|
|
stage2/High_level_prototypes/lisp_print.c \
|
|
|
|
stage2/High_level_prototypes/lisp_read.c \
|
|
|
|
-o prototypes/prototype_lisp
|
|
|
|
|
|
|
|
|
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-12-12 03:55:03 +00:00
|
|
|
rm -rf bin/ roms/ prototypes/ *.so
|
2016-08-20 18:30:03 +01:00
|
|
|
|
2017-05-27 16:58:30 +01:00
|
|
|
.PHONY: clean-hardest
|
2017-12-11 23:50:53 +00:00
|
|
|
clean-hard:
|
2017-05-27 17:57:57 +01:00
|
|
|
git reset --hard
|
|
|
|
git clean -fd
|
2017-06-04 03:51:13 +01:00
|
|
|
rm -rf bin/ roms/ prototypes/
|
2017-05-27 17:57:57 +01:00
|
|
|
|
|
|
|
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-06-04 03:51:13 +01:00
|
|
|
rm -rf bin/ roms/ prototypes/
|
2017-05-27 16:58:30 +01:00
|
|
|
|
|
|
|
# Our essential folders
|
|
|
|
bin:
|
|
|
|
mkdir -p bin
|
|
|
|
|
|
|
|
roms:
|
|
|
|
mkdir -p roms
|
2017-06-04 03:51:13 +01:00
|
|
|
|
|
|
|
prototypes:
|
|
|
|
mkdir -p prototypes
|