1########################################################################
2#
3# Copyright (c) 2010, Secure Endpoints Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11#   notice, this list of conditions and the following disclaimer.
12#
13# - Redistributions in binary form must reproduce the above copyright
14#   notice, this list of conditions and the following disclaimer in
15#   the documentation and/or other materials provided with the
16#   distribution.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29# POSSIBILITY OF SUCH DAMAGE.
30#
31
32RELDIR=packages\windows\installer
33
34!include ../../../windows/NTMakefile.w32
35
36!ifdef BUILD_INSTALLERS
37
38VERSIOND=$(VER_PRODUCT_MAJOR)-$(VER_PRODUCT_MINOR)-$(VER_PRODUCT_AUX)-$(VER_PRODUCT_PATCH)
39VERSION=$(VER_PRODUCT_MAJOR).$(VER_PRODUCT_MINOR).$(VER_PRODUCT_AUX).$(VER_PRODUCT_PATCH)
40POLPREFIX=policy.$(VER_PRODUCT_MAJOR).$(VER_PRODUCT_MINOR)
41
42!if "$(CPU)"=="AMD64"
43PLATFORM=x64
44!else
45PLATFORM=x86
46!endif
47
48!if "$(BUILD)"=="rel"
49DEBUGOPT=
50!else
51DEBUGOPT=-$(BUILD)
52!endif
53
54######################################################################
55# Heimdal Merge Modules
56
57ASSEMBLYMODULE=$(INSTDIR)\Heimdal.msm
58
59$(ASSEMBLYMODULE): $(OBJ)\heimdal-assemblies.wixobj
60	$(LIGHT) -out $@ $**
61
62$(OBJ)\heimdal-assemblies.wixobj: heimdal-assemblies.wxs
63	$(CANDLE) -arch $(PLATFORM) -o $@ $**	\
64		-dVersion=$(VERSION)		\
65		-dBinDir=$(BINDIR)		\
66		-dPlatform=$(PLATFORM)
67
68$(SDKREDISTDIR)\Heimdal.msm: $(ASSEMBLYMODULE)
69	$(CP) $** $@
70
71POLICYMODULE=$(INSTDIR)\Heimdal.Policy.msm
72
73$(POLICYMODULE): $(OBJ)\heimdal-policy.wixobj
74	$(LIGHT) -out $@ $**
75
76$(OBJ)\heimdal-policy.wixobj: heimdal-policy.wxs
77	$(CANDLE) -arch $(PLATFORM) -o $@ $**	\
78		-dVersion=$(VERSION)		\
79		-dBinDir=$(BINDIR)		\
80		-dPlatform=$(PLATFORM)		\
81		-dPolPrefix=$(POLPREFIX)
82
83$(SDKREDISTDIR)\Heimdal.Policy.msm: $(POLICYMODULE)
84	$(CP) $** $@
85
86all:: $(ASSEMBLYMODULE) $(SDKREDISTDIR)\Heimdal.msm
87
88all:: $(POLICYMODULE) $(SDKREDISTDIR)\Heimdal.Policy.msm
89
90clean::
91	-$(RM) $(ASSEMBLYMODULE)
92	-$(RM) $(POLICYMODULE)
93	-$(RM) $(SDKREDISTDIR)\Heimdal.msm
94	-$(RM) $(SDKREDISTDIR)\Heimdal.Policy.msm
95
96######################################################################
97# Runtime modules
98
99!if [ $(PERL) $(SRC)\cf\w32-detect-vc-version.pl $(CC) ]==15
100VCVER=VC90
101!elseif [ $(PERL) $(SRC)\cf\w32-detect-vc-version.pl $(CC) ]==14
102VCVER=VC80
103!else
104!  error Cant determine Visual C compiler version
105!endif
106
107!if "$(BUILD)"=="rel"
108CRTNAME=CRT
109!else
110CRTNAME=DebugCRT
111!endif
112
113MMDIR=$(ProgramFiles)\Common Files\Merge Modules
114!if !exist($(MMDIR))
115MMDIR=$(SystemDrive)\Program Files (x86)\Common Files\Merge Modules
116!endif
117
118!if exist("$(MMDIR)")
119
120RUNTIMEMODULE32="$(MMDIR)\Microsoft_$(VCVER)_$(CRTNAME)_x86.msm"
121RUNTIMEMODULE64="$(MMDIR)\Microsoft_$(VCVER)_$(CRTNAME)_x86_x64.msm"
122
123!else
124
125RUNTIMEMODULE32="$(MSSDK)\Redist\VC\microsoft.vcxx.crt.x86_msm.msm"
126RUNTIMEMODULE64="$(MSSDK)\Redist\VC\microsoft.vcxx.crt.x64_msm.msm"
127
128!endif
129
130
131######################################################################
132# Heimdal installer
133
134CANDLEOPTS=	\
135	-dVersion=$(VERSION)			\
136	-dBinDir=$(BINDIR)			\
137	-dDocDir=$(DOCDIR)			\
138	-dSrcDir=$(SRC)				\
139	-dPlatform=$(PLATFORM)			\
140	-dPolPrefix=$(POLPREFIX)		\
141
142!if "$(CPU)"=="AMD64"
143
144INSTDIR32=$(INSTDIR:AMD64=i386)
145
146CANDLEOPTS=$(CANDLEOPTS) -dTarget64	\
147	-dInstDir32=$(INSTDIR32)	\
148	-dInstDir64=$(INSTDIR)			\
149	-dRuntimeModule32=$(RUNTIMEMODULE32)	\
150	-dRuntimeModule64=$(RUNTIMEMODULE64)	\
151
152!ifdef MULTIPLATFORM_INSTALLER
153CANDLEOPTS=$(CANDLEOPTS) -dTarget32
154!else
155!  message Excluding 32-bit components from installer
156!endif
157
158INSTDEPS=$(INSTDIR32)\Heimdal.msm \
159	$(INSTDIR32)\Heimdal.Policy.msm	\
160	$(ASSEMBLYMODULE) $(POLICYMODULE)
161
162!else
163
164CANDLEOPTS=$(CANDLEOPTS) -dTarget32		\
165	-dInstDir32=$(INSTDIR)			\
166	-dRuntimeModule32=$(RUNTIMEMODULE32)	\
167
168!endif
169
170!if exist($(SRC)\thirdparty)
171THIRDPARTYOBJS=$(INSTDIR)\apicache.wixobj $(INSTDIR)\lsacache.wixobj
172THIRDPARTYOPTS=-dApiCache=1 -dLsaCache=1
173
174!if "$(CPU)"=="AMD64"
175THIRDPARTYOBJS=$(THIRDPARTYOBJS) $(INSTDIR32)\apicache.wixobj $(INSTDIR32)\lsacache.wixobj
176!endif
177!endif
178
179!if exist($(SRC)\thirdparty\MKShim)
180THIRDPARTYOBJS=$(THIRDPARTYOBJS) $(INSTDIR)\MKShim.wixlib
181THIRDPARTYOPTS=$(THIRDPARTYOPTS) -dMKShim=1
182
183!if "$(CPU)"=="AMD64"
184THIRDPARTYOBJS=$(THIRDPARTYOBJS) $(INSTDIR32)\MKShim.wixlib
185!endif
186!endif
187
188INSTALLER=$(INSTDIR)\Heimdal-$(CPU)$(DEBUGOPT)-$(VERSIOND).msi
189
190$(INSTALLER): $(OBJ)\heimdal-installer.wixobj $(THIRDPARTYOBJS) $(INSTDEPS) lang\en-us.wxl
191	$(LIGHT) -out $@ $(OBJ)\heimdal-installer.wixobj $(THIRDPARTYOBJS)	\
192		-sval -cultures:en-us -loc lang\en-us.wxl	\
193		-dWixUILicenseRtf=lang\license-en-us.rtf	\
194		-ext WixUIExtension
195	$(_CODESIGN)
196
197$(OBJ)\heimdal-installer.wixobj: heimdal-installer.wxs
198	$(CANDLE) -arch $(PLATFORM) -o $@ heimdal-installer.wxs \
199		$(CANDLEOPTS) $(THIRDPARTYOPTS)
200
201all:: $(INSTALLER)
202
203clean::
204	-$(RM) $(INSTALLER)
205
206!endif				# BUILD_INSTALLERS
207