75 lines
No EOL
2.1 KiB
Makefile
75 lines
No EOL
2.1 KiB
Makefile
CXX = g++
|
|
CXXFLAGS = -std=c++17 -Wall -Wextra -g
|
|
LDFLAGS =
|
|
|
|
# APT development libraries
|
|
APT_LIBS = -lapt-pkg -lapt-inst
|
|
|
|
# Archive library for DEB parsing
|
|
ARCHIVE_LIBS = -larchive
|
|
|
|
# Default target
|
|
all: test-libapt-pkg test-deb-parser
|
|
|
|
# Test libapt-pkg functionality
|
|
test-libapt-pkg: test-libapt-pkg.cpp
|
|
$(CXX) $(CXXFLAGS) -o $@ $< $(APT_LIBS) $(LDFLAGS)
|
|
|
|
# Test DEB package parsing
|
|
test-deb-parser: test-deb-parser.cpp
|
|
$(CXX) $(CXXFLAGS) -o $@ $< $(ARCHIVE_LIBS) $(LDFLAGS)
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -f test-libapt-pkg test-deb-parser
|
|
|
|
# Install dependencies (Ubuntu/Debian)
|
|
install-deps:
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libapt-pkg-dev \
|
|
libarchive-dev \
|
|
build-essential \
|
|
g++ \
|
|
make
|
|
|
|
# Test targets
|
|
test: all
|
|
@echo "=== Running libapt-pkg test ==="
|
|
./test-libapt-pkg
|
|
@echo ""
|
|
@echo "=== DEB parser test requires a DEB file ==="
|
|
@echo "Usage: ./test-deb-parser <deb-file>"
|
|
|
|
test-rust: rust-setup
|
|
@echo "=== Running Rust apt-ostree prototype ==="
|
|
@cd .notes/tests && cargo run --bin apt-ostree-prototype
|
|
|
|
test-rust-apt: rust-setup
|
|
@echo "=== Running Rust APT integration tests ==="
|
|
@cd .notes/tests && cargo run --bin test-rust-apt
|
|
|
|
rust-setup:
|
|
@echo "Setting up Rust environment..."
|
|
@which cargo > /dev/null || (echo "Installing Rust..." && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y)
|
|
@cd .notes/tests && cargo check
|
|
|
|
test-all: test test-rust
|
|
@echo "All tests completed"
|
|
|
|
# Help target
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " all - Build all test programs"
|
|
@echo " test-libapt-pkg - Build libapt-pkg test"
|
|
@echo " test-deb-parser - Build DEB parser test"
|
|
@echo " clean - Remove build artifacts"
|
|
@echo " install-deps - Install required dependencies"
|
|
@echo " test - Run C++ tests"
|
|
@echo " test-rust - Run Rust apt-ostree prototype"
|
|
@echo " test-rust-apt - Run Rust APT integration tests"
|
|
@echo " test-all - Run all tests (C++ and Rust)"
|
|
@echo " rust-setup - Set up Rust environment"
|
|
@echo " help - Show this help"
|
|
|
|
.PHONY: all clean install-deps test help |