xref: /trunk/main/solenv/gbuild/platform/winmingw.mk (revision 6bf52fda)
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 := GCC
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 := $(CC)
32gb_CXX := $(CXX)
33gb_LINK := $(shell $(CC) -print-prog-name=ld)
34gb_AR := $(shell $(CC) -print-prog-name=ar)
35gb_AWK := awk
36gb_RC := rc
37ifeq ($(USE_MINGW),cygwin)
38gb_MINGWLIBDIR := $(COMPATH)/lib/mingw
39else
40ifeq ($(USE_MINGW),cygwin-w64-mingw32)
41gb_MINGWLIBDIR := $(COMPATH)/usr/i686-w64-mingw32/sys-root/mingw/lib
42else
43gb_MINGWLIBDIR := $(COMPATH)/lib
44endif
45endif
46ifeq ($(MINGW_SHARED_GXXLIB),YES)
47gb_MINGW_LIBSTDCPP := $(subst -l,,$(MINGW_SHARED_LIBSTDCPP))
48else
49gb_MINGW_LIBSTDCPP := \
50		stdc++ \
51		moldname
52endif
53ifeq ($(MINGW_SHARED_GCCLIB),YES)
54gb_MINGW_LIBGCC := \
55		gcc_s \
56		gcc
57else
58ifeq ($(MINGW_GCCLIB_EH),YES)
59gb_MINGW_LIBGCC := \
60		gcc \
61		gcc_eh
62else
63gb_MINGW_LIBGCC := gcc
64endif
65endif
66
67gb_OSDEFS := \
68	-DWINVER=0x0500 \
69	-D_WIN32_IE=0x0500 \
70	-D_WIN32_WINNT=0x0600 \
71	-DNT351 \
72	-DWIN32 \
73	-DWNT \
74
75gb_COMPILERDEFS := \
76	-DGCC \
77	-D$(CVER) \
78	-DCVER=$(CVER) \
79	-DGLIBC=2 \
80	-DCPPU_ENV=$(COMNAME) \
81	-D_MT \
82	-D_NATIVE_WCHAR_T_DEFINED \
83	-D_MSC_EXTENSIONS \
84	-D_FORCENAMELESSUNION \
85
86ifeq ($(USE_MINGW),cygwin-w64-mingw32)
87gb_COMPILERDEFS +=-D_declspec=__declspec
88endif
89
90gb_CPUDEFS := -D$(ALIGN) -D$(CPUNAME)
91gb_CPUDEFS += \
92	-D_M_IX86 \
93
94gb_RCDEFS := \
95     -DWIN32 \
96     -D__GNUC__ \
97
98gb_RCFLAGS := \
99     -V
100
101gb_CFLAGS := \
102	-Wall \
103	-Wendif-labels \
104	-Wextra \
105	-fmessage-length=0 \
106	-fno-strict-aliasing \
107	-pipe \
108	-nostdinc \
109
110gb_CXXFLAGS := \
111	-Wall \
112	-Wendif-labels \
113	-Wextra \
114	-Wno-ctor-dtor-privacy \
115	-Wno-non-virtual-dtor \
116	-Wreturn-type \
117	-Wshadow \
118	-Wuninitialized \
119	-fmessage-length=0 \
120	-fno-strict-aliasing \
121	-fno-use-cxa-atexit \
122	-pipe \
123	-nostdinc \
124
125ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
126gb_CFLAGS_WERROR := -Werror
127gb_CXXFLAGS_WERROR := -Werror
128endif
129
130ifneq ($(SYSBASE),)
131gb_CXXFLAGS += --sysroot=$(SYSBASE)
132gb_CFLAGS += --sysroot=$(SYSBASE)
133endif
134gb_LinkTarget_EXCEPTIONFLAGS := \
135	-DEXCEPTIONS_ON \
136	-fexceptions \
137	-fno-enforce-eh-specs \
138
139gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
140
141
142gb_LinkTarget_NOEXCEPTIONFLAGS := \
143	-DEXCEPTIONS_OFF \
144	-fno-exceptions \
145
146gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS := $(gb_LinkTarget_NOEXCEPTIONFLAGS)
147
148gb_LinkTarget_LDFLAGS := \
149	--export-all-symbols \
150	--kill-at \
151	--exclude-libs ALL \
152	--enable-stdcall-fixup \
153	--enable-runtime-pseudo-reloc-v2 \
154	-L$(gb_Library_DLLDIR) \
155	$(patsubst %,-L%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
156
157ifeq ($(MINGW_GCCLIB_EH),YES)
158gb_LinkTarget_LDFLAGS += -shared-libgcc
159endif
160
161ifeq ($(ENABLE_SYMBOLS),SMALL)
162gb_DEBUG_CFLAGS := -ggdb1 -finline-limit=0 -fno-inline -fno-default-inline
163else
164gb_DEBUG_CFLAGS := -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
165endif
166
167ifeq ($(gb_DEBUGLEVEL),2)
168gb_COMPILEROPTFLAGS := -O0
169else
170gb_COMPILEROPTFLAGS := -Os
171endif
172
173gb_COMPILERNOOPTFLAGS := -O0
174
175gb_STDLIBS := \
176	mingwthrd \
177	$(gb_MINGW_LIBSTDCPP) \
178	mingw32 \
179	$(gb_MINGW_LIBGCC) \
180	uwinapi \
181	moldname \
182	mingwex \
183    kernel32 \
184	msvcrt \
185
186
187# Helper class
188
189gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
190gb_Helper_WORKDIR_NATIVE := $(shell cygpath -m $(WORKDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
191gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
192gb_Helper_REPODIR_NATIVE := $(shell cygpath -m $(REPODIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }')
193
194define gb_Helper_abbreviate_dirs_native
195R=$(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))) && \
196$(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)))))))))
197endef
198
199# convert parametters filesystem root to native notation
200# does some real work only on windows, make sure not to
201# break the dummy implementations on unx*
202define gb_Helper_convert_native
203$(patsubst -I$(OUTDIR)%,-I$(gb_Helper_OUTDIR_NATIVE)%, \
204$(patsubst $(OUTDIR)%,$(gb_Helper_OUTDIR_NATIVE)%, \
205$(patsubst $(WORKDIR)%,$(gb_Helper_WORKDIR_NATIVE)%, \
206$(patsubst $(SRCDIR)%,$(gb_Helper_SRCDIR_NATIVE)%, \
207$(1)))))
208endef
209
210# convert parametters filesystem root to native notation
211# does some real work only on windows, make sure not to
212# break the dummy implementations on unx*
213define gb_Helper_convert_native
214$(patsubst -I$(OUTDIR)%,-I$(gb_Helper_OUTDIR_NATIVE)%, \
215$(patsubst $(OUTDIR)%,$(gb_Helper_OUTDIR_NATIVE)%, \
216$(patsubst $(WORKDIR)%,$(gb_Helper_WORKDIR_NATIVE)%, \
217$(patsubst $(SRCDIR)%,$(gb_Helper_SRCDIR_NATIVE)%, \
218$(1)))))
219endef
220
221# AsmObject class
222
223gb_AsmObject_EXT := .s
224
225define gb_AsmObject__command
226$(call gb_Output_announce,$(2),$(true),ASM,3)
227$(call gb_Helper_abbreviate_dirs,\
228	mkdir -p $(dir $(1)) && \
229	$(gb_CC) \
230		$(DEFS) \
231		$(T_CFLAGS) \
232		$(CFLAGS) \
233		-c $(3) \
234		-o $(1) \
235		-MT $(1) \
236		-I$(dir $(3)) \
237		$(INCLUDE))
238endef
239
240# CObject class
241
242ifeq ($(gb_FULLDEPS),$(true))
243define gb_Object__command_deponcompile
244$(call gb_Helper_abbreviate_dirs_native,\
245	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
246		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
247		-I$(dir $(3)) \
248		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
249		$(3) \
250		-f - \
251	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
252		-v OBJECTFILE=$(1) \
253		-v OUTDIR=$(OUTDIR)/ \
254		-v WORKDIR=$(WORKDIR)/ \
255		-v SRCDIR=$(SRCDIR)/ \
256		-v REPODIR=$(REPODIR)/ \
257	> $(2))
258endef
259else
260gb_Object__command_deponcompile =
261endif
262
263define gb_CObject__command
264$(call gb_Output_announce,$(2),$(true),C  ,3)
265$(call gb_Helper_abbreviate_dirs_native,\
266	mkdir -p $(dir $(1)) && \
267	$(gb_CC) \
268		$(DEFS) \
269		$(T_CFLAGS) \
270		-c $(3) \
271		-o $(1) \
272		-I$(dir $(3)) \
273		$(INCLUDE))
274$(call gb_Object__command_deponcompile,$(1),$(4),$(3),$(DEFS),$(T_CFLAGS),$(INCLUDE))
275endef
276
277
278
279# CxxObject class
280
281define gb_CxxObject__command
282$(call gb_Output_announce,$(2),$(true),CXX,3)
283$(call gb_Helper_abbreviate_dirs_native,\
284	mkdir -p $(dir $(1)) && \
285	$(gb_CXX) \
286		$(DEFS) \
287		$(T_CXXFLAGS) \
288		-c $(3) \
289		-o $(1) \
290		-I$(dir $(3)) \
291		$(INCLUDE_STL) $(INCLUDE))
292$(call gb_Object__command_deponcompile,$(1),$(4),$(3),$(DEFS),$(T_CXXFLAGS),$(INCLUDE_STL) $(INCLUDE))
293endef
294
295
296# PrecompiledHeader class
297
298gb_PrecompiledHeader_EXT := .gch
299
300gb_PrecompiledHeader_get_enableflags = -I$(WORKDIR)/PrecompiledHeader/$(gb_PrecompiledHeader_DEBUGDIR) \
301					-DPRECOMPILED_HEADERS \
302					-Winvalid-pch \
303
304ifeq ($(gb_FULLDEPS),$(true))
305define gb_PrecompiledHeader__command_deponcompile
306$(call gb_Helper_abbreviate_dirs_native,\
307	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
308		$(4) $(5) \
309		-I$(dir $(3)) \
310		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
311		$(3) \
312		-f - \
313	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
314		-v OBJECTFILE=$(1) \
315		-v OUTDIR=$(OUTDIR)/ \
316		-v WORKDIR=$(WORKDIR)/ \
317		-v SRCDIR=$(SRCDIR)/ \
318		-v REPODIR=$(REPODIR)/ \
319	> $(call gb_PrecompiledHeader_get_dep_target,$(2)))
320endef
321else
322gb_PrecompiledHeader__command_deponcompile =
323endif
324
325define gb_PrecompiledHeader__command
326$(call gb_Output_announce,$(2),$(true),PCH,1)
327$(call gb_Helper_abbreviate_dirs_native,\
328	mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
329	$(gb_CXX) \
330		-x c++-header \
331		$(4) $(5) \
332		-I$(dir $(3)) \
333		-DPRECOMPILED_HEADERS \
334		$(6) \
335		-c $(3) \
336		-o$(1))
337$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
338
339endef
340
341# NoexPrecompiledHeader class
342
343gb_NoexPrecompiledHeader_EXT := .gch
344
345gb_NoexPrecompiledHeader_get_enableflags = -I$(WORKDIR)/NoexPrecompiledHeader/$(gb_NoexPrecompiledHeader_DEBUGDIR) \
346					-Winvalid-pch \
347
348ifeq ($(gb_FULLDEPS),$(true))
349define gb_NoexPrecompiledHeader__command_deponcompile
350$(call gb_Helper_abbreviate_dirs_native,\
351	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
352		$(4) $(5) \
353		-I$(dir $(3)) \
354		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
355		$(3) \
356		-f - \
357	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
358		-v OBJECTFILE=$(1) \
359		-v OUTDIR=$(OUTDIR)/ \
360		-v WORKDIR=$(WORKDIR)/ \
361		-v SRCDIR=$(SRCDIR)/ \
362		-v REPODIR=$(REPODIR)/ \
363	> $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
364endef
365else
366gb_NoexPrecompiledHeader__command_deponcompile =
367endif
368
369define gb_NoexPrecompiledHeader__command
370$(call gb_Output_announce,$(2),$(true),PCH,1)
371$(call gb_Helper_abbreviate_dirs_native,\
372	mkdir -p $(dir $(1)) $(dir $(call gb_NoexPrecompiledHeader_get_dep_target,$(2))) && \
373	$(gb_CXX) \
374		-x c++-header \
375		$(4) $(5) \
376		-I$(dir $(3)) \
377		-DPRECOMPILED_HEADERS \
378		$(6) \
379		-c $(3) \
380		-o$(1))
381$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
382
383endef
384
385
386# LinkTarget class
387
388gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR)
389gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
390
391gb_LinkTarget_INCLUDE :=\
392	$(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) \
393	$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
394
395gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
396
397define gb_LinkTarget__command_dynamiclinkexecutable
398$(call gb_Output_announce,$(2),$(true),LNK,4)
399$(call gb_Helper_abbreviate_dirs_native,\
400	mkdir -p $(dir $(1)) && \
401	RESPONSEFILE=`$(gb_MKTEMP)` && \
402	echo "$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
403		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
404		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
405		$(NATIVERES) " > $${RESPONSEFILE} && \
406	$(gb_LINK) \
407		$(gb_Executable_TARGETTYPEFLAGS) \
408		$(if $(filter YES,$(gb_Executable_TARGETGUI)), --subsystem windows, --subsystem console) \
409		$(T_LDFLAGS) \
410		$(gb_MINGWLIBDIR)/crt2.o \
411		$(MINGW_CLIB_DIR)/crtbegin.o \
412		@$${RESPONSEFILE} \
413		--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
414		--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
415		--start-group $(patsubst %,-l%,$(EXTERNAL_LIBS)) --end-group \
416		$(LIBS) \
417		$(MINGW_CLIB_DIR)/crtend.o \
418		-Map $(basename $(1)).map \
419		-o $(1))
420endef
421
422define gb_LinkTarget__command_dynamiclinklibrary
423$(call gb_Helper_abbreviate_dirs_native,\
424	mkdir -p $(dir $(1)) && \
425	rm -f $(1) && \
426	RESPONSEFILE=`$(gb_MKTEMP)` && \
427	echo "\
428		$(foreach object,$(ASMXXOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
429		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
430		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
431		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
432		$(NATIVERES) " > $${RESPONSEFILE} && \
433	$(gb_LINK) \
434		$(gb_Library_TARGETTYPEFLAGS) \
435		$(T_LDFLAGS) \
436		--enable-auto-image-base \
437		-e _DllMainCRTStartup@12 \
438		$(gb_MINGWLIBDIR)/dllcrt2.o \
439		$(MINGW_CLIB_DIR)/crtbegin.o \
440		@$${RESPONSEFILE} \
441		--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
442		--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
443		$(LIBS) \
444		$(MINGW_CLIB_DIR)/crtend.o \
445		-Map $(basename $(DLLTARGET)).map \
446		-o $(DLLTARGET) && touch $(1))
447endef
448
449define gb_LinkTarget__command_staticlinklibrary
450$(call gb_Helper_abbreviate_dirs_native,\
451	mkdir -p $(dir $(1)) && \
452	RESPONSEFILE=`$(gb_MKTEMP)` && \
453	echo "$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
454		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
455		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) " > $${RESPONSEFILE} && \
456	$(gb_AR) -rsu\
457		$(1) \
458		@$${RESPONSEFILE})
459endef
460
461define gb_LinkTarget__command
462$(call gb_Output_announce,$(2),$(true),LNK,4)
463$(if $(filter GoogleTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclinkexecutable,$(1),$(2)))
464$(if $(filter Library,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclinklibrary,$(1),$(2)))
465$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlinklibrary,$(1)))
466endef
467
468
469# Library class
470
471gb_Library_DEFS := -D_DLL_
472gb_Library_TARGETTYPEFLAGS := -shared
473gb_Library_get_rpath :=
474
475gb_Library_SYSPRE := i
476gb_Library_PLAINEXT := .lib
477
478gb_Library_PLAINLIBS_NONE += \
479	mingwthrd \
480	mingw32 \
481	mingwex \
482	$(gb_MINGW_LIBSTDCPP) \
483	$(gb_MINGW_LIBGCC) \
484	advapi32 \
485	comdlg32 \
486	d3d9 \
487	d3dx \
488	ddraw \
489	gdi32 \
490	gdiplus \
491	glu32 \
492	gnu_getopt \
493	imm32\
494	kernel32 \
495	msimg32 \
496	msvcrt \
497	mpr \
498	moldname \
499	ole32 \
500	oleaut32 \
501	opengl32 \
502	shell32 \
503	shlwapi \
504	strmiids \
505	user32 \
506	uuid \
507	uwinapi \
508	winmm \
509	winspool \
510	ws2_32 \
511	wsock32
512
513gb_Library_LAYER := \
514	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
515	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
516	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
517	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
518	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
519	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
520	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
521	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
522	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
523	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
524
525gb_Library_FILENAMES :=\
526	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
527
528gb_Library_DLLEXT := .dll
529gb_Library_MAJORVER := 3
530gb_Library_RTEXT := gcc3$(gb_Library_DLLEXT)
531ifeq ($(gb_PRODUCT),$(true))
532gb_Library_STLEXT := port_gcc$(gb_Library_DLLEXT)
533else
534gb_Library_STLEXT := port_gcc_stldebug$(gb_Library_DLLEXT)
535endif
536gb_Library_OOOEXT := $(gb_Library_DLLEXT)
537gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
538gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
539gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
540
541gb_Library_DLLFILENAMES := \
542	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
543	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
544	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
545	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
546	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
547	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
548	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
549	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
550	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
551
552gb_Library_IARCSYSPRE := lib
553gb_Library_IARCEXT := .a
554
555gb_Library_ILIBEXT := .lib
556
557define gb_Library_Library_platform
558$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
559
560$(call gb_LinkTarget_set_auxtargets,$(2),\
561	$(patsubst %.dll,%.map,$(3)) \
562)
563
564$(call gb_Library_get_target,$(1)) \
565$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
566
567$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3),$(1))
568
569endef
570
571define gb_Library_add_default_nativeres
572$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
573$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
574$(call gb_WinResTarget_set_defs,$(1)/$(2),\
575        $$(DEFS) \
576		-DADDITIONAL_VERINFO1= \
577		-DADDITIONAL_VERINFO2= \
578		-DADDITIONAL_VERINFO3= \
579)
580$(call gb_Library_add_nativeres,$(1),$(2))
581$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
582
583endef
584
585define gb_Library_add_nativeres
586$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
587$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
588
589endef
590
591define gb_Library_get_dllname
592$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
593endef
594
595
596# StaticLibrary class
597
598gb_StaticLibrary_DEFS :=
599gb_StaticLibrary_SYSPRE := lib
600gb_StaticLibrary_PLAINEXT := .a
601gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
602
603gb_StaticLibrary_FILENAMES := \
604	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
605	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
606
607gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
608
609gb_StaticLibrary_StaticLibrary_platform =
610
611# Executable class
612
613gb_Executable_EXT := .exe
614gb_Executable_TARGETTYPEFLAGS :=
615gb_Executable_get_rpath :=
616gb_Executable_Executable_platform =
617gb_Executable_TARGETGUI :=
618
619# GoogleTest class
620
621gb_GoogleTest_GTESTPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
622gb_GoogleTest_get_filename = $(1)$(gb_Executable_EXT)
623
624define gb_GoogleTest_GoogleTest_platform
625endef
626
627# JunitTest class
628
629define gb_JunitTest_JunitTest_platform
630$(call gb_JunitTest_get_target,$(1)) : DEFS := \
631	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(SRCDIR)/instsetoo_native/$(INPATH)/Apache_OpenOffice/installed/install/en-US/OpenOffice 4/program/soffice.exe}" \
632    -Dorg.openoffice.test.arg.env=PATH \
633    -Dorg.openoffice.test.arg.user=file:///$(call gb_JunitTest_get_userdir,$(1)) \
634
635endef
636
637
638# SdiTarget class
639
640gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
641
642# SrsPartMergeTarget
643
644gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
645
646# SrsPartTarget class
647
648gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
649gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
650
651ifeq ($(gb_FULLDEPS),$(true))
652define gb_SrsPartTarget__command_dep
653$(call gb_Helper_abbreviate_dirs_native,\
654	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
655		$(INCLUDE) \
656		$(DEFS) \
657		$(2) \
658		-f - \
659	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
660		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
661		-v OUTDIR=$(OUTDIR)/ \
662		-v WORKDIR=$(WORKDIR)/ \
663		-v SRCDIR=$(SRCDIR)/ \
664		-v REPODIR=$(REPODIR)/ \
665	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
666endef
667else
668gb_SrsPartTarget__command_dep =
669endif
670
671# WinResTarget class
672
673gb_WinResTarget_POSTFIX :=_res.o
674
675define gb_WinResTarget__command
676$(call gb_Output_announce,$(2),$(true),RES,3)
677$(call gb_Helper_abbreviate_dirs_native,\
678	mkdir -p $(dir $(1)) && \
679	$(gb_RC) \
680		$(DEFS) $(FLAGS) \
681		-I$(dir $(3)) \
682		$(INCLUDE) \
683		-Fo$(patsubst %_res.o,%.res,$(1)) \
684        $(RCFILE) )
685$(call gb_Helper_abbreviate_dirs_native,\
686    windres $(patsubst %_res.o,%.res,$(1)) $(1))
687	rm $(patsubst %_res.o,%.res,$(1))
688endef
689
690$(eval $(call gb_Helper_make_dep_targets,\
691	WinResTarget \
692))
693
694ifeq ($(gb_FULLDEPS),$(true))
695define gb_WinResTarget__command_dep
696$(call gb_Helper_abbreviate_dirs_native,\
697	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
698		$(INCLUDE) \
699		$(DEFS) \
700		$(2) \
701		-f - \
702	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
703		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
704		-v OUTDIR=$(OUTDIR)/ \
705		-v WORKDIR=$(WORKDIR)/ \
706		-v SRCDIR=$(SRCDIR)/ \
707		-v REPODIR=$(REPODIR)/ \
708	> $(call gb_WinResTarget_get_dep_target,$(1)))
709endef
710else
711gb_WinResTarget__command_dep =
712endif
713
714# ComponentTarget
715
716gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
717gb_Library_COMPONENTPREFIXES := \
718    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
719    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
720    NONE:vnd.sun.star.expand:\dOOO_INBUILD_SHAREDLIB_DIR/ \
721
722# UnoApiTarget
723
724gb_UnoApiTarget_IDLCTARGET := $(OUTDIR)/bin/idlc.exe
725gb_UnoApiTarget_IDLCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_IDLCTARGET)
726gb_UnoApiTarget_REGMERGETARGET := $(OUTDIR)/bin/regmerge.exe
727gb_UnoApiTarget_REGMERGECOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGMERGETARGET)
728gb_UnoApiTarget_REGCOMPARETARGET := $(OUTDIR)/bin/regcompare.exe
729gb_UnoApiTarget_REGCOMPARECOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGCOMPARETARGET)
730gb_UnoApiTarget_CPPUMAKERTARGET := $(OUTDIR)/bin/cppumaker.exe
731gb_UnoApiTarget_CPPUMAKERCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_CPPUMAKERTARGET)
732gb_UnoApiTarget_REGVIEWTARGET := $(OUTDIR)/bin/regview.exe
733gb_UnoApiTarget_REGVIEWCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGVIEWTARGET)
734
735# vim: set noet sw=4 ts=4:
736