stage0/makefile

118 lines
4.6 KiB
Makefile
Raw Normal View History

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/>.
# Don't rebuild the built things in bin or roms
VPATH = bin:roms
2017-03-30 11:46:15 +01:00
# Collections of tools
all: libvm.so vm ALL-ROMS
2016-08-17 23:25:34 +01:00
production: libvm-production.so vm-production asm dis ALL-ROMS
development: vm libvm.so asm dis ALL-ROMS
# 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
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-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
# 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
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
# Primitive development tools, not required but it was handy
2017-05-27 16:58:30 +01:00
asm: High_level_prototypes/asm.c | bin
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
gcc -ggdb High_level_prototypes/disasm.c -o bin/dis
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
# Clean up after ourselves
2017-05-27 16:58:30 +01:00
.PHONY: clean
clean:
2017-05-27 16:58:30 +01:00
rm -f libvm.so libvm-production.so bin/vm bin/vm-production
2017-05-27 16:58:30 +01:00
.PHONY: clean-hard
clean-hard: clean
rm -rf bin/ roms/
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"
git reset --hard
git clean -xdf
2017-05-27 16:58:30 +01:00
# Our essential folders
bin:
mkdir -p bin
roms:
mkdir -p roms