root = ..\..\..\..

!include $(root)\build\cxx\rules.nmake

EXTRA_CPPFLAGS = /I$(root)\libxsde

EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --char-encoding $(XSDE_ENCODING)

!if "$(XSDE_STL)" == "n"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-stl
!endif

!if "$(XSDE_IOSTREAM)" == "n"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-iostream
!endif

!if "$(XSDE_EXCEPTIONS)" == "n"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-exceptions
!endif

!if "$(XSDE_LONGLONG)" == "n"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --no-long-long
!endif

!if "$(XSDE_PARSER_VALIDATION)" == "n"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --suppress-validation
!endif

!if "$(XSDE_REUSE_STYLE)" == "mixin"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --reuse-style-mixin
!endif

!if "$(XSDE_POLYMORPHIC)" == "y"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --runtime-polymorphic
!endif

!if "$(XSDE_CUSTOM_ALLOCATOR)" == "y"
EXTRA_XSDFLAGS = $(EXTRA_XSDFLAGS) --custom-allocator
!endif

test-pdriver.exe: test-pskel.obj test-pimpl.obj test-pdriver.obj $(root)\libxsde\xsde\xsde.lib

test-pskel.obj: test-pskel.cxx
test-pimpl.obj: test-pimpl.cxx
test-pdriver.obj: test-pdriver.cxx

test-pskel.hxx test-pskel.ixx test-pskel.cxx test-pimpl.hxx test-pimpl.cxx test-pdriver.cxx: test.xsd
	$(root)\bin\xsde.exe cxx-parser $(XSDFLAGS) $(EXTRA_XSDFLAGS) --generate-print-impl --generate-test-driver --force-overwrite test.xsd

gen: test-pskel.hxx test-pskel.ixx test-pskel.cxx test-pimpl.hxx test-pimpl.cxx test-pdriver.cxx

test: test-pdriver.exe
	.\test-pdriver.exe test-000.xml >tmp
	fc test-000.std tmp
	del tmp

cleanobj:
	-del test-pdriver.exe test-pskel.obj test-pimpl.obj test-pdriver.obj

clean: cleanobj
	-del test-pskel.cxx test-pimpl.cxx test-pdriver.cxx test-pskel.ixx test-pimpl.ixx test-pdriver.ixx test-pskel.hxx test-pimpl.hxx 

