Major changes since last commit: - FiveSql2 SQL:1999 engine (10,458 LOC) — 43/43 ALL PASS - 21 compiler/runtime bugs fixed (short-circuit AND/OR, FOR LOOP, etc.) - @byref pass-by-reference via RefCell pattern - Mutable closure capture (EnsureLocalRef + RefCell sharing) - RTL: 400 → 479 functions (+79: file, string, datetime, hash, UTF-8) - DateTime/Timestamp fully working (hb_DateTime, hb_Hour/Min/Sec, display) - Reserved word guard (39 keywords blocked from function calls) - AEval arg order fix (element before index) - Closure capture redecl fix (unique _cap_ names per block) - Hash/string indexing in ArrayPush/ArrayPop - Harbour compat test suite: 51/51 - 4 docs: Porting Report, Implementation Plan, Optimization Plan, Commercialization Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
118 lines
4.1 KiB
Makefile
118 lines
4.1 KiB
Makefile
# ============================================================================
|
|
# FiveSql2 Makefile — SQL Engine with Pratt Parser (TSqlParser2)
|
|
#
|
|
# Usage:
|
|
# make Build all tests
|
|
# make test Run all tests
|
|
# make bench Run parser benchmark
|
|
# make clean Remove built files
|
|
#
|
|
# Requirements:
|
|
# - Harbour compiler (hbmk2) in PATH
|
|
# - Set HB_INSTALL_PREFIX to harbour-core root
|
|
#
|
|
# Example:
|
|
# export PATH="/path/to/harbour-core/bin/linux/gcc:$PATH"
|
|
# export HB_INSTALL_PREFIX="/path/to/harbour-core"
|
|
# make test
|
|
# ============================================================================
|
|
|
|
SRCDIR = src
|
|
TESTDIR = test
|
|
OUTDIR = bin
|
|
|
|
HB = hbmk2
|
|
HBFLAGS = -n -gtcgi -rebuild -I$(SRCDIR)
|
|
|
|
# Source files (order matters for Harbour compilation)
|
|
SOURCES = \
|
|
$(SRCDIR)/TSqlAlias.prg \
|
|
$(SRCDIR)/TSqlParser2.prg \
|
|
$(SRCDIR)/TFiveSQL.prg \
|
|
$(SRCDIR)/TSqlLexer.prg \
|
|
$(SRCDIR)/TSqlExpr.prg \
|
|
$(SRCDIR)/TSqlFunc.prg \
|
|
$(SRCDIR)/TSqlExecutor.prg \
|
|
$(SRCDIR)/TSqlIndex.prg \
|
|
$(SRCDIR)/TSqlAgg.prg \
|
|
$(SRCDIR)/TSqlSort.prg \
|
|
$(SRCDIR)/TSqlDDL.prg \
|
|
$(SRCDIR)/TSqlTxn.prg \
|
|
$(SRCDIR)/FiveSqlCls.prg \
|
|
$(SRCDIR)/FiveSqlDef.ch
|
|
|
|
# ============================================================================
|
|
# Build targets
|
|
# ============================================================================
|
|
|
|
all: $(OUTDIR) test_basic test_1999 test_hard test_standards test_challenge test_extreme
|
|
|
|
$(OUTDIR):
|
|
mkdir -p $(OUTDIR)
|
|
|
|
test_basic: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_parser2.prg $(SOURCES) -o$(OUTDIR)/test_basic $(HBFLAGS)
|
|
|
|
test_1999: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_sql1999.prg $(SOURCES) -o$(OUTDIR)/test_1999 $(HBFLAGS)
|
|
|
|
test_hard: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_sql1999_hard.prg $(SOURCES) -o$(OUTDIR)/test_hard $(HBFLAGS)
|
|
|
|
test_standards: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_sql_standards.prg $(SRCDIR)/TSqlParser2.prg $(SRCDIR)/TSqlLexer.prg $(SRCDIR)/TSqlExpr.prg $(SRCDIR)/TSqlFunc.prg $(SRCDIR)/FiveSqlDef.ch -o$(OUTDIR)/test_standards $(HBFLAGS)
|
|
|
|
test_challenge: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_sql_challenge.prg $(SOURCES) -o$(OUTDIR)/test_challenge $(HBFLAGS)
|
|
|
|
test_extreme: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_sql_extreme.prg $(SOURCES) -o$(OUTDIR)/test_extreme $(HBFLAGS)
|
|
|
|
test_cmp: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/test_parser_cmp.prg $(SRCDIR)/TSqlParser2.prg $(SRCDIR)/TSqlLexer.prg $(SRCDIR)/TSqlExpr.prg $(SRCDIR)/TSqlFunc.prg $(SRCDIR)/FiveSqlDef.ch -o$(OUTDIR)/test_cmp $(HBFLAGS)
|
|
|
|
bench: $(OUTDIR)
|
|
$(HB) $(TESTDIR)/bench_parser.prg $(SRCDIR)/TSqlParser2.prg $(SRCDIR)/TSqlLexer.prg $(SRCDIR)/TSqlExpr.prg $(SRCDIR)/TSqlFunc.prg $(SRCDIR)/FiveSqlDef.ch -o$(OUTDIR)/bench_parser $(HBFLAGS)
|
|
|
|
# ============================================================================
|
|
# Run tests
|
|
# ============================================================================
|
|
|
|
test: all
|
|
@echo ""
|
|
@echo "================================================================"
|
|
@echo " FiveSql2 — Full Test Suite"
|
|
@echo "================================================================"
|
|
@echo ""
|
|
@echo "--- Basic (10 tests) ---"
|
|
@$(OUTDIR)/test_basic < /dev/null 2>&1 | tail -2
|
|
@echo ""
|
|
@echo "--- SQL:1999 (43 tests) ---"
|
|
@$(OUTDIR)/test_1999 < /dev/null 2>&1 | strings | grep "Rate"
|
|
@echo ""
|
|
@echo "--- Complex (10 tests) ---"
|
|
@$(OUTDIR)/test_hard < /dev/null 2>&1 | strings | grep "Rate"
|
|
@echo ""
|
|
@echo "--- Standards SQL:2003-2023 (64 tests) ---"
|
|
@$(OUTDIR)/test_standards < /dev/null 2>&1 | strings | grep "Rate"
|
|
@echo ""
|
|
@echo "--- Challenge (15 tests) ---"
|
|
@$(OUTDIR)/test_challenge < /dev/null 2>&1 | strings | grep "Rate"
|
|
@echo ""
|
|
@echo "--- Extreme (15 tests) ---"
|
|
@$(OUTDIR)/test_extreme < /dev/null 2>&1 | strings | grep "Rate"
|
|
@echo ""
|
|
@echo "================================================================"
|
|
@echo " All test suites completed."
|
|
@echo "================================================================"
|
|
|
|
# ============================================================================
|
|
# Clean
|
|
# ============================================================================
|
|
|
|
clean:
|
|
rm -rf $(OUTDIR)
|
|
rm -f *.dbf *.ntx *.cdx __cte_*.dbf
|
|
|
|
.PHONY: all test bench clean
|