# Builds the {{MODEL_NAME}} CMSSW emulator .so from the alkaid HLS project.
# Paths are overridable from the environment; defaults target the el9/gcc12 release.

CXX ?= g++
CXXFLAGS ?= -O3 -fPIC -std=c++17
HLS4ML_EXTRAS ?= /cvmfs/cms.cern.ch/el9_amd64_gcc12/external/hls4mlEmulatorExtras/1.1.4-7f1f5ec35d8cc94e9bab71c7ff9456f1
HLS_PRJ ?= hls_prj

INCLUDES := -I$(HLS_PRJ)/src -I$(HLS_PRJ)/src/static/ap_types -I$(HLS4ML_EXTRAS)/include
LD_FLAGS :=

.PHONY: all clean

all: {{MODEL_NAME}}.so

{{MODEL_NAME}}.so: emulator.cpp $(HLS_PRJ)/src/{{PRJ_NAME}}.hh
	$(CXX) $(CXXFLAGS) $(INCLUDES) -shared emulator.cpp -o $@ $(LD_FLAGS)

clean:
	rm -f {{MODEL_NAME}}.so
