##################################################
# Makefile to build ixEngine examples in toolchain
# fmontorsi Jul 2015

TOPDIR=..
LIBNAME=ixEngine-5.8.0-52

# tricky LDFLAGS to force use of .so libs under /lib/empirix:
EXTRA_LDFLAGS=-L $(TOOLLIB) -L $(DEVEL_ROOT)/usr/lib -L $(realpath $(TOPDIR)/pcap/x86_64-release) -Wl,--dynamic-linker -Wl,/lib/empirix/$(ARCH)/ld-linux.so.2 -Wl,-rpath -Wl,/lib/empirix/$(ARCH) -Wl,-rpath-link -Wl,$(TOOLLIB) -Wl,-rpath -Wl,$(realpath .)

CFLAGS_EXTRA=-I $(realpath $(TOPDIR)/pcap/include)


SDK_FOLDER=SDK-5.8.0-52-x86_64-LSB-SMP-NG
EXAMPLE_INSTALL_FOLDER=.
CPOPT=-afv

all:
	@echo "Nothing to do"
	
examples:
	# typically for debugging you want to run the performace_test example:
	#   ./performance_test --print-proto-distrib --load-pcap YOUR_TEST_PCAP.pcap 
	# this makefile target makes it easier to do that:
	
	# first of all, build the example
	#cp ./Q2300016-20230210.bin $(SDK_FOLDER)/src/license/license_file/
	#make CC=$(TOOLBIN)/gcc AR=$(TOOLBIN)/ar LDFLAGS_USER="$(EXTRA_LDFLAGS)" CFLAGS_EXTRA="$(CFLAGS_EXTRA)" --directory=$(SDK_FOLDER)/src/tools/performance_test
	
	# then copy all the whole .so needed to run it:
	#@cp $(SDK_FOLDER)/lib/libqmengine.so $(EXAMPLE_INSTALL_FOLDER)
	#@echo "Build of ixEngine performace_test completed successfully."
	#@echo "Run:"
	#@echo "     ./performance_test --print-proto-distrib --load-pcap YOUR_TEST_PCAP.pcap"
	#@echo "to test DPI on a PCAP file"

clean_build_intermediate_artifacts:
	#make CROSS=$(TOOLBIN)/ --directory=$(SDK_FOLDER)/src/tools/performance_test clean
	#rm -f *.so performance_test

clean_build_outputs:

clean:: clean_build_intermediate_artifacts clean_build_outputs

install_libs:
ifndef DESTDIR
	@echo "*** ERROR: please call this makefile supplying explicitly the DESTDIR variable"
	@exit 1
endif
	@mkdir -p $(DESTDIR)
	@cp $(CPOPT) $(SDK_FOLDER)/lib/libqmengine* $(DESTDIR)/
	
install_headers:
ifndef DESTDIR
	@echo "*** ERROR: please call this makefile supplying explicitly the DESTDIR variable"
	@exit 1
endif
	@mkdir -p $(DESTDIR)
	@cp -arfv $(SDK_FOLDER)/include/* $(DESTDIR)/

strip:
	@echo "Nothing to do"

regen_precompiled:
	@echo "Nothing to do"


#HAS_INSTALL_SUPPORT=2
#include $(TOPDIR)/Makefiles/ThirdPartyTargetHelpers.mk
