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