xref: /trunk/main/solenv/gbuild/platform/winmingw.mk (revision 7871dc3e)
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	--subsystem console \
157	--exclude-libs ALL \
158	--enable-stdcall-fixup \
159	--enable-runtime-pseudo-reloc-v2 \
160	-L$(gb_Library_DLLDIR) \
161	$(patsubst %,-L%,$(filter-out .,$(subst ;, ,$(subst \,/,$(ILIB))))) \
162
163ifeq ($(MINGW_GCCLIB_EH),YES)
164gb_LinkTarget_LDFLAGS += -shared-libgcc
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# CObject class
211
212ifeq ($(gb_FULLDEPS),$(true))
213define gb_CObject__command_deponcompile
214$(call gb_Helper_abbreviate_dirs_native,\
215	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
216		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
217		-I$(dir $(3)) \
218		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
219		$(3) \
220		-f - \
221	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
222		-v OBJECTFILE=$(1) \
223		-v OUTDIR=$(OUTDIR)/ \
224		-v WORKDIR=$(WORKDIR)/ \
225		-v SRCDIR=$(SRCDIR)/ \
226		-v REPODIR=$(REPODIR)/ \
227	> $(call gb_CObject_get_dep_target,$(2)))
228endef
229else
230CObject__command_deponcompile =
231endif
232
233define gb_CObject__command
234$(call gb_Output_announce,$(2),$(true),C  ,3)
235$(call gb_Helper_abbreviate_dirs_native,\
236	mkdir -p $(dir $(1)) && \
237	$(gb_CC) \
238		$(DEFS) $(CFLAGS) \
239		-c $(3) \
240		-o $(1) \
241		-I$(dir $(3)) \
242		$(INCLUDE))
243$(call gb_CObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
244endef
245
246
247
248# CxxObject class
249
250ifeq ($(gb_FULLDEPS),$(true))
251define gb_CxxObject__command_deponcompile
252$(call gb_Helper_abbreviate_dirs_native,\
253	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
254		$(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
255		-I$(dir $(3)) \
256		$(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
257		$(3) \
258		-f - \
259	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
260		-v OBJECTFILE=$(1) \
261		-v OUTDIR=$(OUTDIR)/ \
262		-v WORKDIR=$(WORKDIR)/ \
263		-v SRCDIR=$(SRCDIR)/ \
264		-v REPODIR=$(REPODIR)/ \
265	> $(call gb_CxxObject_get_dep_target,$(2)))
266endef
267else
268gb_CxxObject__command_deponcompile =
269endif
270
271define gb_CxxObject__command
272$(call gb_Output_announce,$(2),$(true),CXX,3)
273$(call gb_Helper_abbreviate_dirs_native,\
274	mkdir -p $(dir $(1)) && \
275	$(gb_CXX) \
276		$(DEFS) $(CXXFLAGS) \
277		-c $(3) \
278		-o $(1) \
279		-I$(dir $(3)) \
280		$(INCLUDE_STL) $(INCLUDE))
281$(call gb_CxxObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CXXFLAGS),$(INCLUDE_STL) $(INCLUDE))
282endef
283
284
285# PrecompiledHeader class
286
287gb_PrecompiledHeader_EXT := .gch
288
289gb_PrecompiledHeader_get_enableflags = -I$(WORKDIR)/PrecompiledHeader/$(gb_PrecompiledHeader_DEBUGDIR) \
290					-DPRECOMPILED_HEADERS \
291					-Winvalid-pch \
292
293ifeq ($(gb_FULLDEPS),$(true))
294define gb_PrecompiledHeader__command_deponcompile
295$(call gb_Helper_abbreviate_dirs_native,\
296	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
297		$(4) $(5) \
298		-I$(dir $(3)) \
299		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
300		$(3) \
301		-f - \
302	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
303		-v OBJECTFILE=$(1) \
304		-v OUTDIR=$(OUTDIR)/ \
305		-v WORKDIR=$(WORKDIR)/ \
306		-v SRCDIR=$(SRCDIR)/ \
307		-v REPODIR=$(REPODIR)/ \
308	> $(call gb_PrecompiledHeader_get_dep_target,$(2)))
309endef
310else
311gb_PrecompiledHeader__command_deponcompile =
312endif
313
314define gb_PrecompiledHeader__command
315$(call gb_Output_announce,$(2),$(true),PCH,1)
316$(call gb_Helper_abbreviate_dirs_native,\
317	mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
318	$(gb_CXX) \
319		-x c++-header \
320		$(4) $(5) \
321		-I$(dir $(3)) \
322		$(6) \
323		-c $(3) \
324		-o$(1))
325$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
326
327endef
328
329# NoexPrecompiledHeader class
330
331gb_NoexPrecompiledHeader_EXT := .gch
332
333gb_NoexPrecompiledHeader_get_enableflags = -I$(WORKDIR)/NoexPrecompiledHeader/$(gb_NoexPrecompiledHeader_DEBUGDIR) \
334					-Winvalid-pch \
335
336ifeq ($(gb_FULLDEPS),$(true))
337define gb_NoexPrecompiledHeader__command_deponcompile
338$(call gb_Helper_abbreviate_dirs_native,\
339	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
340		$(4) $(5) \
341		-I$(dir $(3)) \
342		$(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
343		$(3) \
344		-f - \
345	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
346		-v OBJECTFILE=$(1) \
347		-v OUTDIR=$(OUTDIR)/ \
348		-v WORKDIR=$(WORKDIR)/ \
349		-v SRCDIR=$(SRCDIR)/ \
350		-v REPODIR=$(REPODIR)/ \
351	> $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
352endef
353else
354gb_NoexPrecompiledHeader__command_deponcompile =
355endif
356
357define gb_NoexPrecompiledHeader__command
358$(call gb_Output_announce,$(2),$(true),PCH,1)
359$(call gb_Helper_abbreviate_dirs_native,\
360	mkdir -p $(dir $(1)) $(dir $(call gb_NoexPrecompiledHeader_get_dep_target,$(2))) && \
361	$(gb_CXX) \
362		-x c++-header \
363		$(4) $(5) \
364		-I$(dir $(3)) \
365		$(6) \
366		-c $(3) \
367		-o$(1))
368$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
369
370endef
371
372
373# LinkTarget class
374
375gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
376gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
377
378ifeq ($(gb_DEBUGLEVEL),2)
379gb_LinkTarget_CXXFLAGS += -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
380gb_LinkTarget_CFLAGS += -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
381
382endif
383
384gb_LinkTarget_INCLUDE :=\
385	$(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) \
386	$(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
387
388gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
389
390define gb_LinkTarget__command_dynamiclinkexecutable
391$(call gb_Output_announce,$(2),$(true),LNK,4)
392$(call gb_Helper_abbreviate_dirs_native,\
393	mkdir -p $(dir $(1)) && \
394	RESPONSEFILE=`$(gb_MKTEMP)` && \
395	echo "$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
396		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
397		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
398		$(NATIVERES) " > $${RESPONSEFILE} && \
399	$(gb_LINK) \
400		$(gb_Executable_TARGETTYPEFLAGS) \
401		$(LDFLAGS) \
402		$(gb_MINGWLIBDIR)/crt2.o \
403		$(MINGW_CLIB_DIR)/crtbegin.o \
404		@$${RESPONSEFILE} \
405		--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
406		--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
407		$(MINGW_CLIB_DIR)/crtend.o \
408		-Map $(basename $(1)).map \
409		-o $(1))
410endef
411
412define gb_LinkTarget__command_dynamiclinklibrary
413$(call gb_Helper_abbreviate_dirs_native,\
414	mkdir -p $(dir $(1)) && \
415	rm -f $(1) && \
416	RESPONSEFILE=`$(gb_MKTEMP)` && \
417	echo "$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
418		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
419		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
420		$(NATIVERES) " > $${RESPONSEFILE} && \
421	$(gb_LINK) \
422		$(gb_Library_TARGETTYPEFLAGS) \
423		$(LDFLAGS) \
424		--enable-auto-image-base \
425		-e _DllMainCRTStartup@12 \
426		$(gb_MINGWLIBDIR)/dllcrt2.o \
427		$(MINGW_CLIB_DIR)/crtbegin.o \
428		@$${RESPONSEFILE} \
429		--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \
430		--start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \
431		$(MINGW_CLIB_DIR)/crtend.o \
432		-Map $(basename $(DLLTARGET)).map \
433		-o $(DLLTARGET) && touch $(1))
434endef
435
436define gb_LinkTarget__command_staticlinklibrary
437$(call gb_Helper_abbreviate_dirs_native,\
438	mkdir -p $(dir $(1)) && \
439	RESPONSEFILE=`$(gb_MKTEMP)` && \
440	echo "$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
441		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
442		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) " > $${RESPONSEFILE} && \
443	$(gb_AR) -rsu\
444		$(1) \
445		@$${RESPONSEFILE})
446endef
447
448define gb_LinkTarget__command
449$(call gb_Output_announce,$(2),$(true),LNK,4)
450$(if $(filter Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclinkexecutable,$(1),$(2)))
451$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclinklibrary,$(1),$(2)))
452$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlinklibrary,$(1)))
453endef
454
455
456# Library class
457
458gb_Library_DEFS := -D_DLL
459gb_Library_TARGETTYPEFLAGS := -shared
460gb_Library_get_rpath :=
461
462gb_Library_SYSPRE := i
463gb_Library_PLAINEXT := .lib
464
465gb_Library_PLAINLIBS_NONE += \
466	mingwthrd \
467	mingw32 \
468	mingwex \
469	$(gb_MINGW_LIBSTDCPP) \
470	$(gb_MINGW_LIBGCC) \
471	advapi32 \
472	gdi32 \
473	gdiplus \
474	gnu_getopt \
475	imm32\
476	kernel32 \
477	msimg32 \
478	msvcrt \
479	mpr \
480	moldname \
481	ole32 \
482	oleaut32 \
483	shell32 \
484	user32 \
485	uuid \
486	uwinapi \
487	winspool \
488	z \
489	cppunit
490
491gb_Library_LAYER := \
492	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
493	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):OOO) \
494	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):OOO) \
495	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
496	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
497	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):OOO) \
498	$(foreach lib,$(gb_Library_STLLIBS),$(lib):OOO) \
499	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):OOO) \
500	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
501	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):OOO) \
502
503gb_Library_FILENAMES :=\
504	$(foreach lib,$(gb_Library_TARGETS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
505
506gb_Library_DLLEXT := .dll
507gb_Library_MAJORVER := 3
508gb_Library_RTEXT := gcc3$(gb_Library_DLLEXT)
509ifeq ($(gb_PRODUCT),$(true))
510gb_Library_STLEXT := port_gcc$(gb_Library_DLLEXT)
511else
512gb_Library_STLEXT := port_gcc_stldebug$(gb_Library_DLLEXT)
513endif
514gb_Library_OOOEXT := $(gb_Library_DLLEXT)
515gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
516gb_Library_UNOVEREXT := $(gb_Library_MAJORVER)$(gb_Library_DLLEXT)
517gb_Library_RTVEREXT := $(gb_Library_MAJORVER)$(gb_Library_RTEXT)
518
519gb_Library_DLLFILENAMES := \
520	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
521	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
522	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
523	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
524	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(lib)$(gb_Library_RTEXT)) \
525	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
526	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
527	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
528	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
529
530gb_Library_IARCSYSPRE := lib
531gb_Library_IARCEXT := .a
532
533gb_Library_ILIBEXT := .lib
534
535define gb_Library_Library_platform
536$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
537
538$(call gb_LinkTarget_set_auxtargets,$(2),\
539	$(patsubst %.dll,%.map,$(3)) \
540)
541
542$(call gb_Library_get_target,$(1)) \
543$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS := $(OUTDIR)/bin/$(notdir $(3))
544
545$(call gb_Deliver_add_deliverable,$(OUTDIR)/bin/$(notdir $(3)),$(3))
546
547endef
548
549define gb_Library_add_default_nativeres
550$(call gb_WinResTarget_WinResTarget_init,$(1)/$(2))
551$(call gb_WinResTarget_add_file,$(1)/$(2),solenv/inc/shlinfo)
552$(call gb_WinResTarget_set_defs,$(1)/$(2),\
553        $$(DEFS) \
554		-DADDITIONAL_VERINFO1= \
555		-DADDITIONAL_VERINFO2= \
556		-DADDITIONAL_VERINFO3= \
557)
558$(call gb_Library_add_nativeres,$(1),$(2))
559$(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(1)/$(2))
560
561endef
562
563define gb_Library_add_nativeres
564$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : $(call gb_WinResTarget_get_target,$(1)/$(2))
565$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,$(1))) : NATIVERES += $(call gb_WinResTarget_get_target,$(1)/$(2))
566
567endef
568
569define gb_Library_get_dllname
570$(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_DLLFILENAMES)))
571endef
572
573
574# StaticLibrary class
575
576gb_StaticLibrary_DEFS :=
577gb_StaticLibrary_SYSPRE := lib
578gb_StaticLibrary_PLAINEXT := .a
579gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
580
581gb_StaticLibrary_FILENAMES := \
582	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
583	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
584
585gb_StaticLibrary_FILENAMES := $(patsubst salcpprt:salcpprt%,salcpprt:cpprtl%,$(gb_StaticLibrary_FILENAMES))
586
587gb_StaticLibrary_StaticLibrary_platform =
588
589# Executable class
590
591gb_Executable_EXT := .exe
592gb_Executable_TARGETTYPEFLAGS :=
593gb_Executable_get_rpath :=
594gb_Executable_Executable_platform =
595
596
597# CppunitTest class
598
599gb_CppunitTest_CPPTESTPRECOMMAND :=
600gb_CppunitTest_SYSPRE := itest_
601gb_CppunitTest_EXT := .lib
602gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
603gb_CppunitTest_get_libfilename = test_$(1).dll
604
605define gb_CppunitTest_CppunitTest_platform
606$(call gb_LinkTarget_set_dlltarget,$(2),$(3))
607
608$(call gb_LinkTarget_set_auxtargets,$(2),\
609	$(patsubst %.dll,%.map,$(3)) \
610)
611
612endef
613
614# SdiTarget class
615
616gb_SdiTarget_SVIDLPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
617
618# SrsPartMergeTarget
619
620gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
621
622# SrsPartTarget class
623
624gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc.exe
625gb_SrsPartTarget_RSCCOMMAND := SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
626
627ifeq ($(gb_FULLDEPS),$(true))
628define gb_SrsPartTarget__command_dep
629$(call gb_Helper_abbreviate_dirs_native,\
630	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
631		$(INCLUDE) \
632		$(DEFS) \
633		$(2) \
634		-f - \
635	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
636		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
637		-v OUTDIR=$(OUTDIR)/ \
638		-v WORKDIR=$(WORKDIR)/ \
639		-v SRCDIR=$(SRCDIR)/ \
640		-v REPODIR=$(REPODIR)/ \
641	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
642endef
643else
644gb_SrsPartTarget__command_dep =
645endif
646
647# WinResTarget class
648
649gb_WinResTarget_POSTFIX :=_res.o
650
651define gb_WinResTarget__command
652$(call gb_Output_announce,$(2),$(true),RES,3)
653$(call gb_Helper_abbreviate_dirs_native,\
654	mkdir -p $(dir $(1)) && \
655	$(gb_RC) \
656		$(DEFS) $(FLAGS) \
657		-I$(dir $(3)) \
658		$(INCLUDE) \
659		-Fo$(patsubst %_res.o,%.res,$(1)) \
660        $(RCFILE) )
661$(call gb_Helper_abbreviate_dirs_native,\
662    windres $(patsubst %_res.o,%.res,$(1)) $(1))
663	rm $(patsubst %_res.o,%.res,$(1))
664endef
665
666$(eval $(call gb_Helper_make_dep_targets,\
667	WinResTarget \
668))
669
670ifeq ($(gb_FULLDEPS),$(true))
671define gb_WinResTarget__command_dep
672$(call gb_Helper_abbreviate_dirs_native,\
673	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
674		$(INCLUDE) \
675		$(DEFS) \
676		$(2) \
677		-f - \
678	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
679		-v OBJECTFILE=$(call gb_WinResTarget_get_target,$(1)) \
680		-v OUTDIR=$(OUTDIR)/ \
681		-v WORKDIR=$(WORKDIR)/ \
682		-v SRCDIR=$(SRCDIR)/ \
683		-v REPODIR=$(REPODIR)/ \
684	> $(call gb_WinResTarget_get_dep_target,$(1)))
685endef
686else
687gb_WinResTarget__command_dep =
688endif
689
690# ComponentTarget
691
692gb_XSLTPROCPRECOMMAND := PATH="$${PATH}:$(OUTDIR)/bin"
693gb_Library_COMPONENTPREFIXES := \
694    OOO:vnd.sun.star.expand:\dBRAND_BASE_DIR/program/ \
695    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
696
697# vim: set noet sw=4 ts=4:
698