xref: /trunk/main/solenv/gbuild/platform/windows.mk (revision 7871dc3e)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24GUI := WNT
25COM := MSC
26
27# set tmpdir to some mixed case path, suitable for native tools
28gb_TMPDIR:=$(if $(TMPDIR),$(shell cygpath -m $(TMPDIR)),$(shell cygpath -m /tmp))
29gb_MKTEMP := mktemp --tmpdir=$(gb_TMPDIR) gbuild.XXXXXX
30
31gb_CC := cl
32gb_CXX := cl
33gb_LINK := link
34gb_AWK := awk
35gb_CLASSPATHSEP := ;
36gb_RC := rc
37
38# use CC/CXX if they are nondefaults
39ifneq ($(origin CC),default)
40gb_CC := $(CC)
41gb_GCCP := $(CC)
42endif
43ifneq ($(origin CXX),default)
44gb_CXX := $(CXX)
45endif
46
47gb_OSDEFS := \
48	-DWINVER=0x0500 \
49	-D_WIN32_IE=0x0500 \
50	-DNT351 \
51	-DWIN32 \
52	-DWNT \
53
54gb_COMPILERDEFS := \
55	-DMSC \
56	-D_CRT_NON_CONFORMING_SWPRINTFS \
57	-D_CRT_NONSTDC_NO_DEPRECATE \
58	-D_CRT_SECURE_NO_DEPRECATE \
59	-D_MT \
60	-DBOOST_MEM_FN_ENABLE_CDECL \
61	-DCPPU_ENV=msci \
62	-DFULL_DESK \
63	-DM1500 \
64
65gb_CPUDEFS := -DINTEL -D_X86_=1
66
67gb_RCDEFS := \
68     -DWINVER=0x0400 \
69	 -DWIN32 \
70
71gb_RCFLAGS := \
72     -V
73
74gb_CFLAGS := \
75	-Gd \
76	-GR \
77	-Gs \
78	-GS \
79	-Gy \
80	-nologo \
81	-Wall \
82	-wd4005 \
83	-wd4061 \
84	-wd4127 \
85	-wd4180 \
86	-wd4189 \
87	-wd4191 \
88	-wd4217 \
89	-wd4250 \
90	-wd4251 \
91	-wd4255 \
92	-wd4275 \
93	-wd4290 \
94	-wd4294 \
95	-wd4350 \
96	-wd4355 \
97	-wd4365 \
98	-wd4503 \
99	-wd4505 \
100	-wd4511 \
101	-wd4512 \
102	-wd4514 \
103	-wd4611 \
104	-wd4619 \
105	-wd4625 \
106	-wd4626 \
107	-wd4640 \
108	-wd4668 \
109	-wd4675 \
110	-wd4692 \
111	-wd4710 \
112	-wd4711 \
113	-wd4738 \
114	-wd4786 \
115	-wd4800 \
116	-wd4820 \
117	-wd4826 \
118	-Zc:forScope,wchar_t- \
119	-Zm500 \
120
121gb_CXXFLAGS := \
122	-Gd \
123	-GR \
124	-Gs \
125	-GS \
126	-Gy \
127	-nologo \
128	-Wall \
129	-wd4005 \
130	-wd4061 \
131	-wd4127 \
132	-wd4180 \
133	-wd4189 \
134	-wd4191 \
135	-wd4217 \
136	-wd4250 \
137	-wd4251 \
138	-wd4275 \
139	-wd4290 \
140	-wd4294 \
141	-wd4350 \
142	-wd4355 \
143	-wd4365 \
144	-wd4503 \
145	-wd4505 \
146	-wd4511 \
147	-wd4512 \
148	-wd4514 \
149	-wd4611 \
150	-wd4619 \
151	-wd4625 \
152	-wd4626 \
153	-wd4640 \
154	-wd4668 \
155	-wd4675 \
156	-wd4692 \
157	-wd4710 \
158	-wd4711 \
159	-wd4738 \
160	-wd4786 \
161	-wd4800 \
162	-wd4820 \
163	-wd4826 \
164	-Zc:forScope,wchar_t- \
165	-Zm500 \
166
167gb_STDLIBS := \
168    uwinapi \
169    kernel32 \
170    msvcrt \
171    oldnames \
172
173ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
174gb_CFLAGS_WERROR := -WX
175gb_CXXFLAGS_WERROR := -WX
176endif
177
178gb_LinkTarget_EXCEPTIONFLAGS := \
179	-DEXCEPTIONS_ON \
180	-EHa \
181
182gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
183
184
185gb_LinkTarget_NOEXCEPTIONFLAGS := \
186	-DEXCEPTIONS_OFF \
187
188gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS := $(gb_LinkTarget_NOEXCEPTIONFLAGS)
189
190gb_LinkTarget_LDFLAGS := \
191	-MACHINE:IX86 \
192	-NODEFAULTLIB \
193	-OPT:NOREF \
194	-SUBSYSTEM:CONSOLE \
195	-safeseh \
196	-nxcompat \
197	-dynamicbase \
198	$(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
199
200ifneq ($(ENABLE_CRASHDUMP),)
201gb_LinkTarget_LDFLAGS += -DEBUG
202gb_CFLAGS+=-Zi
203gb_CXXFLAGS+=-Zi
204endif
205
206ifeq ($(gb_DEBUGLEVEL),2)
207gb_CXXFLAGS +=-Zi
208gb_CFLAGS +=-Zi
209gb_COMPILEROPTFLAGS :=
210gb_LinkTarget_LDFLAGS += -DEBUG
211else
212gb_COMPILEROPTFLAGS := -Ob1 -Oxs -Oy-
213endif
214
215gb_COMPILERNOOPTFLAGS := -Od
216
217
218# Helper class
219gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
220gb_Helper_WORKDIR_NATIVE := $(shell cygpath -m $(WORKDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
221gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
222gb_Helper_REPODIR_NATIVE := $(shell cygpath -m $(REPODIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
223
224define gb_Helper_abbreviate_dirs_native
225R=$(gb_Helper_REPODIR_NATIVE) && $(subst $(REPODIR)/,$$R/,$(subst $(gb_Helper_REPODIR_NATIVE)/,$$R/,O=$(gb_Helper_OUTDIR_NATIVE) && W=$(gb_Helper_WORKDIR_NATIVE) && S=$(gb_Helper_SRCDIR_NATIVE))) && \
226$(subst $(REPODIR)/,$$R/,$(subst $(SRCDIR)/,$$S/,$(subst $(OUTDIR)/,$$O/,$(subst $(WORKDIR)/,$$W/,$(subst $(gb_Helper_REPODIR_NATIVE)/,$$R/,$(subst $(gb_Helper_SRCDIR_NATIVE)/,$$S/,$(subst $(gb_Helper_OUTDIR_NATIVE)/,$$O/,$(subst $(gb_Helper_WORKDIR_NATIVE)/,$$W/,$(1)))))))))
227endef
228
229# convert parametters filesystem root to native notation
230# does some real work only on windows, make sure not to
231# break the dummy implementations on unx*
232define gb_Helper_convert_native
233$(patsubst -I$(OUTDIR)%,-I$(gb_Helper_OUTDIR_NATIVE)%, \
234$(patsubst $(OUTDIR)%,$(gb_Helper_OUTDIR_NATIVE)%, \
235$(patsubst $(WORKDIR)%,$(gb_Helper_WORKDIR_NATIVE)%, \
236$(patsubst $(SRCDIR)%,$(gb_Helper_SRCDIR_NATIVE)%, \
237$(1)))))
238endef
239
240
241# CObject class
242
243ifeq ($(gb_FULLDEPS),$(true))
244define gb_CObject__command_deponcompile
245$(call gb_Helper_abbreviate_dirs_native,\
246	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
247		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
248		-I$(dir $(3)) \
249		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME)%,$(6)) \
250		$(3) \
251		-f - \
252	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
253		-v OBJECTFILE=$(1) \
254		-v OUTDIR=$(OUTDIR)/ \
255		-v WORKDIR=$(WORKDIR)/ \
256		-v SRCDIR=$(SRCDIR)/ \
257		-v REPODIR=$(REPODIR)/ \
258	> $(call gb_CObject_get_dep_target,$(2)))
259endef
260else
261CObject__command_deponcompile =
262endif
263
264define gb_CObject__command
265$(call gb_Output_announce,$(2),$(true),C  ,3)
266$(call gb_Helper_abbreviate_dirs_native,\
267	mkdir -p $(dir $(1)) && \
268	unset INCLUDE && \
269	$(gb_CC) \
270		$(DEFS) $(CFLAGS)  -Fd$(PDBFILE) \
271        $(PCHFLAGS) \
272		-I$(dir $(3)) \
273		$(INCLUDE) \
274		-c $(3) \
275		-Fo$(1))
276$(call gb_CObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
277endef
278
279
280# CxxObject class
281
282ifeq ($(gb_FULLDEPS),$(true))
283define gb_CxxObject__command_deponcompile
284$(call gb_Helper_abbreviate_dirs_native,\
285	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
286		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
287		-I$(dir $(3)) \
288		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME)%,$(6)) \
289		$(3) \
290		-f - \
291	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
292		-v OBJECTFILE=$(1) \
293		-v OUTDIR=$(OUTDIR)/ \
294		-v WORKDIR=$(WORKDIR)/ \
295		-v SRCDIR=$(SRCDIR)/ \
296		-v REPODIR=$(REPODIR)/ \
297	> $(call gb_CxxObject_get_dep_target,$(2)))
298 endef
299else
300gb_CxxObject__command_deponcompile =
301endif
302
303define gb_CxxObject__command
304$(call gb_Output_announce,$(2),$(true),CXX,3)
305$(call gb_Helper_abbreviate_dirs_native,\
306	mkdir -p $(dir $(1)) && \
307	unset INCLUDE && \
308	$(gb_CXX) \
309		$(DEFS) $(CXXFLAGS) -Fd$(PDBFILE)\
310        $(PCHFLAGS) \
311		-I$(dir $(3)) \
312		$(INCLUDE_STL) $(INCLUDE) \
313		-c $(3) \
314		-Fo$(1))
315$(call gb_CxxObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
316endef
317
318
319# PrecompiledHeader class
320
321gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
322									   -Fp$(call gb_PrecompiledHeader_get_target,$(1))
323
324ifeq ($(gb_FULLDEPS),$(true))
325define gb_PrecompiledHeader__command_deponcompile
326$(call gb_Helper_abbreviate_dirs_native,\
327	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
328		$(4) $(5) \
329		-I$(dir $(3)) \
330		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME)%,$(6)) \
331		$(3) \
332		-f - \
333	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
334		-v OBJECTFILE=$(1) \
335		-v OUTDIR=$(OUTDIR)/ \
336		-v WORKDIR=$(WORKDIR)/ \
337		-v SRCDIR=$(SRCDIR)/ \
338		-v REPODIR=$(REPODIR)/ \
339	> $(call gb_PrecompiledHeader_get_dep_target,$(2)))
340endef
341else
342gb_PrecompiledHeader__command_deponcompile =
343endif
344
345
346define gb_PrecompiledHeader__command
347$(call gb_Output_announce,$(2),$(true),PCH,1)
348$(call gb_Helper_abbreviate_dirs_native,\
349	mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
350	unset INCLUDE && \
351	$(gb_CXX) \
352		$(4) $(5) -Fd$(PDBFILE) \
353		-I$(dir $(3)) \
354		$(6) \
355		-c $(3) \
356		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
357$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
358endef
359
360# NoexPrecompiledHeader class
361
362gb_NoexPrecompiledHeader_get_enableflags = -Yu$(1).hxx \
363										   -Fp$(call gb_NoexPrecompiledHeader_get_target,$(1))
364
365ifeq ($(gb_FULLDEPS),$(true))
366define gb_NoexPrecompiledHeader__command_deponcompile
367$(call gb_Helper_abbreviate_dirs_native,\
368	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
369		$(4) $(5) \
370		-I$(dir $(3)) \
371		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME)%,$(6)) \
372		$(3) \
373		-f - \
374	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
375		-v OBJECTFILE=$(1) \
376		-v OUTDIR=$(OUTDIR)/ \
377		-v WORKDIR=$(WORKDIR)/ \
378		-v SRCDIR=$(SRCDIR)/ \
379		-v REPODIR=$(REPODIR)/ \
380	> $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
381endef
382else
383gb_NoexPrecompiledHeader__command_deponcompile =
384endif
385
386
387define gb_NoexPrecompiledHeader__command
388$(call gb_Output_announce,$(2),$(true),PCH,1)
389$(call gb_Helper_abbreviate_dirs_native,\
390	mkdir -p $(dir $(1)) $(dir $(call gb_NoexPrecompiledHeader_get_dep_target,$(2))) && \
391	unset INCLUDE && \
392	$(gb_CXX) \
393		$(4) $(5) -Fd$(PDBFILE) \
394		-I$(dir $(3)) \
395		$(6) \
396		-c $(3) \
397		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
398$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
399endef
400
401# LinkTarget class
402
403gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
404gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
405
406gb_LinkTarget_INCLUDE :=\
407	$(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) \
408	$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
409
410gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
411
412gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb
413
414define gb_LinkTarget__command
415$(call gb_Output_announce,$(2),$(true),LNK,4)
416$(call gb_Helper_abbreviate_dirs_native,\
417	mkdir -p $(dir $(1)) && \
418	rm -f $(1) && \
419	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100, \
420	    $(call gb_Helper_convert_native,$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
421		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
422		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
423		$(PCHOBJS) $(NATIVERES))) && \
424	$(gb_LINK) \
425		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
426		$(if $(filter StaticLibrary,$(TARGETTYPE)),$(gb_StaticLibrary_TARGETTYPEFLAGS)) \
427		$(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
428		$(LDFLAGS) \
429		@$${RESPONSEFILE} \
430		$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))) \
431		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \
432		$(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \
433	$(if $(DLLTARGET),; if [ ! -f $(DLLTARGET) ]; then rm -f $(1) && false; fi) ; exit $$RC)
434endef
435
436
437# Library class
438
439gb_Library_DEFS := -D_DLL
440gb_Library_TARGETTYPEFLAGS := -DLL
441gb_Library_get_rpath :=
442
443gb_Library_SYSPRE := i
444gb_Library_PLAINEXT := .lib
445
446gb_Library_PLAINLIBS_NONE += \
447	advapi32 \
448	gdi32 \
449	gdiplus \
450	gnu_getopt \
451	imm32\
452	kernel32 \
453	msimg32 \
454	msvcrt \
455	mpr \
456	oldnames \
457	ole32 \
458	oleaut32 \
459	shell32 \
460	user32 \
461	uuid \
462	uwinapi \
463	winspool \
464	z \
465	cppunit
466
467gb_Library_LAYER := \
468	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
469	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
470	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
471	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
472	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
473	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
474	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
475	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
476	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
477	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
478
479gb_Library_FILENAMES :=\
480	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
481
482gb_Library_DLLEXT := .dll
483gb_Library_MAJORVER := 3
484gb_Library_RTEXT := MSC$(gb_Library_DLLEXT)
485ifeq ($(gb_PRODUCT),$(true))
486gb_Library_STLEXT := port_vc7145$(gb_Library_DLLEXT)
487else
488gb_Library_STLEXT := port_vc7145_stldebug$(gb_Library_DLLEXT)
489endif
490gb_Library_OOOEXT := $(gb_Library_DLLEXT)
491gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
492gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
493gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
494
495gb_Library_DLLFILENAMES :=\
496	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
497	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
498	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
499	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
500	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
501	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
502	$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(lib)$(gb_Library_STLEXT)) \
503	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
504	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
505	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
506
507define gb_Library_Library_platform
508$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
509
510$(call gb_LinkTarget_set_auxtargets,$(2),\
511	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
512	$(3).manifest \
513	$(call gb_LinkTarget_get_pdbfile,$(2)) \
514	$(patsubst %.dll,%.pdb,$(3)) \
515	$(patsubst %.dll,%.ilk,$(3)) \
516)
517
518$(call gb_Library_get_target,$(1)) \
519$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
520
521ifneq ($(ENABLE_CRASHDUMP),)
522$(call gb_Library_get_target,$(1)) \
523$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS +=  \
524		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))) \
525		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))) \
526
527$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))),$(patsubst %.dll,%.pdb,$(3)))
528$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))),$(patsubst %.dll,%.ilk,$(3)))
529endif
530
531$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3))
532
533$(call gb_LinkTarget_get_target,$(2)) \
534$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
535
536endef
537
538define gb_Library_add_default_nativeres
539$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
540$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
541$(call gb_WinResTarget_set_defs,$(1)/$(2),\
542        $$(DEFS) \
543		-DADDITIONAL_VERINFO1 \
544		-DADDITIONAL_VERINFO2 \
545		-DADDITIONAL_VERINFO3 \
546)
547$(call gb_Library_add_nativeres,$(1),$(2))
548$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
549
550endef
551
552define gb_Library_add_nativeres
553$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
554$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
555
556endef
557
558define gb_Library_get_dllname
559$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
560endef
561
562
563# StaticLibrary class
564
565gb_StaticLibrary_DEFS :=
566gb_StaticLibrary_TARGETTYPEFLAGS := -LIB
567gb_StaticLibrary_SYSPRE :=
568gb_StaticLibrary_PLAINEXT := .lib
569gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
570
571gb_StaticLibrary_FILENAMES := \
572	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
573	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
574
575gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
576
577define gb_StaticLibrary_StaticLibrary_platform
578$(call gb_LinkTarget_get_target,$(2)) \
579$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
580
581$(call gb_LinkTarget_set_auxtargets,$(2),\
582	$(call gb_LinkTarget_get_pdbfile,$(2)) \
583)
584
585endef
586
587# Executable class
588
589gb_Executable_EXT := .exe
590gb_Executable_TARGETTYPEFLAGS := -RELEASE -BASE:0x1b000000 -OPT:NOREF -INCREMENTAL:NO -DEBUG
591gb_Executable_get_rpath :=
592
593define gb_Executable_Executable_platform
594$(call gb_LinkTarget_set_auxtargets,$(2),\
595	$(patsubst %.exe,%.pdb,$(call gb_LinkTarget_get_target,$(2))) \
596	$(call gb_LinkTarget_get_pdbfile,$(2)) \
597	$(call gb_LinkTarget_get_target,$(2)).manifest \
598)
599
600$(call gb_Executable_get_target,$(1)) \
601$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS := $(call gb_Executable_get_target,$(1)).manifest
602$(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)).manifest,$(call gb_LinkTarget_get_target,$(2)).manifest)
603
604$(call gb_LinkTarget_get_target,$(2)) \
605$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
606
607endef
608
609# CppunitTest class
610
611gb_CppunitTest_CPPTESTPRECOMMAND :=
612gb_CppunitTest_SYSPRE := itest_
613gb_CppunitTest_EXT := .lib
614gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
615gb_CppunitTest_get_libfilename = test_$(1).dll
616
617define gb_CppunitTest_CppunitTest_platform
618$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
619
620$(call gb_LinkTarget_set_auxtargets,$(2),\
621	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
622	$(3).manifest \
623	$(patsubst %.dll,%.pdb,$(3)) \
624	$(call gb_LinkTarget_get_pdbfile,$(2)) \
625	$(patsubst %.dll,%.ilk,$(3)) \
626)
627
628$(call gb_LinkTarget_get_target,$(2)) \
629$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
630
631endef
632
633# JunitTest class
634
635gb_defaultlangiso := en-US
636gb_smoketest_instset := $(SRCDIR)/instsetoo_native/$(INPATH)/OpenOffice/archive/install/$(gb_defaultlangiso)/OOo_*_install-arc_$(gb_defaultlangiso).zip
637
638ifeq ($(OOO_TEST_SOFFICE),)
639
640
641# Work around Windows problems with long pathnames (see issue 50885) by
642# installing into the temp directory instead of the module output tree (in which
643# case $(target).instpath contains the path to the temp installation,
644# which is removed after smoketest); can be removed once issue 50885 is fixed;
645# on other platforms, a single installation to solver is created in
646# smoketestoo_native.
647
648# for now, no dependency on $(shell ls $(gb_smoketest_instset))
649# because that doesn't work before the instset is built
650# and there is not much of a benefit anyway (gbuild not knowing about smoketest)
651define gb_JunitTest_JunitTest_platform_longpathname_hack
652$(call gb_JunitTest_get_target,$(1)) : $(call gb_JunitTest_get_target,$(1)).instpath
653$(call gb_JunitTest_get_target,$(1)) : CLEAN_CMD = $(call gb_Helper_abbreviate_dirs,rm -rf `cat $$@.instpath` $$@.instpath)
654
655$(call gb_JunitTest_get_target,$(1)).instpath :
656	INST_DIR=$$$$(cygpath -m `mktemp -d -t testinst.XXXXXX`) \
657	&& unzip -d "$$$${INST_DIR}"  $$(gb_smoketest_instset) \
658	&& mv "$$$${INST_DIR}"/OOo_*_install-arc_$$(gb_defaultlangiso) "$$$${INST_DIR}"/opt\
659	&& mkdir -p $$(dir $$@) \
660	&& echo "$$$${INST_DIR}" > $$@
661
662endef
663else # OOO_TEST_SOFFICE
664gb_JunitTest_JunitTest_platform_longpathname_hack =
665endif # OOO_TEST_SOFFICE
666
667define gb_JunitTest_JunitTest_platform
668$(call gb_JunitTest_JunitTest_platform_longpathname_hack,$(1))
669
670$(call gb_JunitTest_get_target,$(1)) : DEFS := \
671	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:`cat $(call gb_JunitTest_get_target,$(1)).instpath`/opt/OpenOffice.org 3/program/soffice.exe}" \
672    -Dorg.openoffice.test.arg.env=PATH \
673    -Dorg.openoffice.test.arg.user=file:///$(call gb_JunitTest_get_userdir,$(1)) \
674
675endef
676
677
678# SdiTarget class
679
680gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
681
682# SrsPartMergeTarget
683
684gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
685
686# SrsPartTarget class
687
688gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
689gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
690
691ifeq ($(gb_FULLDEPS),$(true))
692define gb_SrsPartTarget__command_dep
693$(call gb_Helper_abbreviate_dirs_native,\
694	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
695		$(INCLUDE) \
696		$(DEFS) \
697		$(2) \
698		-f - \
699	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
700		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
701		-v OUTDIR=$(OUTDIR)/ \
702		-v WORKDIR=$(WORKDIR)/ \
703		-v SRCDIR=$(SRCDIR)/ \
704		-v REPODIR=$(REPODIR)/ \
705	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
706endef
707else
708gb_SrsPartTarget__command_dep =
709endif
710
711# WinResTarget class
712
713gb_WinResTarget_POSTFIX :=.res
714
715define gb_WinResTarget__command
716$(call gb_Output_announce,$(2),$(true),RES,3)
717$(call gb_Helper_abbreviate_dirs_native,\
718	mkdir -p $(dir $(1)) && \
719	$(gb_RC) \
720		$(DEFS) $(FLAGS) \
721		-I$(dir $(3)) \
722		$(INCLUDE) \
723		-Fo$(1) \
724        $(RCFILE) )
725endef
726
727$(eval $(call gb_Helper_make_dep_targets,\
728	WinResTarget \
729))
730
731ifeq ($(gb_FULLDEPS),$(true))
732define gb_WinResTarget__command_dep
733$(call gb_Helper_abbreviate_dirs_native,\
734	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
735		$(INCLUDE) \
736		$(DEFS) \
737		$(2) \
738		-f - \
739	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
740		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
741		-v OUTDIR=$(OUTDIR)/ \
742		-v WORKDIR=$(WORKDIR)/ \
743		-v SRCDIR=$(SRCDIR)/ \
744		-v REPODIR=$(REPODIR)/ \
745	> $(call gb_WinResTarget_get_dep_target,$(1)))
746endef
747else
748gb_WinResTarget__command_dep =
749endif
750
751# ComponentTarget
752
753gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
754gb_Library_COMPONENTPREFIXES := \
755    OOO:vnd.sun.star.expand:\dBRAND_BASE_DIR/program/ \
756    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
757
758# vim: set noet sw=4 ts=4:
759