From 0043e06c8285e031ccd11ad9ff021a7b158e3b71 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Fri, 27 Mar 2026 19:08:12 -0500 Subject: [PATCH] Working on removing accidentally committed binaries. --- dvxbasic/Makefile | 35 ++++++++++++++++++++++++++++++++++- dvxbasic/test_compiler.c | 5 +---- dvxbasic/test_lex.c | 3 ++- dvxbasic/test_quick.c | 3 ++- dvxbasic/test_vm.c | 3 +-- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/dvxbasic/Makefile b/dvxbasic/Makefile index 6ecaf70..0ff4072 100644 --- a/dvxbasic/Makefile +++ b/dvxbasic/Makefile @@ -34,10 +34,39 @@ FORMRT_OBJS = $(OBJDIR)/formrt.o APP_OBJS = $(OBJDIR)/ideMain.o $(FORMRT_OBJS) APP_TARGET = $(APPDIR)/dvxbasic.app -.PHONY: all clean +# Native test programs (host gcc, not cross-compiled) +HOSTCC = gcc +HOSTCFLAGS = -O2 -Wall -Wextra -I. +BINDIR = ../bin + +TEST_COMPILER = $(BINDIR)/test_compiler +TEST_VM = $(BINDIR)/test_vm +TEST_LEX = $(BINDIR)/test_lex +TEST_QUICK = $(BINDIR)/test_quick + +TEST_COMPILER_SRCS = test_compiler.c compiler/lexer.c compiler/parser.c compiler/codegen.c compiler/symtab.c runtime/vm.c runtime/values.c +TEST_VM_SRCS = test_vm.c runtime/vm.c runtime/values.c +TEST_LEX_SRCS = test_lex.c compiler/lexer.c +TEST_QUICK_SRCS = test_quick.c compiler/lexer.c compiler/parser.c compiler/codegen.c compiler/symtab.c runtime/vm.c runtime/values.c + +.PHONY: all clean tests all: $(RT_TARGET) $(LIBSDIR)/basrt.dep $(APP_TARGET) install-samples +tests: $(TEST_COMPILER) $(TEST_VM) $(TEST_LEX) $(TEST_QUICK) + +$(TEST_COMPILER): $(TEST_COMPILER_SRCS) | $(BINDIR) + $(HOSTCC) $(HOSTCFLAGS) -o $@ $(TEST_COMPILER_SRCS) -lm + +$(TEST_VM): $(TEST_VM_SRCS) | $(BINDIR) + $(HOSTCC) $(HOSTCFLAGS) -o $@ $(TEST_VM_SRCS) -lm + +$(TEST_LEX): $(TEST_LEX_SRCS) | $(BINDIR) + $(HOSTCC) $(HOSTCFLAGS) -w -o $@ $(TEST_LEX_SRCS) -lm + +$(TEST_QUICK): $(TEST_QUICK_SRCS) | $(BINDIR) + $(HOSTCC) $(HOSTCFLAGS) -o $@ $(TEST_QUICK_SRCS) -lm + # Runtime library DXE (exports symbols via dlregsym constructor) $(RT_TARGET): $(RT_OBJS) | $(LIBSDIR) $(DXE3GEN) -o $(LIBSDIR)/basrt.dxe \ @@ -91,5 +120,9 @@ $(LIBSDIR): $(APPDIR): mkdir -p $(APPDIR) +$(BINDIR): + mkdir -p $(BINDIR) + clean: rm -f $(RT_OBJS) $(COMP_OBJS) $(FORMRT_OBJS) $(APP_OBJS) $(RT_TARGET) $(APP_TARGET) $(LIBSDIR)/basrt.dep $(OBJDIR)/basrt_init.o + rm -f $(TEST_COMPILER) $(TEST_VM) $(TEST_LEX) $(TEST_QUICK) diff --git a/dvxbasic/test_compiler.c b/dvxbasic/test_compiler.c index d89e1d1..a29c014 100644 --- a/dvxbasic/test_compiler.c +++ b/dvxbasic/test_compiler.c @@ -1,9 +1,6 @@ // test_compiler.c -- End-to-end test: source -> compiler -> VM -> output // -// Build (native): -// gcc -O2 -Wall -o test_compiler test_compiler.c \ -// compiler/lexer.c compiler/parser.c compiler/codegen.c compiler/symtab.c \ -// runtime/vm.c runtime/values.c -lm +// Build: make -C dvxbasic tests #include "compiler/parser.h" #include "runtime/vm.h" diff --git a/dvxbasic/test_lex.c b/dvxbasic/test_lex.c index 2dc2452..5adeac5 100644 --- a/dvxbasic/test_lex.c +++ b/dvxbasic/test_lex.c @@ -1,5 +1,6 @@ // test_lex.c -- Dump lexer tokens -// gcc -O2 -w -o test_lex test_lex.c compiler/lexer.c -lm +// +// Build: make -C dvxbasic tests #include "compiler/lexer.h" #include diff --git a/dvxbasic/test_quick.c b/dvxbasic/test_quick.c index a7bdc8c..64c62ef 100644 --- a/dvxbasic/test_quick.c +++ b/dvxbasic/test_quick.c @@ -1,5 +1,6 @@ // test_quick.c -- Quick single-program test -// gcc -O2 -Wall -o test_quick test_quick.c compiler/lexer.c compiler/parser.c compiler/codegen.c compiler/symtab.c runtime/vm.c runtime/values.c -lm +// +// Build: make -C dvxbasic tests #include "compiler/parser.h" #include "runtime/vm.h" diff --git a/dvxbasic/test_vm.c b/dvxbasic/test_vm.c index 6d92ced..6417057 100644 --- a/dvxbasic/test_vm.c +++ b/dvxbasic/test_vm.c @@ -3,8 +3,7 @@ // Hand-assembles a small p-code program and executes it. // Tests: PRINT "Hello, World!", arithmetic, FOR loop, string ops. // -// Build (native, not cross-compiled): -// gcc -O2 -Wall -o test_vm test_vm.c runtime/vm.c runtime/values.c -lm +// Build: make -C dvxbasic tests #include "compiler/opcodes.h" #include "runtime/vm.h"