xref: /aoo42x/main/solenv/gbuild/platform/winmingw.mk (revision 52d905a6)
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,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
404		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
405		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
406		$(NATIVERES) " > $${RESPONSEFILE} && \
407	$(gb_LINK) \
408		$(gb_Executable_TARGETTYPEFLAGS) \
409		$(if $(filter YES,$(gb_Executable_TARGETGUI)), --subsystem windows, --subsystem console) \
410		$(T_LDFLAGS) \
411		$(gb_MINGWLIBDIR)/crt2.o \
412		$(MINGW_CLIB_DIR)/crtbegin.o \
413		@$${RESPONSEFILE} \
414		--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
415		--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
416		--start-group $(patsubst %,-l%,$(EXTERNAL_LIBS)) --end-group \
417		$(LIBS) \
418		$(MINGW_CLIB_DIR)/crtend.o \
419		-Map $(basename $(1)).map \
420		-o $(1))
421endef
422
423define gb_LinkTarget__command_dynamiclinklibrary
424$(call gb_Helper_abbreviate_dirs_native,\
425	mkdir -p $(dir $(1)) && \
426	rm -f $(1) && \
427	RESPONSEFILE=`$(gb_MKTEMP)` && \
428	echo "\
429		$(foreach object,$(ASMXXOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
430		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
431		$(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
432		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
433		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
434		$(NATIVERES) " > $${RESPONSEFILE} && \
435	$(gb_LINK) \
436		$(gb_Library_TARGETTYPEFLAGS) \
437		$(T_LDFLAGS) \
438		--enable-auto-image-base \
439		-e _DllMainCRTStartup@12 \
440		$(gb_MINGWLIBDIR)/dllcrt2.o \
441		$(MINGW_CLIB_DIR)/crtbegin.o \
442		@$${RESPONSEFILE} \
443		--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
444		--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
445		$(LIBS) \
446		$(MINGW_CLIB_DIR)/crtend.o \
447		-Map $(basename $(DLLTARGET)).map \
448		-o $(DLLTARGET) && touch $(1))
449endef
450
451define gb_LinkTarget__command_staticlinklibrary
452$(call gb_Helper_abbreviate_dirs_native,\
453	mkdir -p $(dir $(1)) && \
454	RESPONSEFILE=`$(gb_MKTEMP)` && \
455	echo "$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
456		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
457		$(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
458		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) " > $${RESPONSEFILE} && \
459	$(gb_AR) -rsu\
460		$(1) \
461		@$${RESPONSEFILE})
462endef
463
464define gb_LinkTarget__command
465$(call gb_Output_announce,$(2),$(true),LNK,4)
466$(if $(filter GoogleTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclinkexecutable,$(1),$(2)))
467$(if $(filter Library,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclinklibrary,$(1),$(2)))
468$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlinklibrary,$(1)))
469endef
470
471
472# Library class
473
474gb_Library_DEFS := -D_DLL_
475gb_Library_TARGETTYPEFLAGS := -shared
476gb_Library_get_rpath :=
477
478gb_Library_SYSPRE := i
479gb_Library_PLAINEXT := .lib
480
481gb_Library_PLAINLIBS_NONE += \
482	mingwthrd \
483	mingw32 \
484	mingwex \
485	$(gb_MINGW_LIBSTDCPP) \
486	$(gb_MINGW_LIBGCC) \
487	advapi32 \
488	comdlg32 \
489	d3d9 \
490	d3dx \
491	ddraw \
492	gdi32 \
493	gdiplus \
494	glu32 \
495	gnu_getopt \
496	imm32\
497	kernel32 \
498	msimg32 \
499	msvcrt \
500	mpr \
501	moldname \
502	ole32 \
503	oleaut32 \
504	opengl32 \
505	shell32 \
506	shlwapi \
507	strmiids \
508	user32 \
509	uuid \
510	uwinapi \
511	winmm \
512	winspool \
513	ws2_32 \
514	wsock32
515
516gb_Library_LAYER := \
517	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
518	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
519	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
520	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
521	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
522	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
523	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
524	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
525	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
526	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
527
528gb_Library_FILENAMES :=\
529	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
530
531gb_Library_DLLEXT := .dll
532gb_Library_MAJORVER := 3
533gb_Library_RTEXT := gcc3$(gb_Library_DLLEXT)
534ifeq ($(gb_PRODUCT),$(true))
535gb_Library_STLEXT := port_gcc$(gb_Library_DLLEXT)
536else
537gb_Library_STLEXT := port_gcc_stldebug$(gb_Library_DLLEXT)
538endif
539gb_Library_OOOEXT := $(gb_Library_DLLEXT)
540gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
541gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
542gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
543
544gb_Library_DLLFILENAMES := \
545	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
546	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
547	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
548	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
549	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
550	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
551	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
552	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
553	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
554
555gb_Library_IARCSYSPRE := lib
556gb_Library_IARCEXT := .a
557
558gb_Library_ILIBEXT := .lib
559
560define gb_Library_Library_platform
561$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
562
563$(call gb_LinkTarget_set_auxtargets,$(2),\
564	$(patsubst %.dll,%.map,$(3)) \
565)
566
567$(call gb_Library_get_target,$(1)) \
568$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
569
570$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3),$(1))
571
572endef
573
574define gb_Library_add_default_nativeres
575$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
576$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
577$(call gb_WinResTarget_set_defs,$(1)/$(2),\
578        $$(DEFS) \
579		-DADDITIONAL_VERINFO1= \
580		-DADDITIONAL_VERINFO2= \
581		-DADDITIONAL_VERINFO3= \
582)
583$(call gb_Library_add_nativeres,$(1),$(2))
584$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
585
586endef
587
588define gb_Library_add_nativeres
589$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
590$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
591
592endef
593
594define gb_Library_get_dllname
595$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
596endef
597
598
599# StaticLibrary class
600
601gb_StaticLibrary_DEFS :=
602gb_StaticLibrary_SYSPRE := lib
603gb_StaticLibrary_PLAINEXT := .a
604gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
605
606gb_StaticLibrary_FILENAMES := \
607	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
608	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
609
610gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
611
612gb_StaticLibrary_StaticLibrary_platform =
613
614# Executable class
615
616gb_Executable_EXT := .exe
617gb_Executable_TARGETTYPEFLAGS :=
618gb_Executable_get_rpath :=
619gb_Executable_Executable_platform =
620gb_Executable_TARGETGUI :=
621
622gb_InBuild_Library_Path := $(OUTDIR)/bin
623gb_Augment_Library_Path := PATH="$${PATH}:$(gb_InBuild_Library_Path)"
624
625# GoogleTest class
626
627gb_GoogleTest_GTESTPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
628gb_GoogleTest_get_filename = $(1)$(gb_Executable_EXT)
629
630define gb_GoogleTest_GoogleTest_platform
631endef
632
633# JunitTest class
634
635define gb_JunitTest_JunitTest_platform
636$(call gb_JunitTest_get_target,$(1)) : DEFS := \
637	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(SRCDIR)/instsetoo_native/$(INPATH)/Apache_OpenOffice/installed/install/en-US/OpenOffice 4/program/soffice.exe}" \
638    -Dorg.openoffice.test.arg.env=PATH \
639    -Dorg.openoffice.test.arg.user=file:///$(call gb_JunitTest_get_userdir,$(1)) \
640
641endef
642
643
644# Ant class
645
646define gb_Ant_add_dependencies
647__ant_out:=$(shell $(gb_Ant_ANTCOMMAND) -Ddependencies.outfile=`cygpath -m $(WORKDIR)/Ant/$(1)/deps` -f `cygpath -m $(2)` dependencies)
648$$(eval $(foreach dep,$(shell cat $(WORKDIR)/Ant/$(1)/deps),$$(call gb_Ant_add_dependency,$(call gb_Ant_get_target,$(1)),$(shell cygpath -u $(dep)))))
649
650endef
651
652
653# SdiTarget class
654
655gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
656
657# SrsPartMergeTarget
658
659gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
660
661# SrsPartTarget class
662
663gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
664gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
665
666ifeq ($(gb_FULLDEPS),$(true))
667define gb_SrsPartTarget__command_dep
668$(call gb_Helper_abbreviate_dirs_native,\
669	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
670		$(INCLUDE) \
671		$(DEFS) \
672		$(2) \
673		-f - \
674	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
675		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
676		-v OUTDIR=$(OUTDIR)/ \
677		-v WORKDIR=$(WORKDIR)/ \
678		-v SRCDIR=$(SRCDIR)/ \
679		-v REPODIR=$(REPODIR)/ \
680	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
681endef
682else
683gb_SrsPartTarget__command_dep =
684endif
685
686# WinResTarget class
687
688gb_WinResTarget_POSTFIX :=_res.o
689
690define gb_WinResTarget__command
691$(call gb_Output_announce,$(2),$(true),RES,3)
692$(call gb_Helper_abbreviate_dirs_native,\
693	mkdir -p $(dir $(1)) && \
694	$(gb_RC) \
695		$(DEFS) $(FLAGS) \
696		-I$(dir $(3)) \
697		$(INCLUDE) \
698		-Fo$(patsubst %_res.o,%.res,$(1)) \
699        $(RCFILE) )
700$(call gb_Helper_abbreviate_dirs_native,\
701    windres $(patsubst %_res.o,%.res,$(1)) $(1))
702	rm $(patsubst %_res.o,%.res,$(1))
703endef
704
705$(eval $(call gb_Helper_make_dep_targets,\
706	WinResTarget \
707))
708
709ifeq ($(gb_FULLDEPS),$(true))
710define gb_WinResTarget__command_dep
711$(call gb_Helper_abbreviate_dirs_native,\
712	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
713		$(INCLUDE) \
714		$(DEFS) \
715		$(2) \
716		-f - \
717	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
718		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
719		-v OUTDIR=$(OUTDIR)/ \
720		-v WORKDIR=$(WORKDIR)/ \
721		-v SRCDIR=$(SRCDIR)/ \
722		-v REPODIR=$(REPODIR)/ \
723	> $(call gb_WinResTarget_get_dep_target,$(1)))
724endef
725else
726gb_WinResTarget__command_dep =
727endif
728
729# ComponentTarget
730
731gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
732gb_Library_COMPONENTPREFIXES := \
733    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
734    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
735    NONE:vnd.sun.star.expand:\dOOO_INBUILD_SHAREDLIB_DIR/ \
736
737# UnoApiTarget
738
739gb_UnoApiTarget_IDLCTARGET := $(OUTDIR)/bin/idlc.exe
740gb_UnoApiTarget_IDLCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_IDLCTARGET)
741gb_UnoApiTarget_REGMERGETARGET := $(OUTDIR)/bin/regmerge.exe
742gb_UnoApiTarget_REGMERGECOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGMERGETARGET)
743gb_UnoApiTarget_REGCOMPARETARGET := $(OUTDIR)/bin/regcompare.exe
744gb_UnoApiTarget_REGCOMPARECOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGCOMPARETARGET)
745gb_UnoApiTarget_CPPUMAKERTARGET := $(OUTDIR)/bin/cppumaker.exe
746gb_UnoApiTarget_CPPUMAKERCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_CPPUMAKERTARGET)
747gb_UnoApiTarget_REGVIEWTARGET := $(OUTDIR)/bin/regview.exe
748gb_UnoApiTarget_REGVIEWCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_UnoApiTarget_REGVIEWTARGET)
749
750# vim: set noet sw=4 ts=4:
751