.PHONY: help all bitstream program program-fpga flash-app flash-bitstream flash-combined debug-openocd debug-load debug-gdb uart-listen fpga-config prune clean

help:
	@echo "VCU118 FPGA targets:"
	@echo "  make bitstream       # run Vivado non-project build"
	@echo "  make program         # program FPGA SRAM with current bitstream"
	@echo "  make flash-app       # program only app/ELF flash region"
	@echo "  make flash-bitstream # program bitstream flash region"
	@echo "  make flash-combined  # old one-MCS flash flow"
	@echo "  make debug-openocd   # OpenOCD BSCAN/GDB server"
	@echo "  make debug-load      # load APP over GDB and run"
	@echo "  make uart-listen     # listen to board UART"
	@echo "  make fpga-config     # show board clocks, flash, UART, and Vivado config"
	@echo "  make prune           # remove bulky temporary outputs"

all: bitstream

bitstream:
	@make -C ../.. bitstream

program program-fpga:
	@make -C ../.. program-fpga

flash-app:
	@make -C ../.. program-flash

flash-bitstream:
	@make -C ../.. program-flash-bitstream

flash-combined:
	@make -C ../.. program-flash-combined

debug-openocd:
	@make -C ../.. debug-openocd

debug-load:
	@make -C ../.. debug-load

debug-gdb:
	@make -C ../.. debug-gdb

uart-listen:
	@make -C ../.. uart-listen

fpga-config:
	@make -C ../.. fpga-config

prune:
	@make -C ../.. prune

clean:
	@make -C ../.. clean-fpga
