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