# Makefile for HPS programs
# Compile natively on the DE1-SoC (which has gcc).
# If cross-compiling from an x86 host, change CC to arm-linux-gnueabihf-gcc.

CC      = gcc
CFLAGS  = -O2 -Wall -std=c11
LDFLAGS = -lm

TARGETS = fpga_test hps_processing

all: $(TARGETS)

fpga_test: fpga_test.c
	$(CC) $(CFLAGS) -o $@ $<

hps_processing: hps_processing.c
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -lpng

clean:
	rm -f $(TARGETS)

# Copy to the DE1-SoC over SSH (edit IP/hostname as needed)
# Usage: make upload BOARD=192.168.1.100
BOARD ?= de1soc
upload: $(TARGETS)
	scp $(TARGETS) root@$(BOARD):/root/

.PHONY: all clean upload
