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

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

driver.obj: driver.cxx test-pskel.hxx 
test-pskel.obj: test-pskel.cxx

test-pskel.hxx test-pskel.ixx test-pskel.cxx: test.xsd
	$(root)\bin\xsde.exe cxx-parser $(XSDFLAGS) $(EXTRA_XSDFLAGS) test.xsd

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

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

cleanobj:
	-del driver.exe driver.obj test-pskel.obj

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

