RELDIR=WINNT\install\wix
!INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\..\..\config\NTMakefile.version

MEDIADIR = $(DESTDIR)\WinInstall
MEDIABINDIR = $(MEDIADIR)\Dll

MSIFILE = $(MEDIADIR)\openafs-$(LANG).msi

WIXINCLUDES = \
	config.wxi \
	feature.wxi \
	files.wxi \
	language_config.wxi \
	property.wxi \
	registry.wxi \
	lang\$(LANG)\ui.wxi

WIXOBJ = $(OUT)\openafs-$(LANG).wixobj

LANGUAGES=en_US de_DE es_ES ja_JP ko_KR pt_BR zh_CN zh_TW

languages:
# Don't bother with non en_US for now.  The other builds comprise of either
# verbatim copies of en_US files, partial translations or doesn't build 
# (no languages resources). Someday when OpenAFS 8.1029828419 comes out we'll 
# get someone to translate.
#	for %l in ( $(LANGUAGES ) do (
#	$(MAKE) /f NTMakefile /nologo LANG=%l lang
#	)
	$(MAKE) /f NTMakefile /nologo LANG=en_US lang

lang:: $(MSIFILE)

customactions:
	$(CD) custom
	$(MAKE) /f NTMakefile /nologo install
	$(CD) ..

install: customactions languages

$(MSIFILE): $(WIXOBJ)
	light -nologo -out $(MSIFILE) \
		-loc lang\$(LANG)\strings.wxl \
		$(WIXOBJ)
	dir $(MSIFILE)

$(WIXOBJ): openafs.wxs $(WIXINCLUDES)
	candle -nologo -out $@	\
		"-dCellName=$(CELLNAME_DEFAULT)" \
		-dLanguage=$(LANG) \
		-dNumericVersion=$(AFSPRODUCT_VERSION)	\
		-dVersionMajor=$(AFSPRODUCT_VER_MAJOR)	\
		-dVersionMinor=$(AFSPRODUCT_VER_MINOR)	\
		-dVersionPatch=$(AFSPRODUCT_VER_PATCH)	\
		-dProductCode=$(AFSPRODUCT_VER_GUID)	\
		"-dDestDir=$(DESTDIR)\\" \
		-dCellDbFile=CellServDB \
		-v0 \
		-w0 \
        $(AFSDEV_AUXWIXDEFINES)	openafs.wxs

# Cleanup
clean::
	for %l in ( $(LANGUAGES) ) do (
		$(MAKE) /f NTMakefile /nologo LANG=%l lang_clean
	)
	$(CD) custom
	$(MAKE) /f NTMakefile /nologo clean
	$(CD) ..
	
lang_clean:
	-$(DEL) $(WIXOBJ)
	-$(DEL) $(MSIFILE)
