FILTER=
PARAMS=
ifeq ($(debug),1)
PARAMS+=debug=-D_DEBUG_MODE
endif

ifdef pid
	ifneq ($(pid),0)
		PARAMS+=pid=$(pid)
		FILTER=FILTER_PID=${pid}
	endif
endif

debug:
	exit
build:
	CGO_ENABLED=1 go build -gcflags="all=-N -l" -buildvcs=false -o euspace
c:
	#docker exec -it 9d928d96d4d0 sh -c 'cd /opt/github/euspace/ebpftracer && sh build.sh${PARAMS}'
	docker exec -it 3c1a4817a7ed sh -c 'cd /opt/github/euspace/ebpftracer && sh build_linux.sh ${PARAMS}'
c-build: c

go-build:
	#ssh root@10.211.55.27 'export https_proxy=http://10.0.22.50:4780 && source ~/.g/env && cd /opt/github/euspace && make -f Makefile2 build'
	docker exec -it 3c1a4817a7ed bash -c 'cd /opt/github/euspace && source ~/.g/env && make -f Makefile2 build'
go: go-build

run:
	ssh root@10.211.55.27 'cd /opt/github/euspace && TRACES_ENDPOINT=http://10.0.12.192:18080/docp/api/v2/data/receive ${FILTER} ./euspace --listen="0.0.0.0:8123"'
send_run:
	ssh root@10.211.55.27 'cd /opt/github/euspace && SEND=1 TRACES_ENDPOINT=http://10.0.12.192:18080/docp/api/v2/data/receive ${FILTER} ./euspace --listen="0.0.0.0:8123"'
all: c go

only-build: c go-build
	scp -P36000 ./euspace root@10.0.6.109:/root/carl
