xref: /aoo41x/main/solenv/gbuild/platform/windows.mk (revision 910823ae)
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	-SUBSYSTEM:CONSOLE \
194	$(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
195
196ifneq ($(ENABLE_CRASHDUMP),)
197gb_LinkTarget_LDFLAGS += -DEBUG
198gb_CFLAGS+=-Zi
199gb_CXXFLAGS+=-Zi
200endif
201
202ifeq ($(gb_DEBUGLEVEL),2)
203gb_CXXFLAGS +=-Zi
204gb_CFLAGS +=-Zi
205gb_COMPILEROPTFLAGS :=
206gb_LinkTarget_LDFLAGS += -DEBUG
207else
208gb_COMPILEROPTFLAGS := -Ob1 -Oxs -Oy-
209endif
210
211gb_COMPILERNOOPTFLAGS := -Od
212
213
214# Helper class
215gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
216gb_Helper_WORKDIR_NATIVE := $(shell cygpath -m $(WORKDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
217gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
218gb_Helper_REPODIR_NATIVE := $(shell cygpath -m $(REPODIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
219
220define gb_Helper_abbreviate_dirs_native
221R=$(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))) && \
222$(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)))))))))
223endef
224
225# convert parametters filesystem root to native notation
226# does some real work only on windows, make sure not to
227# break the dummy implementations on unx*
228define gb_Helper_convert_native
229$(patsubst -I$(OUTDIR)%,-I$(gb_Helper_OUTDIR_NATIVE)%, \
230$(patsubst $(OUTDIR)%,$(gb_Helper_OUTDIR_NATIVE)%, \
231$(patsubst $(WORKDIR)%,$(gb_Helper_WORKDIR_NATIVE)%, \
232$(patsubst $(SRCDIR)%,$(gb_Helper_SRCDIR_NATIVE)%, \
233$(1)))))
234endef
235
236
237# CObject class
238
239ifeq ($(gb_FULLDEPS),$(true))
240define gb_CObject__command_deponcompile
241$(call gb_Helper_abbreviate_dirs_native,\
242	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
243		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
244		-I$(dir $(3)) \
245		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME)%,$(6)) \
246		$(3) \
247		-f - \
248	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
249		-v OBJECTFILE=$(1) \
250		-v OUTDIR=$(OUTDIR)/ \
251		-v WORKDIR=$(WORKDIR)/ \
252		-v SRCDIR=$(SRCDIR)/ \
253		-v REPODIR=$(REPODIR)/ \
254	> $(call gb_CObject_get_dep_target,$(2)))
255endef
256else
257CObject__command_deponcompile =
258endif
259
260define gb_CObject__command
261$(call gb_Output_announce,$(2),$(true),C  ,3)
262$(call gb_Helper_abbreviate_dirs_native,\
263	mkdir -p $(dir $(1)) && \
264	unset INCLUDE && \
265	$(gb_CC) \
266		$(DEFS) $(CFLAGS)  -Fd$(PDBFILE) \
267        $(PCHFLAGS) \
268		-I$(dir $(3)) \
269		$(INCLUDE) \
270		-c $(3) \
271		-Fo$(1))
272$(call gb_CObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
273endef
274
275
276# CxxObject class
277
278ifeq ($(gb_FULLDEPS),$(true))
279define gb_CxxObject__command_deponcompile
280$(call gb_Helper_abbreviate_dirs_native,\
281	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
282		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
283		-I$(dir $(3)) \
284		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME)%,$(6)) \
285		$(3) \
286		-f - \
287	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
288		-v OBJECTFILE=$(1) \
289		-v OUTDIR=$(OUTDIR)/ \
290		-v WORKDIR=$(WORKDIR)/ \
291		-v SRCDIR=$(SRCDIR)/ \
292		-v REPODIR=$(REPODIR)/ \
293	> $(call gb_CxxObject_get_dep_target,$(2)))
294 endef
295else
296gb_CxxObject__command_deponcompile =
297endif
298
299define gb_CxxObject__command
300$(call gb_Output_announce,$(2),$(true),CXX,3)
301$(call gb_Helper_abbreviate_dirs_native,\
302	mkdir -p $(dir $(1)) && \
303	unset INCLUDE && \
304	$(gb_CXX) \
305		$(DEFS) $(CXXFLAGS) -Fd$(PDBFILE)\
306        $(PCHFLAGS) \
307		-I$(dir $(3)) \
308		$(INCLUDE_STL) $(INCLUDE) \
309		-c $(3) \
310		-Fo$(1))
311$(call gb_CxxObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
312endef
313
314
315# PrecompiledHeader class
316
317gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
318									   -Fp$(call gb_PrecompiledHeader_get_target,$(1))
319
320ifeq ($(gb_FULLDEPS),$(true))
321define gb_PrecompiledHeader__command_deponcompile
322$(call gb_Helper_abbreviate_dirs_native,\
323	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
324		$(4) $(5) \
325		-I$(dir $(3)) \
326		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME)%,$(6)) \
327		$(3) \
328		-f - \
329	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
330		-v OBJECTFILE=$(1) \
331		-v OUTDIR=$(OUTDIR)/ \
332		-v WORKDIR=$(WORKDIR)/ \
333		-v SRCDIR=$(SRCDIR)/ \
334		-v REPODIR=$(REPODIR)/ \
335	> $(call gb_PrecompiledHeader_get_dep_target,$(2)))
336endef
337else
338gb_PrecompiledHeader__command_deponcompile =
339endif
340
341
342define gb_PrecompiledHeader__command
343$(call gb_Output_announce,$(2),$(true),PCH,1)
344$(call gb_Helper_abbreviate_dirs_native,\
345	mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
346	unset INCLUDE && \
347	$(gb_CXX) \
348		$(4) $(5) -Fd$(PDBFILE) \
349		-I$(dir $(3)) \
350		$(6) \
351		-c $(3) \
352		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
353$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
354endef
355
356# NoexPrecompiledHeader class
357
358gb_NoexPrecompiledHeader_get_enableflags = -Yu$(1).hxx \
359										   -Fp$(call gb_NoexPrecompiledHeader_get_target,$(1))
360
361ifeq ($(gb_FULLDEPS),$(true))
362define gb_NoexPrecompiledHeader__command_deponcompile
363$(call gb_Helper_abbreviate_dirs_native,\
364	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
365		$(4) $(5) \
366		-I$(dir $(3)) \
367		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME)%,$(6)) \
368		$(3) \
369		-f - \
370	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
371		-v OBJECTFILE=$(1) \
372		-v OUTDIR=$(OUTDIR)/ \
373		-v WORKDIR=$(WORKDIR)/ \
374		-v SRCDIR=$(SRCDIR)/ \
375		-v REPODIR=$(REPODIR)/ \
376	> $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
377endef
378else
379gb_NoexPrecompiledHeader__command_deponcompile =
380endif
381
382
383define gb_NoexPrecompiledHeader__command
384$(call gb_Output_announce,$(2),$(true),PCH,1)
385$(call gb_Helper_abbreviate_dirs_native,\
386	mkdir -p $(dir $(1)) $(dir $(call gb_NoexPrecompiledHeader_get_dep_target,$(2))) && \
387	unset INCLUDE && \
388	$(gb_CXX) \
389		$(4) $(5) -Fd$(PDBFILE) \
390		-I$(dir $(3)) \
391		$(6) \
392		-c $(3) \
393		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
394$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
395endef
396
397# LinkTarget class
398
399gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
400gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
401
402gb_LinkTarget_INCLUDE :=\
403	$(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) \
404	$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
405
406gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
407
408gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb
409
410define gb_LinkTarget__command
411$(call gb_Output_announce,$(2),$(true),LNK,4)
412$(call gb_Helper_abbreviate_dirs_native,\
413	mkdir -p $(dir $(1)) && \
414	rm -f $(1) && \
415	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100, \
416	    $(call gb_Helper_convert_native,$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
417		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
418		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
419		$(PCHOBJS) $(NATIVERES))) && \
420	$(gb_LINK) \
421		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
422		$(if $(filter StaticLibrary,$(TARGETTYPE)),$(gb_StaticLibrary_TARGETTYPEFLAGS)) \
423		$(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
424		$(LDFLAGS) \
425		@$${RESPONSEFILE} \
426		$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))) \
427		$(patsubst %,%.lib,$(EXTERNAL_LIBS)) \
428		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \
429		$(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \
430	$(if $(DLLTARGET),; if [ ! -f $(DLLTARGET) ]; then rm -f $(1) && false; fi) ; exit $$RC)
431endef
432
433
434# Library class
435
436gb_Library_DEFS := -D_DLL
437gb_Library_TARGETTYPEFLAGS := -DLL -OPT:NOREF -SAFESEH -NXCOMPAT -DYNAMICBASE
438gb_Library_get_rpath :=
439
440gb_Library_SYSPRE := i
441gb_Library_PLAINEXT := .lib
442
443gb_Library_PLAINLIBS_NONE += \
444	advapi32 \
445	gdi32 \
446	gdiplus \
447	gnu_getopt \
448	imm32\
449	kernel32 \
450	msimg32 \
451	msvcrt \
452	mpr \
453	oldnames \
454	ole32 \
455	oleaut32 \
456	shell32 \
457	user32 \
458	uuid \
459	uwinapi \
460	winspool \
461	z \
462	cppunit
463
464gb_Library_LAYER := \
465	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
466	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
467	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
468	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
469	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
470	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
471	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
472	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
473	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
474	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
475
476gb_Library_FILENAMES :=\
477	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
478
479gb_Library_DLLEXT := .dll
480gb_Library_MAJORVER := 3
481gb_Library_RTEXT := MSC$(gb_Library_DLLEXT)
482ifeq ($(gb_PRODUCT),$(true))
483gb_Library_STLEXT := port_vc7145$(gb_Library_DLLEXT)
484else
485gb_Library_STLEXT := port_vc7145_stldebug$(gb_Library_DLLEXT)
486endif
487gb_Library_OOOEXT := $(gb_Library_DLLEXT)
488gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
489gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
490gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
491
492gb_Library_DLLFILENAMES :=\
493	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
494	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
495	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
496	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
497	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
498	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
499	$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(lib)$(gb_Library_STLEXT)) \
500	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
501	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
502	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
503
504define gb_Library_Library_platform
505$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
506
507$(call gb_LinkTarget_set_auxtargets,$(2),\
508	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
509	$(3).manifest \
510	$(call gb_LinkTarget_get_pdbfile,$(2)) \
511	$(patsubst %.dll,%.pdb,$(3)) \
512	$(patsubst %.dll,%.ilk,$(3)) \
513)
514
515$(call gb_Library_get_target,$(1)) \
516$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
517
518ifneq ($(ENABLE_CRASHDUMP),)
519$(call gb_Library_get_target,$(1)) \
520$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS +=  \
521		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))) \
522		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))) \
523
524$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))),$(patsubst %.dll,%.pdb,$(3)))
525$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))),$(patsubst %.dll,%.ilk,$(3)))
526endif
527
528$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3))
529
530$(call gb_LinkTarget_get_target,$(2)) \
531$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
532
533endef
534
535define gb_Library_add_default_nativeres
536$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
537$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
538$(call gb_WinResTarget_set_defs,$(1)/$(2),\
539        $$(DEFS) \
540		-DADDITIONAL_VERINFO1 \
541		-DADDITIONAL_VERINFO2 \
542		-DADDITIONAL_VERINFO3 \
543)
544$(call gb_Library_add_nativeres,$(1),$(2))
545$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
546
547endef
548
549define gb_Library_add_nativeres
550$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
551$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
552
553endef
554
555define gb_Library_get_dllname
556$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
557endef
558
559
560# StaticLibrary class
561
562gb_StaticLibrary_DEFS :=
563gb_StaticLibrary_TARGETTYPEFLAGS := -LIB
564gb_StaticLibrary_SYSPRE :=
565gb_StaticLibrary_PLAINEXT := .lib
566gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
567
568gb_StaticLibrary_FILENAMES := \
569	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
570	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
571
572gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
573
574define gb_StaticLibrary_StaticLibrary_platform
575$(call gb_LinkTarget_get_target,$(2)) \
576$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
577
578$(call gb_LinkTarget_set_auxtargets,$(2),\
579	$(call gb_LinkTarget_get_pdbfile,$(2)) \
580)
581
582endef
583
584# Executable class
585
586gb_Executable_EXT := .exe
587gb_Executable_TARGETTYPEFLAGS := -RELEASE -BASE:0x1b000000 -OPT:NOREF -INCREMENTAL:NO -DEBUG -SAFESEH -NXCOMPAT -DYNAMICBASE
588gb_Executable_get_rpath :=
589
590define gb_Executable_Executable_platform
591$(call gb_LinkTarget_set_auxtargets,$(2),\
592	$(patsubst %.exe,%.pdb,$(call gb_LinkTarget_get_target,$(2))) \
593	$(call gb_LinkTarget_get_pdbfile,$(2)) \
594	$(call gb_LinkTarget_get_target,$(2)).manifest \
595)
596
597$(call gb_Executable_get_target,$(1)) \
598$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS := $(call gb_Executable_get_target,$(1)).manifest
599$(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)).manifest,$(call gb_LinkTarget_get_target,$(2)).manifest)
600
601$(call gb_LinkTarget_get_target,$(2)) \
602$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
603
604endef
605
606# CppunitTest class
607
608gb_CppunitTest_CPPTESTPRECOMMAND :=
609gb_CppunitTest_SYSPRE := itest_
610gb_CppunitTest_EXT := .lib
611gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
612gb_CppunitTest_get_libfilename = test_$(1).dll
613
614define gb_CppunitTest_CppunitTest_platform
615$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
616
617$(call gb_LinkTarget_set_auxtargets,$(2),\
618	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
619	$(3).manifest \
620	$(patsubst %.dll,%.pdb,$(3)) \
621	$(call gb_LinkTarget_get_pdbfile,$(2)) \
622	$(patsubst %.dll,%.ilk,$(3)) \
623)
624
625$(call gb_LinkTarget_get_target,$(2)) \
626$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
627
628endef
629
630# JunitTest class
631
632gb_defaultlangiso := en-US
633gb_smoketest_instset := $(SRCDIR)/instsetoo_native/$(INPATH)/OpenOffice/archive/install/$(gb_defaultlangiso)/OOo_*_install-arc_$(gb_defaultlangiso).zip
634
635ifeq ($(OOO_TEST_SOFFICE),)
636
637
638# Work around Windows problems with long pathnames (see issue 50885) by
639# installing into the temp directory instead of the module output tree (in which
640# case $(target).instpath contains the path to the temp installation,
641# which is removed after smoketest); can be removed once issue 50885 is fixed;
642# on other platforms, a single installation to solver is created in
643# smoketestoo_native.
644
645# for now, no dependency on $(shell ls $(gb_smoketest_instset))
646# because that doesn't work before the instset is built
647# and there is not much of a benefit anyway (gbuild not knowing about smoketest)
648define gb_JunitTest_JunitTest_platform_longpathname_hack
649$(call gb_JunitTest_get_target,$(1)) : $(call gb_JunitTest_get_target,$(1)).instpath
650$(call gb_JunitTest_get_target,$(1)) : CLEAN_CMD = $(call gb_Helper_abbreviate_dirs,rm -rf `cat $$@.instpath` $$@.instpath)
651
652$(call gb_JunitTest_get_target,$(1)).instpath :
653	INST_DIR=$$$$(cygpath -m `mktemp -d -t testinst.XXXXXX`) \
654	&& unzip -d "$$$${INST_DIR}"  $$(gb_smoketest_instset) \
655	&& mv "$$$${INST_DIR}"/OOo_*_install-arc_$$(gb_defaultlangiso) "$$$${INST_DIR}"/opt\
656	&& mkdir -p $$(dir $$@) \
657	&& echo "$$$${INST_DIR}" > $$@
658
659endef
660else # OOO_TEST_SOFFICE
661gb_JunitTest_JunitTest_platform_longpathname_hack =
662endif # OOO_TEST_SOFFICE
663
664define gb_JunitTest_JunitTest_platform
665$(call gb_JunitTest_JunitTest_platform_longpathname_hack,$(1))
666
667$(call gb_JunitTest_get_target,$(1)) : DEFS := \
668	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:`cat $(call gb_JunitTest_get_target,$(1)).instpath`/opt/OpenOffice.org 3/program/soffice.exe}" \
669    -Dorg.openoffice.test.arg.env=PATH \
670    -Dorg.openoffice.test.arg.user=file:///$(call gb_JunitTest_get_userdir,$(1)) \
671
672endef
673
674
675# SdiTarget class
676
677gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
678
679# SrsPartMergeTarget
680
681gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
682
683# SrsPartTarget class
684
685gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
686gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
687
688ifeq ($(gb_FULLDEPS),$(true))
689define gb_SrsPartTarget__command_dep
690$(call gb_Helper_abbreviate_dirs_native,\
691	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
692		$(INCLUDE) \
693		$(DEFS) \
694		$(2) \
695		-f - \
696	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
697		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
698		-v OUTDIR=$(OUTDIR)/ \
699		-v WORKDIR=$(WORKDIR)/ \
700		-v SRCDIR=$(SRCDIR)/ \
701		-v REPODIR=$(REPODIR)/ \
702	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
703endef
704else
705gb_SrsPartTarget__command_dep =
706endif
707
708# WinResTarget class
709
710gb_WinResTarget_POSTFIX :=.res
711
712define gb_WinResTarget__command
713$(call gb_Output_announce,$(2),$(true),RES,3)
714$(call gb_Helper_abbreviate_dirs_native,\
715	mkdir -p $(dir $(1)) && \
716	$(gb_RC) \
717		$(DEFS) $(FLAGS) \
718		-I$(dir $(3)) \
719		$(INCLUDE) \
720		-Fo$(1) \
721        $(RCFILE) )
722endef
723
724$(eval $(call gb_Helper_make_dep_targets,\
725	WinResTarget \
726))
727
728ifeq ($(gb_FULLDEPS),$(true))
729define gb_WinResTarget__command_dep
730$(call gb_Helper_abbreviate_dirs_native,\
731	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
732		$(INCLUDE) \
733		$(DEFS) \
734		$(2) \
735		-f - \
736	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
737		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
738		-v OUTDIR=$(OUTDIR)/ \
739		-v WORKDIR=$(WORKDIR)/ \
740		-v SRCDIR=$(SRCDIR)/ \
741		-v REPODIR=$(REPODIR)/ \
742	> $(call gb_WinResTarget_get_dep_target,$(1)))
743endef
744else
745gb_WinResTarget__command_dep =
746endif
747
748# ComponentTarget
749
750gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
751gb_Library_COMPONENTPREFIXES := \
752    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
753    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
754
755# vim: set noet sw=4 ts=4:
756