SubDir P4 script ;

SubDirHdrs $(P4) client ;
SubDirHdrs $(P4) script lua-5.3 ;
SubDirHdrs $(P4) script libs p4api ;
SubDirHdrs $(P4) script libs p4-lua ;
SubDirHdrs $(P4) i18n ;

local C++FLAGS = [ C++FLAGS+STD $(C++_VERSION_MAX) ] ;

# Scripting is both exposed to the public API and requires C++17, so
# we have to override the above local C++FLAGS when running the compat
# check so we can see that the stub functions work.

if $(C++_LANGUAGE_COMPAT_CHECK) = 1
{
	C++FLAGS = [ FRemoveAny $(C++FLAGS) : -std=$(C++_VERSION_MAX) /std:$(C++_VERSION_MAX) ] ;
	C++FLAGS = [ C++FLAGS+STD $(C++_VERSION_BASELINE) ] ;
}

P4APILibrary $(P4SCRIPT) :
	lua53.cc
	p4script53.cc
	p4script.cc
	;

if $(CLANGVER) || $(OSCOMP:U) = "XC"
{
	# lundump.c:237
	ObjectC++Flags lua53.cc : -Wno-string-plus-int ;
}

if $(CLANGVER) || $(GCCVER)
{
	ObjectC++Flags lua53.cc : -Wno-missing-braces ;
}

ObjectC++Flags p4script53.cc : -I $(P4)/script/lua-5.3 -I $(P4)/client ;

# This is the LuaSQLite version, not the SQLite library itself.
ObjectDefines p4script53.cc : SQLITE_VERSION=95 ;

SubInclude P4 script libs ;
SubInclude P4 script lua-5.3 ;
