xref: /aoo42x/main/solenv/gbuild/platform/windows.mk (revision bc01e889)
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_AS := ml
32gb_CC := cl
33gb_CXX := cl
34gb_LINK := link
35gb_MT := mt
36gb_AWK := awk
37gb_CLASSPATHSEP := ;
38gb_RC := rc
39
40# use CC/CXX if they are nondefaults
41ifneq ($(origin AS),default)
42gb_AS := $(AS)
43endif
44ifneq ($(origin CC),default)
45gb_CC := $(CC)
46gb_GCCP := $(CC)
47endif
48ifneq ($(origin CXX),default)
49gb_CXX := $(CXX)
50endif
51
52gb_OSDEFS := \
53	-DWINVER=0x0500 \
54	-D_WIN32_IE=0x0500 \
55	-DNT351 \
56	-DWIN32 \
57	-DWNT \
58
59gb_COMPILERDEFS := \
60	-DMSC \
61	-D_CRT_NON_CONFORMING_SWPRINTFS \
62	-D_CRT_NONSTDC_NO_DEPRECATE \
63	-D_CRT_SECURE_NO_DEPRECATE \
64	-D_MT \
65	-D_DLL \
66	-DCPPU_ENV=$(COMNAME) \
67	-DFULL_DESK \
68	-DM1500 \
69
70gb_CPUDEFS := -D$(ALIGN) -D$(CPUNAME)
71ifeq ($(CPUNAME),INTEL)
72gb_CPUDEFS += -D_X86_=1
73endif
74ifeq ($(CPUNAME),X86_64)
75gb_CPUDEFS += -D_AMD64_=1
76endif
77
78ifeq ($(CPUNAME),INTEL)
79gb_COMPILERDEFS += -DBOOST_MEM_FN_ENABLE_CDECL
80endif
81
82gb_RCDEFS := \
83     -DWINVER=0x0400 \
84	 -DWIN32 \
85
86gb_RCFLAGS := \
87     -V
88
89gb_CFLAGS := \
90	-Gd \
91	-GR \
92	-Gs \
93	-GS \
94	-nologo \
95	-Wall \
96	-wd4005 \
97	-wd4061 \
98	-wd4127 \
99	-wd4180 \
100	-wd4189 \
101	-wd4191 \
102	-wd4217 \
103	-wd4250 \
104	-wd4251 \
105	-wd4255 \
106	-wd4275 \
107	-wd4290 \
108	-wd4294 \
109	-wd4350 \
110	-wd4355 \
111	-wd4365 \
112	-wd4503 \
113	-wd4505 \
114	-wd4511 \
115	-wd4512 \
116	-wd4514 \
117	-wd4611 \
118	-wd4619 \
119	-wd4625 \
120	-wd4626 \
121	-wd4640 \
122	-wd4668 \
123	-wd4675 \
124	-wd4692 \
125	-wd4710 \
126	-wd4711 \
127	-wd4738 \
128	-wd4786 \
129	-wd4800 \
130	-wd4820 \
131	-wd4826 \
132	-Zc:wchar_t- \
133	-Zm500 \
134
135gb_CXXFLAGS := \
136	-Gd \
137	-GR \
138	-Gs \
139	-GS \
140	-Gy \
141	-nologo \
142	-Wall \
143	-wd4005 \
144	-wd4061 \
145	-wd4127 \
146	-wd4180 \
147	-wd4189 \
148	-wd4191 \
149	-wd4217 \
150	-wd4250 \
151	-wd4251 \
152	-wd4275 \
153	-wd4290 \
154	-wd4294 \
155	-wd4350 \
156	-wd4355 \
157	-wd4365 \
158	-wd4503 \
159	-wd4505 \
160	-wd4511 \
161	-wd4512 \
162	-wd4514 \
163	-wd4611 \
164	-wd4619 \
165	-wd4625 \
166	-wd4626 \
167	-wd4640 \
168	-wd4668 \
169	-wd4675 \
170	-wd4692 \
171	-wd4710 \
172	-wd4711 \
173	-wd4738 \
174	-wd4786 \
175	-wd4800 \
176	-wd4820 \
177	-wd4826 \
178	-Zc:wchar_t- \
179	-Zm500 \
180
181gb_STDLIBS := \
182    uwinapi \
183    kernel32 \
184    msvcrt \
185    oldnames \
186
187ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
188gb_CFLAGS_WERROR := -WX
189gb_CXXFLAGS_WERROR := -WX
190endif
191
192gb_LinkTarget_EXCEPTIONFLAGS := \
193	-DEXCEPTIONS_ON \
194	-EHa \
195
196gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
197
198
199gb_LinkTarget_NOEXCEPTIONFLAGS := \
200	-DEXCEPTIONS_OFF \
201
202gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS := $(gb_LinkTarget_NOEXCEPTIONFLAGS)
203
204ifeq ($(CPUNAME),INTEL)
205gb_LinkTarget_LDFLAGS := \
206	-MACHINE:IX86 \
207	-NODEFAULTLIB \
208	$(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
209
210endif
211ifeq ($(CPUNAME),X86_64)
212gb_LinkTarget_LDFLAGS := \
213	-MACHINE:X64 \
214	-NODEFAULTLIB \
215	$(patsubst %,-LIBPATH:%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
216
217endif
218
219gb_DEBUG_CFLAGS := -Zi
220
221ifeq ($(gb_DEBUGGING),TRUE)
222gb_LinkTarget_LDFLAGS += -DEBUG
223endif
224
225# this does not use CFLAGS so it is not overridable
226ifneq ($(ENABLE_CRASHDUMP),)
227gb_CFLAGS+=-Zi
228gb_CXXFLAGS+=-Zi
229endif
230
231ifeq ($(gb_DEBUGLEVEL),2)
232gb_COMPILEROPTFLAGS :=
233else
234gb_COMPILEROPTFLAGS := -Ob1 -Oxs -Oy-
235endif
236
237gb_COMPILERNOOPTFLAGS := -Od
238
239
240# Helper class
241gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
242gb_Helper_WORKDIR_NATIVE := $(shell cygpath -m $(WORKDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
243gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
244gb_Helper_REPODIR_NATIVE := $(shell cygpath -m $(REPODIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
245
246define gb_Helper_abbreviate_dirs_native
247R=$(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))) && \
248$(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)))))))))
249endef
250
251# convert parametters filesystem root to native notation
252# does some real work only on windows, make sure not to
253# break the dummy implementations on unx*
254define gb_Helper_convert_native
255$(patsubst -I$(OUTDIR)%,-I$(gb_Helper_OUTDIR_NATIVE)%, \
256$(patsubst $(OUTDIR)%,$(gb_Helper_OUTDIR_NATIVE)%, \
257$(patsubst $(WORKDIR)%,$(gb_Helper_WORKDIR_NATIVE)%, \
258$(patsubst $(SRCDIR)%,$(gb_Helper_SRCDIR_NATIVE)%, \
259$(1)))))
260endef
261
262# convert parametters filesystem root to native notation
263# does some real work only on windows, make sure not to
264# break the dummy implementations on unx*
265define gb_Helper_convert_native
266$(patsubst -I$(OUTDIR)%,-I$(gb_Helper_OUTDIR_NATIVE)%, \
267$(patsubst $(OUTDIR)%,$(gb_Helper_OUTDIR_NATIVE)%, \
268$(patsubst $(WORKDIR)%,$(gb_Helper_WORKDIR_NATIVE)%, \
269$(patsubst $(SRCDIR)%,$(gb_Helper_SRCDIR_NATIVE)%, \
270$(1)))))
271endef
272
273
274# AsmObject class
275
276gb_AsmObject_EXT := .asm
277
278define gb_AsmObject__command
279$(call gb_Output_announce,$(2),$(true),ASM,3)
280$(call gb_Helper_abbreviate_dirs_native,\
281	mkdir -p $(dir $(1)) && \
282	unset INCLUDE && \
283	$(gb_AS) \
284		$(DEFS) \
285		-safeseh \
286		-Cp \
287		-coff \
288		-Fo$(1) \
289		-c $(3))
290endef
291
292# CObject class
293
294ifeq ($(gb_FULLDEPS),$(true))
295define gb_Object__command_deponcompile
296$(call gb_Helper_abbreviate_dirs_native,\
297	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
298		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
299		-I$(dir $(3)) \
300		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME)%,$(6)) \
301		$(3) \
302		-f - \
303	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
304		-v OBJECTFILE=$(1) \
305		-v OUTDIR=$(OUTDIR)/ \
306		-v WORKDIR=$(WORKDIR)/ \
307		-v SRCDIR=$(SRCDIR)/ \
308		-v REPODIR=$(REPODIR)/ \
309	> $(2))
310endef
311else
312gb_Object__command_deponcompile =
313endif
314
315define gb_CObject__command
316$(call gb_Output_announce,$(2),$(true),C  ,3)
317$(call gb_Helper_abbreviate_dirs_native,\
318	mkdir -p $(dir $(1)) $(dir $(4)) && \
319	unset INCLUDE && \
320	$(gb_CC) \
321		$(DEFS) \
322		$(T_CFLAGS) \
323		-Fd$(PDBFILE) \
324		$(CFLAGS) \
325        $(PCHFLAGS) \
326		-I$(dir $(3)) \
327		$(INCLUDE) \
328		-c $(3) \
329		-Fo$(1))
330$(call gb_Object__command_deponcompile,$(1),$(4),$(3),$(DEFS),$(T_CFLAGS),$(INCLUDE))
331endef
332
333
334# CxxObject class
335
336define gb_CxxObject__command
337$(call gb_Output_announce,$(2),$(true),CXX,3)
338$(call gb_Helper_abbreviate_dirs_native,\
339	mkdir -p $(dir $(1)) $(dir $(4)) && \
340	unset INCLUDE && \
341	$(gb_CXX) \
342		$(DEFS) \
343		$(T_CXXFLAGS) \
344		-Fd$(PDBFILE) \
345		$(CXXFLAGS) \
346        $(PCHFLAGS) \
347		-I$(dir $(3)) \
348		$(INCLUDE_STL) $(INCLUDE) \
349		-c $(3) \
350		-Fo$(1))
351$(call gb_Object__command_deponcompile,$(1),$(4),$(3),$(DEFS),$(T_CXXFLAGS),$(INCLUDE))
352endef
353
354
355# PrecompiledHeader class
356
357gb_PrecompiledHeader_get_enableflags = -DPRECOMPILED_HEADERS -Yu$(1).hxx \
358									   -Fp$(call gb_PrecompiledHeader_get_target,$(1))
359
360ifeq ($(gb_FULLDEPS),$(true))
361define gb_PrecompiledHeader__command_deponcompile
362$(call gb_Helper_abbreviate_dirs_native,\
363	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
364		$(4) $(5) \
365		-I$(dir $(3)) \
366		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME)%,$(6)) \
367		$(3) \
368		-f - \
369	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
370		-v OBJECTFILE=$(1) \
371		-v OUTDIR=$(OUTDIR)/ \
372		-v WORKDIR=$(WORKDIR)/ \
373		-v SRCDIR=$(SRCDIR)/ \
374		-v REPODIR=$(REPODIR)/ \
375	> $(call gb_PrecompiledHeader_get_dep_target,$(2)))
376endef
377else
378gb_PrecompiledHeader__command_deponcompile =
379endif
380
381
382define gb_PrecompiledHeader__command
383$(call gb_Output_announce,$(2),$(true),PCH,1)
384$(call gb_Helper_abbreviate_dirs_native,\
385	mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
386	unset INCLUDE && \
387	$(gb_CXX) \
388		$(4) $(5) -Fd$(PDBFILE) \
389		-I$(dir $(3)) \
390		$(6) \
391		-c $(3) \
392		-DPRECOMPILED_HEADERS \
393		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
394$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
395endef
396
397# NoexPrecompiledHeader class
398
399gb_NoexPrecompiledHeader_get_enableflags = -Yu$(1).hxx \
400										   -Fp$(call gb_NoexPrecompiledHeader_get_target,$(1))
401
402ifeq ($(gb_FULLDEPS),$(true))
403define gb_NoexPrecompiledHeader__command_deponcompile
404$(call gb_Helper_abbreviate_dirs_native,\
405	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
406		$(4) $(5) \
407		-I$(dir $(3)) \
408		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME)%,$(6)) \
409		$(3) \
410		-f - \
411	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
412		-v OBJECTFILE=$(1) \
413		-v OUTDIR=$(OUTDIR)/ \
414		-v WORKDIR=$(WORKDIR)/ \
415		-v SRCDIR=$(SRCDIR)/ \
416		-v REPODIR=$(REPODIR)/ \
417	> $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
418endef
419else
420gb_NoexPrecompiledHeader__command_deponcompile =
421endif
422
423
424define gb_NoexPrecompiledHeader__command
425$(call gb_Output_announce,$(2),$(true),PCH,1)
426$(call gb_Helper_abbreviate_dirs_native,\
427	mkdir -p $(dir $(1)) $(dir $(call gb_NoexPrecompiledHeader_get_dep_target,$(2))) && \
428	unset INCLUDE && \
429	$(gb_CXX) \
430		$(4) $(5) -Fd$(PDBFILE) \
431		-I$(dir $(3)) \
432		$(6) \
433		-c $(3) \
434		-DPRECOMPILED_HEADERS \
435		-Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
436$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
437endef
438
439# LinkTarget class
440
441gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR)
442gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
443
444gb_LinkTarget_INCLUDE :=\
445	$(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) \
446	$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
447
448gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
449
450gb_LinkTarget_get_pdbfile = $(call gb_LinkTarget_get_target,)pdb/$(1).pdb
451
452# Runs the linker command to generate the binary.
453# If a .manifest file is generated, embeds it into the binary.
454define gb_LinkTarget__command
455$(call gb_Output_announce,$(2),$(true),LNK,4)
456$(call gb_Helper_abbreviate_dirs_native,\
457	mkdir -p $(dir $(1)) && \
458	rm -f $(1) && \
459	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100, \
460	    $(call gb_Helper_convert_native,\
461		$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
462		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
463		$(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
464		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
465		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
466		$(PCHOBJS) $(NATIVERES))) && \
467	$(gb_LINK) \
468		$(if $(filter Library,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
469		$(if $(filter StaticLibrary,$(TARGETTYPE)),$(gb_StaticLibrary_TARGETTYPEFLAGS)) \
470		$(if $(filter GoogleTest Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
471		$(if $(filter YES,$(gb_Executable_TARGETGUI)), -SUBSYSTEM:WINDOWS, -SUBSYSTEM:CONSOLE) \
472		$(T_LDFLAGS) \
473		@$${RESPONSEFILE} \
474		$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))) \
475		$(patsubst %,%.lib,$(EXTERNAL_LIBS)) \
476		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \
477		$(LIBS) \
478		$(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); \
479	RC=$$?; \
480	if [ -f $(if $(DLLTARGET),$(DLLTARGET),$(1)).manifest ]; then \
481		$(gb_MT) \
482			-manifest $(if $(DLLTARGET),$(DLLTARGET),$(1)).manifest \
483			-outputresource:$(if $(DLLTARGET),$(DLLTARGET),$(1)); \
484	fi; \
485	rm $${RESPONSEFILE} \
486	$(if $(DLLTARGET),; if [ ! -f $(DLLTARGET) ]; then rm -f $(1) && false; fi) ; exit $$RC)
487endef
488
489
490# Library class
491
492gb_Library_DEFS := -D_DLL_
493ifeq ($(CPUNAME),INTEL)
494gb_Library_TARGETTYPEFLAGS := -DLL -OPT:NOREF -SAFESEH -NXCOMPAT -DYNAMICBASE
495endif
496ifeq ($(CPUNAME),X86_64)
497gb_Library_TARGETTYPEFLAGS := -DLL -OPT:NOREF -NXCOMPAT -DYNAMICBASE
498endif
499gb_Library_get_rpath :=
500
501gb_Library_SYSPRE := i
502gb_Library_PLAINEXT := .lib
503
504gb_Library_PLAINLIBS_NONE += \
505	advapi32 \
506	comdlg32 \
507	d3d9 \
508	d3dx \
509	ddraw \
510	gdi32 \
511	gdiplus \
512	glu32 \
513	gnu_getopt \
514	imm32\
515	kernel32 \
516	msimg32 \
517	msvcrt \
518	mpr \
519	oldnames \
520	ole32 \
521	oleaut32 \
522	opengl32 \
523	shell32 \
524	shlwapi \
525	strmiids \
526	user32 \
527	uuid \
528	uwinapi \
529	winmm \
530	winspool \
531	ws2_32 \
532	wsock32
533
534gb_Library_LAYER := \
535	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
536	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
537	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
538	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
539	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
540	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
541	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
542	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
543	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
544	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
545
546gb_Library_FILENAMES :=\
547	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
548
549gb_Library_DLLEXT := .dll
550gb_Library_MAJORVER := 3
551gb_Library_RTEXT := MSC$(gb_Library_DLLEXT)
552
553ifeq ($(USE_SYSTEM_STL),YES)
554ifeq ($(gb_PRODUCT),$(true))
555gb_Library_STLEXT := msvcprt.lib
556else
557gb_Library_STLEXT := msvcprt.lib
558endif
559else
560ifeq ($(gb_PRODUCT),$(true))
561gb_Library_STLEXT := port_vc7145$(gb_Library_DLLEXT)
562else
563gb_Library_STLEXT := port_vc7145_stldebug$(gb_Library_DLLEXT)
564endif
565endif
566
567gb_Library_OOOEXT := $(gb_Library_DLLEXT)
568gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
569gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
570gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
571
572gb_Library_DLLFILENAMES :=\
573	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
574	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
575	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
576	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
577	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
578	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
579	$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(lib)$(gb_Library_STLEXT)) \
580	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
581	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
582	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
583
584define gb_Library_Library_platform
585$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
586
587$(call gb_LinkTarget_set_auxtargets,$(2),\
588	$(patsubst %.lib,%.exp,$(call gb_LinkTarget_get_target,$(2))) \
589	$(3).manifest \
590	$(call gb_LinkTarget_get_pdbfile,$(2)) \
591	$(patsubst %.dll,%.pdb,$(3)) \
592	$(patsubst %.dll,%.ilk,$(3)) \
593)
594
595$(call gb_Library_get_target,$(1)) \
596$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
597
598ifneq ($(ENABLE_CRASHDUMP),)
599$(call gb_Library_get_target,$(1)) \
600$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS +=  \
601		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))) \
602		$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))) \
603
604$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.pdb,$(3))),$(patsubst %.dll,%.pdb,$(3)),$(1))
605$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(patsubst %.dll,%.ilk,$(3))),$(patsubst %.dll,%.ilk,$(3)),$(1))
606endif
607
608$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3),$(1))
609
610$(call gb_LinkTarget_get_target,$(2)) \
611$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
612ifeq ($(gb_FULLDEPS),$(true))
613$(call gb_LinkTarget_get_dep_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
614endif
615endef
616
617define gb_Library_add_default_nativeres
618$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
619$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
620$(call gb_WinResTarget_set_defs,$(1)/$(2),\
621        $$(DEFS) \
622		-DADDITIONAL_VERINFO1 \
623		-DADDITIONAL_VERINFO2 \
624		-DADDITIONAL_VERINFO3 \
625)
626$(call gb_Library_add_nativeres,$(1),$(2))
627$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
628
629endef
630
631define gb_Library_add_nativeres
632$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
633$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
634
635endef
636
637define gb_Library_get_dllname
638$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
639endef
640
641
642# StaticLibrary class
643
644gb_StaticLibrary_DEFS :=
645gb_StaticLibrary_TARGETTYPEFLAGS := -LIB
646gb_StaticLibrary_SYSPRE :=
647gb_StaticLibrary_PLAINEXT := .lib
648gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
649
650gb_StaticLibrary_FILENAMES := \
651	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
652	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
653
654gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
655
656define gb_StaticLibrary_StaticLibrary_platform
657$(call gb_LinkTarget_get_target,$(2)) \
658$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
659
660$(call gb_LinkTarget_set_auxtargets,$(2),\
661	$(call gb_LinkTarget_get_pdbfile,$(2)) \
662)
663
664endef
665
666# Executable class
667
668gb_Executable_EXT := .exe
669ifeq ($(CPUNAME),INTEL)
670gb_Executable_TARGETTYPEFLAGS := -RELEASE -BASE:0x1b000000 -OPT:NOREF -INCREMENTAL:NO -DEBUG -SAFESEH -NXCOMPAT -DYNAMICBASE
671endif
672ifeq ($(CPUNAME),X86_64)
673gb_Executable_TARGETTYPEFLAGS := -RELEASE -BASE:0x1b000000 -OPT:NOREF -INCREMENTAL:NO -DEBUG -NXCOMPAT -DYNAMICBASE
674endif
675gb_Executable_get_rpath :=
676gb_Executable_TARGETGUI :=
677
678gb_InBuild_Library_Path := $(OUTDIR)/bin
679gb_Augment_Library_Path := PATH="$${PATH}:$(gb_InBuild_Library_Path)"
680
681define gb_Executable_Executable_platform
682$(call gb_LinkTarget_set_auxtargets,$(2),\
683	$(patsubst %.exe,%.pdb,$(call gb_LinkTarget_get_target,$(2))) \
684	$(call gb_LinkTarget_get_pdbfile,$(2)) \
685	$(call gb_LinkTarget_get_target,$(2)).manifest \
686)
687
688$(call gb_Executable_get_target,$(1)) \
689$(call gb_Executable_get_clean_target,$(1)) : AUXTARGETS := $(call gb_Executable_get_target,$(1)).manifest
690
691$(call gb_LinkTarget_get_target,$(2)) \
692$(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile,$(2))
693
694endef
695
696# GoogleTest class
697
698gb_GoogleTest_GTESTPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
699gb_GoogleTest_get_filename = $(1)$(gb_Executable_EXT)
700
701define gb_GoogleTest_GoogleTest_platform
702endef
703
704# JunitTest class
705
706define gb_JunitTest_JunitTest_platform
707$(call gb_JunitTest_get_target,$(1)) : DEFS := \
708	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(SRCDIR)/instsetoo_native/$(INPATH)/Apache_OpenOffice/installed/install/en-US/OpenOffice 4/program/soffice.exe}" \
709    -Dorg.openoffice.test.arg.env=PATH \
710    -Dorg.openoffice.test.arg.user=file:///$(call gb_JunitTest_get_userdir,$(1)) \
711
712endef
713
714
715# Ant class
716
717define gb_Ant_add_dependencies
718__ant_out:=$(shell $(gb_Ant_ANTCOMMAND) -Ddependencies.outfile=`cygpath -m $(WORKDIR)/Ant/$(1)/deps` -f `cygpath -m $(2)` dependencies)
719$$(eval $(foreach dep,$(shell cat $(WORKDIR)/Ant/$(1)/deps),$$(call gb_Ant_add_dependency,$(call gb_Ant_get_target,$(1)),$(shell cygpath -u $(dep)))))
720
721endef
722
723
724
725# SdiTarget class
726
727gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
728
729# SrsPartMergeTarget
730
731gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
732
733# SrsPartTarget class
734
735gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
736gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
737
738ifeq ($(gb_FULLDEPS),$(true))
739define gb_SrsPartTarget__command_dep
740$(call gb_Helper_abbreviate_dirs_native,\
741	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
742		$(INCLUDE) \
743		$(DEFS) \
744		$(2) \
745		-f - \
746	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
747		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
748		-v OUTDIR=$(OUTDIR)/ \
749		-v WORKDIR=$(WORKDIR)/ \
750		-v SRCDIR=$(SRCDIR)/ \
751		-v REPODIR=$(REPODIR)/ \
752	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
753endef
754else
755gb_SrsPartTarget__command_dep =
756endif
757
758# WinResTarget class
759
760gb_WinResTarget_POSTFIX :=.res
761
762define gb_WinResTarget__command
763$(call gb_Output_announce,$(2),$(true),RES,3)
764$(call gb_Helper_abbreviate_dirs_native,\
765	mkdir -p $(dir $(1)) && \
766	$(gb_RC) \
767		$(DEFS) $(FLAGS) \
768		-I$(dir $(3)) \
769		$(INCLUDE) \
770		-Fo$(1) \
771        $(RCFILE) )
772endef
773
774$(eval $(call gb_Helper_make_dep_targets,\
775	WinResTarget \
776))
777
778ifeq ($(gb_FULLDEPS),$(true))
779define gb_WinResTarget__command_dep
780$(call gb_Helper_abbreviate_dirs_native,\
781	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
782		$(INCLUDE) \
783		$(DEFS) \
784		$(2) \
785		-f - \
786	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
787		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
788		-v OUTDIR=$(OUTDIR)/ \
789		-v WORKDIR=$(WORKDIR)/ \
790		-v SRCDIR=$(SRCDIR)/ \
791		-v REPODIR=$(REPODIR)/ \
792	> $(call gb_WinResTarget_get_dep_target,$(1)))
793endef
794else
795gb_WinResTarget__command_dep =
796endif
797
798# ComponentTarget
799
800gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
801gb_Library_COMPONENTPREFIXES := \
802    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
803    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
804    NONE:vnd.sun.star.expand:\dOOO_INBUILD_SHAREDLIB_DIR/ \
805
806# UnoApiTarget
807
808gb_UnoApiTarget_IDLCTARGET := $(OUTDIR)/bin/idlc.exe
809gb_UnoApiTarget_IDLCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_IDLCTARGET)
810gb_UnoApiTarget_REGMERGETARGET := $(OUTDIR)/bin/regmerge.exe
811gb_UnoApiTarget_REGMERGECOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGMERGETARGET)
812gb_UnoApiTarget_REGCOMPARETARGET := $(OUTDIR)/bin/regcompare.exe
813gb_UnoApiTarget_REGCOMPARECOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGCOMPARETARGET)
814gb_UnoApiTarget_CPPUMAKERTARGET := $(OUTDIR)/bin/cppumaker.exe
815gb_UnoApiTarget_CPPUMAKERCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_CPPUMAKERTARGET)
816gb_UnoApiTarget_REGVIEWTARGET := $(OUTDIR)/bin/regview.exe
817gb_UnoApiTarget_REGVIEWCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGVIEWTARGET)
818
819# vim: set noet sw=4 ts=4:
820