!include $(NTMAKEENV)\makefile.plt

OUTPUT_HDRS = dinput.rc \

TARGETMOVED = dinputp.h \
              dinputdp.h\

all: $(OUTPUT_HDRS) cleanmoved

clean: cleanall all

cleanall:
    del $(OUTPUT_HDRS)

cleanmoved:
    -@del $(TARGETMOVED) 2>nul

DIRECTXINC = $(PROJECT_ROOT)\Published\DirectX\dinput


#
#   Yuck!  We can't use -u because it causes all trail-commented lines to
#   be deleted!  Instead, we must explicitly exclude DX3 rather than saying
#   "Anything that isn't DX5 should be excluded".
#
#   -u      = skip unknown flags
#   -ts foo = skip `foo' tags
#   -ta foo = include `foo' tags
#   -v  500 = this is version 500
#
#   Tags:
#
#       dx3  = DX3
#       dx5  = DX5
#       dx5  = DX5
#       dx5a = DX5a     (Win98 Gold)
#       dx5b2= DX5b2    (NT5 beta 2)
#       dx6  = DX6.1a   (Win98 OSR1)
#       dx7  = DX7      (Win2000 Gold)
#       dx8  = DX8
#
#HSPLITFLAGS=-u -ta dx5 -v 500      # Can't use this (See above)

# The following line builds the DX5 header
#HSPLITFLAGS=-ts dx3 -ta dx5 -ts dx5a -ts dx5b2 -ts dx6 -ts dx7 -ts dx8 -v 500

# The following line builds the DX5a header; note that DX5a includes DX5
#HSPLITFLAGS=-ts dx3 -ta dx5 -ta dx5a -ts dx5b2 -ts dx6 -ts dx7 -ts dx8 -v 50A

# The following line builds the DX5B2 header
#HSPLITFLAGS=-ts dx3 -ts dx5 -ts dx5a -ta dx5b2 -ts dx6 -ts dx7 -ts dx8 -v 5B2

# The following line builds the DX6.1a header
#HSPLITFLAGS=-ts dx3 -ts dx5 -ts dx5a -ts dx5b2 -ta dx6 -ts dx7 -ts dx8 -v 600

# The following line builds the DX7 header
HSPLITFLAGS=-ts dx3 -ts dx5 -ts dx5a -ts dx5b2 -ts dx6 -ta dx7 -ts dx8 -v 700

# The following line builds the DX8 header
#HSPLITFLAGS=-ts dx3 -ts dx5 -ts dx5a -ts dx5b2 -ts dx6 -ts dx7 -ta dx8 -v 800

dinput.rc: dinputrc.w $(DIRECTXINC)\dimkhdr.m4
        copy $(DIRECTXINC)\dimkhdr.m4 dimkhdr.m4
        copy $(DIRECTXINC)\dinput.w dinput.w
	copy $(DIRECTXINC)\dinputk.w dinputk.w
        m4 dinputrc.w >tmp.wx
        hsplit $(HSPLITFLAGS) -4 -o tmp.x tmpp.x tmp.wx
        del tmp.wx
        wcshdr.exe < tmp.x > $@
        del tmp.x
        del tmpp.x
        del dimkhdr.m4
        del dinput.w
	del dinputk.w

doc:
	$(DXROOT)\public\tools\win9x\common\autodoc /x EXTERNAL /s dinput.fmt /o dinput.rtf *.w *.c
	$(DXROOT)\public\tools\win9x\common\autodoc /x DDK /s dinput.fmt /o dinputd.rtf *.w *.c
	$(DXROOT)\public\tools\win9x\common\autodoc /s dinput.fmt /o dinputi.rtf *.w *.c