xref: /aoo42x/main/solenv/gbuild/platform/windows.mk (revision 44c25570)
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		$(patsubst %,%.lib,$(EXTERNAL_LIBS)) \
432		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \
433		$(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \
434	$(if $(DLLTARGET),; if [ ! -f $(DLLTARGET) ]; then rm -f $(1) && false; fi) ; exit $$RC)
435endef
436
437
438# Library class
439
440gb_Library_DEFS := -D_DLL
441gb_Library_TARGETTYPEFLAGS := -DLL
442gb_Library_get_rpath :=
443
444gb_Library_SYSPRE := i
445gb_Library_PLAINEXT := .lib
446
447gb_Library_PLAINLIBS_NONE += \
448	advapi32 \
449	gdi32 \
450	gdiplus \
451	gnu_getopt \
452	imm32\
453	kernel32 \
454	msimg32 \
455	msvcrt \
456	mpr \
457	oldnames \
458	ole32 \
459	oleaut32 \
460	shell32 \
461	user32 \
462	uuid \
463	uwinapi \
464	winspool \
465	z \
466	cppunit
467
468gb_Library_LAYER := \
469	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
470	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
471	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
472	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
473	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
474	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
475	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
476	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
477	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
478	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
479
480gb_Library_FILENAMES :=\
481	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
482
483gb_Library_DLLEXT := .dll
484gb_Library_MAJORVER := 3
485gb_Library_RTEXT := MSC$(gb_Library_DLLEXT)
486ifeq ($(gb_PRODUCT),$(true))
487gb_Library_STLEXT := port_vc7145$(gb_Library_DLLEXT)
488else
489gb_Library_STLEXT := port_vc7145_stldebug$(gb_Library_DLLEXT)
490endif
491gb_Library_OOOEXT := $(gb_Library_DLLEXT)
492gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
493gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
494gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
495
496gb_Library_DLLFILENAMES :=\
497	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
498	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
499	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
500	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
501	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
502	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
503	$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(lib)$(gb_Library_STLEXT)) \
504	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
505	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
506	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
507
508define gb_Library_Library_platform
509$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
510
511$(call gb_LinkTarget_set_auxtargets,$(2),\
512	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
513	$(3).manifest \
514	$(call gb_LinkTarget_get_pdbfile,$(2)) \
515	$(patsubst %.dll,%.pdb,$(3)) \
516	$(patsubst %.dll,%.ilk,$(3)) \
517)
518
519$(call gb_Library_get_target,$(1)) \
520$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
521
522ifneq ($(ENABLE_CRASHDUMP),)
523$(call gb_Library_get_target,$(1)) \
524$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS +=  \
525		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))) \
526		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))) \
527
528$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))),$(patsubst %.dll,%.pdb,$(3)))
529$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))),$(patsubst %.dll,%.ilk,$(3)))
530endif
531
532$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3))
533
534$(call gb_LinkTarget_get_target,$(2)) \
535$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
536
537endef
538
539define gb_Library_add_default_nativeres
540$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
541$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
542$(call gb_WinResTarget_set_defs,$(1)/$(2),\
543        $$(DEFS) \
544		-DADDITIONAL_VERINFO1 \
545		-DADDITIONAL_VERINFO2 \
546		-DADDITIONAL_VERINFO3 \
547)
548$(call gb_Library_add_nativeres,$(1),$(2))
549$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
550
551endef
552
553define gb_Library_add_nativeres
554$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
555$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
556
557endef
558
559define gb_Library_get_dllname
560$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
561endef
562
563
564# StaticLibrary class
565
566gb_StaticLibrary_DEFS :=
567gb_StaticLibrary_TARGETTYPEFLAGS := -LIB
568gb_StaticLibrary_SYSPRE :=
569gb_StaticLibrary_PLAINEXT := .lib
570gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
571
572gb_StaticLibrary_FILENAMES := \
573	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
574	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
575
576gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
577
578define gb_StaticLibrary_StaticLibrary_platform
579$(call gb_LinkTarget_get_target,$(2)) \
580$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
581
582$(call gb_LinkTarget_set_auxtargets,$(2),\
583	$(call gb_LinkTarget_get_pdbfile,$(2)) \
584)
585
586endef
587
588# Executable class
589
590gb_Executable_EXT := .exe
591gb_Executable_TARGETTYPEFLAGS := -RELEASE -BASE:0x1b000000 -OPT:NOREF -INCREMENTAL:NO -DEBUG
592gb_Executable_get_rpath :=
593
594define gb_Executable_Executable_platform
595$(call gb_LinkTarget_set_auxtargets,$(2),\
596	$(patsubst %.exe,%.pdb,$(call gb_LinkTarget_get_target,$(2))) \
597	$(call gb_LinkTarget_get_pdbfile,$(2)) \
598	$(call gb_LinkTarget_get_target,$(2)).manifest \
599)
600
601$(call gb_Executable_get_target,$(1)) \
602$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS := $(call gb_Executable_get_target,$(1)).manifest
603$(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)).manifest,$(call gb_LinkTarget_get_target,$(2)).manifest)
604
605$(call gb_LinkTarget_get_target,$(2)) \
606$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
607
608endef
609
610# CppunitTest class
611
612gb_CppunitTest_CPPTESTPRECOMMAND :=
613gb_CppunitTest_SYSPRE := itest_
614gb_CppunitTest_EXT := .lib
615gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
616gb_CppunitTest_get_libfilename = test_$(1).dll
617
618define gb_CppunitTest_CppunitTest_platform
619$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
620
621$(call gb_LinkTarget_set_auxtargets,$(2),\
622	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
623	$(3).manifest \
624	$(patsubst %.dll,%.pdb,$(3)) \
625	$(call gb_LinkTarget_get_pdbfile,$(2)) \
626	$(patsubst %.dll,%.ilk,$(3)) \
627)
628
629$(call gb_LinkTarget_get_target,$(2)) \
630$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
631
632endef
633
634# JunitTest class
635
636gb_defaultlangiso := en-US
637gb_smoketest_instset := $(SRCDIR)/instsetoo_native/$(INPATH)/OpenOffice/archive/install/$(gb_defaultlangiso)/OOo_*_install-arc_$(gb_defaultlangiso).zip
638
639ifeq ($(OOO_TEST_SOFFICE),)
640
641
642# Work around Windows problems with long pathnames (see issue 50885) by
643# installing into the temp directory instead of the module output tree (in which
644# case $(target).instpath contains the path to the temp installation,
645# which is removed after smoketest); can be removed once issue 50885 is fixed;
646# on other platforms, a single installation to solver is created in
647# smoketestoo_native.
648
649# for now, no dependency on $(shell ls $(gb_smoketest_instset))
650# because that doesn't work before the instset is built
651# and there is not much of a benefit anyway (gbuild not knowing about smoketest)
652define gb_JunitTest_JunitTest_platform_longpathname_hack
653$(call gb_JunitTest_get_target,$(1)) : $(call gb_JunitTest_get_target,$(1)).instpath
654$(call gb_JunitTest_get_target,$(1)) : CLEAN_CMD = $(call gb_Helper_abbreviate_dirs,rm -rf `cat $$@.instpath` $$@.instpath)
655
656$(call gb_JunitTest_get_target,$(1)).instpath :
657	INST_DIR=$$$$(cygpath -m `mktemp -d -t testinst.XXXXXX`) \
658	&& unzip -d "$$$${INST_DIR}"  $$(gb_smoketest_instset) \
659	&& mv "$$$${INST_DIR}"/OOo_*_install-arc_$$(gb_defaultlangiso) "$$$${INST_DIR}"/opt\
660	&& mkdir -p $$(dir $$@) \
661	&& echo "$$$${INST_DIR}" > $$@
662
663endef
664else # OOO_TEST_SOFFICE
665gb_JunitTest_JunitTest_platform_longpathname_hack =
666endif # OOO_TEST_SOFFICE
667
668define gb_JunitTest_JunitTest_platform
669$(call gb_JunitTest_JunitTest_platform_longpathname_hack,$(1))
670
671$(call gb_JunitTest_get_target,$(1)) : DEFS := \
672	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:`cat $(call gb_JunitTest_get_target,$(1)).instpath`/opt/OpenOffice.org 3/program/soffice.exe}" \
673    -Dorg.openoffice.test.arg.env=PATH \
674    -Dorg.openoffice.test.arg.user=file:///$(call gb_JunitTest_get_userdir,$(1)) \
675
676endef
677
678
679# SdiTarget class
680
681gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
682
683# SrsPartMergeTarget
684
685gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
686
687# SrsPartTarget class
688
689gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
690gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
691
692ifeq ($(gb_FULLDEPS),$(true))
693define gb_SrsPartTarget__command_dep
694$(call gb_Helper_abbreviate_dirs_native,\
695	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
696		$(INCLUDE) \
697		$(DEFS) \
698		$(2) \
699		-f - \
700	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
701		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
702		-v OUTDIR=$(OUTDIR)/ \
703		-v WORKDIR=$(WORKDIR)/ \
704		-v SRCDIR=$(SRCDIR)/ \
705		-v REPODIR=$(REPODIR)/ \
706	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
707endef
708else
709gb_SrsPartTarget__command_dep =
710endif
711
712# WinResTarget class
713
714gb_WinResTarget_POSTFIX :=.res
715
716define gb_WinResTarget__command
717$(call gb_Output_announce,$(2),$(true),RES,3)
718$(call gb_Helper_abbreviate_dirs_native,\
719	mkdir -p $(dir $(1)) && \
720	$(gb_RC) \
721		$(DEFS) $(FLAGS) \
722		-I$(dir $(3)) \
723		$(INCLUDE) \
724		-Fo$(1) \
725        $(RCFILE) )
726endef
727
728$(eval $(call gb_Helper_make_dep_targets,\
729	WinResTarget \
730))
731
732ifeq ($(gb_FULLDEPS),$(true))
733define gb_WinResTarget__command_dep
734$(call gb_Helper_abbreviate_dirs_native,\
735	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
736		$(INCLUDE) \
737		$(DEFS) \
738		$(2) \
739		-f - \
740	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
741		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
742		-v OUTDIR=$(OUTDIR)/ \
743		-v WORKDIR=$(WORKDIR)/ \
744		-v SRCDIR=$(SRCDIR)/ \
745		-v REPODIR=$(REPODIR)/ \
746	> $(call gb_WinResTarget_get_dep_target,$(1)))
747endef
748else
749gb_WinResTarget__command_dep =
750endif
751
752# ComponentTarget
753
754gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
755gb_Library_COMPONENTPREFIXES := \
756    OOO:vnd.sun.star.expand:\dBRAND_BASE_DIR/program/ \
757    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
758
759# vim: set noet sw=4 ts=4:
760