# This makefile just invokes the unreal build system, then the luprex build system.
#
# Do not edit Makefile, instead, edit Makefile.tpl.txt
#
# It is not usually necessary to rebuild the intellisense database
# unless you've added a source file.
#


all:
	(cd luprex ; make all)
	[UNREALENGINE]/Engine/Build/BatchFiles/[BUILD_BAT] -waitmutex IntegrationEditor [OS] DebugGame [INTEGRATION]/Integration.uproject

clean:
	(cd luprex ; make clean)
	[UNREALENGINE]/Engine/Build/BatchFiles/[BUILD_BAT] -waitmutex IntegrationEditor [OS] DebugGame [INTEGRATION]/Integration.uproject -clean
	rm -f .vscode/compile_commands.json

intellisense: all
	(cd [INTEGRATION] ; find Intermediate -type f -name '*.rsp' -print0 | tar --null -czf rsp_files.tgz --files-from=-)
	(cd [UNREALENGINE] ; find Engine -type f -name '*.rsp' -print0 | tar --null -czf rsp_files.tgz --files-from=-)
	[UNREALENGINE]/Engine/Build/BatchFiles/[BUILD_BAT] -waitmutex UnrealEditor [OS] DebugGame -mode=GenerateClangDatabase -OutputDir=[UNREALENGINE]/.vscode
	[UNREALENGINE]/Engine/Build/BatchFiles/[BUILD_BAT] -waitmutex IntegrationEditor [OS] DebugGame [INTEGRATION]/Integration.uproject -mode=GenerateClangDatabase -OutputDir=[UNREALENGINE]/.vscode
	cat [UNREALENGINE]/.vscode/compile_commands.json >> [INTEGRATION]/.vscode/compile_commands.json
	(cd [INTEGRATION] ; tar xfz rsp_files.tgz)
	(cd [UNREALENGINE] ; tar xfz rsp_files.tgz)
	rm -f [INTEGRATION]/rsp_files.tgz [UNREALENGINE]/rsp_files.tgz
