1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir#
7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir#
9*cdf0e10cSrcweir# This file is part of OpenOffice.org.
10*cdf0e10cSrcweir#
11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir#
15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir#
21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir#
26*cdf0e10cSrcweir#*************************************************************************
27*cdf0e10cSrcweir
28*cdf0e10cSrcweirPRJ=..
29*cdf0e10cSrcweirPRJNAME=external
30*cdf0e10cSrcweirTARGET=mingwheaders
31*cdf0e10cSrcweir
32*cdf0e10cSrcweir.INCLUDE :  settings.mk
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir.IF "$(OS)$(COM)" == "WNTGCC"
35*cdf0e10cSrcweir
36*cdf0e10cSrcweir# Cygwin and MinGW use different directories for the W32API headers
37*cdf0e10cSrcweir.IF "$(USE_MINGW)" == "cygwin"
38*cdf0e10cSrcweirMINGW_INCLUDE_DIR=$/usr$/include/mingw/
39*cdf0e10cSrcweirMINGW_W32API_INCLUDE_DIR=$/usr$/include/w32api/
40*cdf0e10cSrcweirMINGW_W32API_LIB_DIR=$/usr$/include/w32api/
41*cdf0e10cSrcweir.ELSE
42*cdf0e10cSrcweirMINGW_INCLUDE_DIR=$(COMPATH)$/include/
43*cdf0e10cSrcweirMINGW_W32API_INCLUDE_DIR=$(COMPATH)$/include/
44*cdf0e10cSrcweirMINGW_W32API_LIB_DIR=$(COMPATH)$/lib/
45*cdf0e10cSrcweir.ENDIF
46*cdf0e10cSrcweir
47*cdf0e10cSrcweirSYS_INCLUDE_DIR=$(MINGW_INCLUDE_DIR)$/sys/
48*cdf0e10cSrcweir
49*cdf0e10cSrcweirPSDK_INCLUDE_DIR=$(PSDK_HOME)$/include$/
50*cdf0e10cSrcweir
51*cdf0e10cSrcweirATL_INCLUDE_DIR=$(PSDK_HOME)$/include$/atl$/
52*cdf0e10cSrcweir
53*cdf0e10cSrcweirDIRECTXSDK_INCLUDE_DIR=$(DIRECTXSDK_HOME)$/include$/
54*cdf0e10cSrcweir
55*cdf0e10cSrcweirFILES_TO_COPY_FROM_MINGW= \
56*cdf0e10cSrcweir	excpt.h \
57*cdf0e10cSrcweir	 tchar.h
58*cdf0e10cSrcweir
59*cdf0e10cSrcweirFILES_TO_COPY_FROM_W32API= \
60*cdf0e10cSrcweir	amvideo.h \
61*cdf0e10cSrcweir	basetyps.h \
62*cdf0e10cSrcweir	objidl.h \
63*cdf0e10cSrcweir	specstrings.h \
64*cdf0e10cSrcweir	uxtheme.h \
65*cdf0e10cSrcweir	winbase.h \
66*cdf0e10cSrcweir	windef.h \
67*cdf0e10cSrcweir	wininet.h \
68*cdf0e10cSrcweir	winver.h \
69*cdf0e10cSrcweir	wtypes.h
70*cdf0e10cSrcweir
71*cdf0e10cSrcweirFILES_TO_COPY_FROM_SYS= \
72*cdf0e10cSrcweir	stat.h
73*cdf0e10cSrcweir
74*cdf0e10cSrcweirFILES_TO_COPY_FROM_PSDK= \
75*cdf0e10cSrcweir	adoctint.h \
76*cdf0e10cSrcweir	adodef.h \
77*cdf0e10cSrcweir	adoguids.h \
78*cdf0e10cSrcweir	adoint.h \
79*cdf0e10cSrcweir	bcrypt.h \
80*cdf0e10cSrcweir	commctrl.h \
81*cdf0e10cSrcweir	control.h \
82*cdf0e10cSrcweir	dispex.h \
83*cdf0e10cSrcweir	filter.h \
84*cdf0e10cSrcweir	gdiplusbitmap.h \
85*cdf0e10cSrcweir	gdiplusbrush.h \
86*cdf0e10cSrcweir	gdiplusenums.h \
87*cdf0e10cSrcweir	gdiplusfont.h \
88*cdf0e10cSrcweir	gdiplusheaders.h \
89*cdf0e10cSrcweir	gdiplusimageattributes.h \
90*cdf0e10cSrcweir	gdiplusimaging.h \
91*cdf0e10cSrcweir	gdiplusmatrix.h \
92*cdf0e10cSrcweir	gdipluspath.h \
93*cdf0e10cSrcweir	gdipluspen.h \
94*cdf0e10cSrcweir	gdiplusregion.h \
95*cdf0e10cSrcweir	gdiplusstringformat.h \
96*cdf0e10cSrcweir	imm.h \
97*cdf0e10cSrcweir	imagehlp.h \
98*cdf0e10cSrcweir	mapiwin.h \
99*cdf0e10cSrcweir	msdasc.h \
100*cdf0e10cSrcweir	msi.h \
101*cdf0e10cSrcweir	msiquery.h \
102*cdf0e10cSrcweir	multimon.h \
103*cdf0e10cSrcweir	ntquery.h \
104*cdf0e10cSrcweir	oaidl.h \
105*cdf0e10cSrcweir	ocidl.h \
106*cdf0e10cSrcweir	oleauto.h \
107*cdf0e10cSrcweir	olectl.h \
108*cdf0e10cSrcweir	oledb.h \
109*cdf0e10cSrcweir	oleidl.h \
110*cdf0e10cSrcweir	propidl.h \
111*cdf0e10cSrcweir	propkeydef.h \
112*cdf0e10cSrcweir	propsys.h \
113*cdf0e10cSrcweir	propvarutil.h \
114*cdf0e10cSrcweir	shlobj.h \
115*cdf0e10cSrcweir	shobjidl.h \
116*cdf0e10cSrcweir	shtypes.h \
117*cdf0e10cSrcweir	sspi.h \
118*cdf0e10cSrcweir	strmif.h \
119*cdf0e10cSrcweir	strsafe.h \
120*cdf0e10cSrcweir	structuredquery.h \
121*cdf0e10cSrcweir	urlmon.h \
122*cdf0e10cSrcweir	wincrypt.h \
123*cdf0e10cSrcweir	winerror.h \
124*cdf0e10cSrcweir	wingdi.h \
125*cdf0e10cSrcweir	wintrust.h \
126*cdf0e10cSrcweir	winuser.h \
127*cdf0e10cSrcweir	wspiapi.h \
128*cdf0e10cSrcweir	exdispid.h \
129*cdf0e10cSrcweir	dshow.h \
130*cdf0e10cSrcweir	gdiplus.h \
131*cdf0e10cSrcweir	msxml.h \
132*cdf0e10cSrcweir	ncrypt.h \
133*cdf0e10cSrcweir	shlguid.h \
134*cdf0e10cSrcweir	transact.h
135*cdf0e10cSrcweir
136*cdf0e10cSrcweir.IF "$(DISABLE_ATL)"==""
137*cdf0e10cSrcweirMINGWHEADER_ATL_PATCH_TARGET=$(MISC)$/mingwheader_atl_patch
138*cdf0e10cSrcweirMINGWHEADER_ATL_COPY_TARGET=$(MISC)$/mingwheader_atl_copy
139*cdf0e10cSrcweirFILES_TO_COPY_FROM_ATL= \
140*cdf0e10cSrcweir	atlbase.h \
141*cdf0e10cSrcweir	atlcom.h \
142*cdf0e10cSrcweir	atlconv.h \
143*cdf0e10cSrcweir	atlctl.h \
144*cdf0e10cSrcweir	atlwin.h \
145*cdf0e10cSrcweir	statreg.h
146*cdf0e10cSrcweir.ENDIF
147*cdf0e10cSrcweir
148*cdf0e10cSrcweirFILES_TO_COPY_FROM_DIRECTXSDK= \
149*cdf0e10cSrcweir	d3dtypes.h \
150*cdf0e10cSrcweir	d3dx9core.h \
151*cdf0e10cSrcweir	d3dx9math.h \
152*cdf0e10cSrcweir	d3dx9math.inl \
153*cdf0e10cSrcweir	dxtrans.h \
154*cdf0e10cSrcweir	d3dx9.h
155*cdf0e10cSrcweir
156*cdf0e10cSrcweir$(MISC)$/mingwheader_patch_all : $(MISC)$/mingwheader_patch $(MINGWHEADER_ATL_PATCH_TARGET) $(LB)$/libmsvcrt.a
157*cdf0e10cSrcweir
158*cdf0e10cSrcweir$(MISC)$/mingwheader_patch : $(MISC)$/mingwheader_copy
159*cdf0e10cSrcweir	patch -bd $(MISC)$/mingw -p0 -N -f -Z <mingw_headers.patch
160*cdf0e10cSrcweir	$(TOUCH) $(MISC)$/mingwheader_patch
161*cdf0e10cSrcweir
162*cdf0e10cSrcweir.IF "$(DISABLE_ATL)"==""
163*cdf0e10cSrcweir$(MINGWHEADER_ATL_PATCH_TARGET) : $(MINGWHEADER_ATL_COPY_TARGET)
164*cdf0e10cSrcweir	patch -bd $(MISC)$/mingw -p0 -N -f -Z <mingw_atl_headers.patch
165*cdf0e10cSrcweir	$(TOUCH) $(MINGWHEADER_ATL_PATCH_TARGET)
166*cdf0e10cSrcweir.ENDIF
167*cdf0e10cSrcweir
168*cdf0e10cSrcweir$(MISC)$/mingwheader_copy:
169*cdf0e10cSrcweir	$(MKDIRHIER) $(MISC)$/mingw$/include
170*cdf0e10cSrcweir	$(MKDIRHIER) $(MISC)$/mingw$/include/sys
171*cdf0e10cSrcweir	$(COPY) $(FILES_TO_COPY_FROM_MINGW:^$(MINGW_INCLUDE_DIR)) $(MISC)$/mingw$/include
172*cdf0e10cSrcweir	$(COPY) $(FILES_TO_COPY_FROM_W32API:^$(MINGW_W32API_INCLUDE_DIR)) $(MISC)$/mingw$/include
173*cdf0e10cSrcweir	$(COPY) $(FILES_TO_COPY_FROM_SYS:^$(SYS_INCLUDE_DIR)) $(MISC)$/mingw$/include$/sys
174*cdf0e10cSrcweir	$(COPY) $(FILES_TO_COPY_FROM_PSDK:^$(PSDK_INCLUDE_DIR)) $(MISC)$/mingw$/include
175*cdf0e10cSrcweir	$(COPY) $(FILES_TO_COPY_FROM_DIRECTXSDK:^$(DIRECTXSDK_INCLUDE_DIR)) $(MISC)$/mingw$/include
176*cdf0e10cSrcweir	$(TOUCH) $(MISC)$/mingwheader_copy
177*cdf0e10cSrcweir
178*cdf0e10cSrcweir.IF "$(DISABLE_ATL)"==""
179*cdf0e10cSrcweir$(MINGWHEADER_ATL_COPY_TARGET):
180*cdf0e10cSrcweir	$(MKDIRHIER) $(MISC)$/mingw$/include/atl
181*cdf0e10cSrcweir	$(COPY) $(FILES_TO_COPY_FROM_ATL:^$(ATL_INCLUDE_DIR)) $(MISC)$/mingw$/include$/atl
182*cdf0e10cSrcweir 	$(TOUCH) $(MINGWHEADER_ATL_COPY_TARGET)
183*cdf0e10cSrcweir.ENDIF
184*cdf0e10cSrcweir
185*cdf0e10cSrcweir$(LB)$/libmsvcrt.a:
186*cdf0e10cSrcweir.IF "$(USE_MINGW)" == "cygwin"
187*cdf0e10cSrcweir	$(COPY) $(COMPATH)$/lib/mingw/libmsvcrt.a $(LB)$/libmsvcrt_orig.a
188*cdf0e10cSrcweir.ELSE
189*cdf0e10cSrcweir	$(COPY) $(COMPATH)$/lib/libmsvcrt.a $(LB)$/libmsvcrt_orig.a
190*cdf0e10cSrcweir.ENDIF
191*cdf0e10cSrcweir	cd $(LB) && ar -x libmsvcrt_orig.a ofmt_stub.o
192*cdf0e10cSrcweir	ar -d $(LB)$/libmsvcrt_orig.a ofmt_stub.o
193*cdf0e10cSrcweir	nm -g --defined-only $(LB)$/libmsvcrt_orig.a > $(MISC)$/msvcrt.nm
194*cdf0e10cSrcweir	echo EXPORTS > $(MISC)$/msvcrt.def
195*cdf0e10cSrcweir	sed -ne 's/.* T _//p' $(MISC)$/msvcrt.nm | sort >> $(MISC)$/msvcrt.def
196*cdf0e10cSrcweir	-sed -ne 's/.* I __imp__//p' $(MISC)$/msvcrt.nm | sort | diff - $(MISC)$/msvcrt.def | \
197*cdf0e10cSrcweir		sed -ne 's/^< \(.*\)$/\1 DATA/p' > $(MISC)$/msvcrtdata.def
198*cdf0e10cSrcweir	cat $(MISC)$/msvcrtdata.def >> $(MISC)$/msvcrt.def
199*cdf0e10cSrcweir	dlltool --dllname msvcrt.dll --input-def=$(MISC)$/msvcrt.def --kill-at --output-lib=$(LB)$/libmsvcrt.a
200*cdf0e10cSrcweir	cd $(LB) && ar -rs libmsvcrt.a ofmt_stub.o
201*cdf0e10cSrcweir
202*cdf0e10cSrcweirclean:
203*cdf0e10cSrcweir	-$(RM) $(MISC)$/mingw$/include$/*.h
204*cdf0e10cSrcweir	-$(RM) $(MISC)$/mingwheader_copy
205*cdf0e10cSrcweir	-$(RM) $(MISC)$/mingwheader_patch
206*cdf0e10cSrcweir
207*cdf0e10cSrcweir.ENDIF
208*cdf0e10cSrcweir
209*cdf0e10cSrcweir.INCLUDE :  target.mk
210*cdf0e10cSrcweir
211