1*7871dc3eSAndrew Rist#************************************************************** 2*7871dc3eSAndrew Rist# 3*7871dc3eSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 4*7871dc3eSAndrew Rist# or more contributor license agreements. See the NOTICE file 5*7871dc3eSAndrew Rist# distributed with this work for additional information 6*7871dc3eSAndrew Rist# regarding copyright ownership. The ASF licenses this file 7*7871dc3eSAndrew Rist# to you under the Apache License, Version 2.0 (the 8*7871dc3eSAndrew Rist# "License"); you may not use this file except in compliance 9*7871dc3eSAndrew Rist# with the License. You may obtain a copy of the License at 10*7871dc3eSAndrew Rist# 11*7871dc3eSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 12*7871dc3eSAndrew Rist# 13*7871dc3eSAndrew Rist# Unless required by applicable law or agreed to in writing, 14*7871dc3eSAndrew Rist# software distributed under the License is distributed on an 15*7871dc3eSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*7871dc3eSAndrew Rist# KIND, either express or implied. See the License for the 17*7871dc3eSAndrew Rist# specific language governing permissions and limitations 18*7871dc3eSAndrew Rist# under the License. 19*7871dc3eSAndrew Rist# 20*7871dc3eSAndrew Rist#************************************************************** 21*7871dc3eSAndrew Rist 22*7871dc3eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweirPRJ=.. 25cdf0e10cSrcweirPRJNAME=external 26cdf0e10cSrcweirTARGET=mingwheaders 27cdf0e10cSrcweir 28cdf0e10cSrcweir.INCLUDE : settings.mk 29cdf0e10cSrcweir 30cdf0e10cSrcweir.IF "$(OS)$(COM)" == "WNTGCC" 31cdf0e10cSrcweir 32cdf0e10cSrcweir# Cygwin and MinGW use different directories for the W32API headers 33cdf0e10cSrcweir.IF "$(USE_MINGW)" == "cygwin" 34cdf0e10cSrcweirMINGW_INCLUDE_DIR=$/usr$/include/mingw/ 35cdf0e10cSrcweirMINGW_W32API_INCLUDE_DIR=$/usr$/include/w32api/ 36cdf0e10cSrcweirMINGW_W32API_LIB_DIR=$/usr$/include/w32api/ 37cdf0e10cSrcweir.ELSE 38cdf0e10cSrcweirMINGW_INCLUDE_DIR=$(COMPATH)$/include/ 39cdf0e10cSrcweirMINGW_W32API_INCLUDE_DIR=$(COMPATH)$/include/ 40cdf0e10cSrcweirMINGW_W32API_LIB_DIR=$(COMPATH)$/lib/ 41cdf0e10cSrcweir.ENDIF 42cdf0e10cSrcweir 43cdf0e10cSrcweirSYS_INCLUDE_DIR=$(MINGW_INCLUDE_DIR)$/sys/ 44cdf0e10cSrcweir 45cdf0e10cSrcweirPSDK_INCLUDE_DIR=$(PSDK_HOME)$/include$/ 46cdf0e10cSrcweir 47cdf0e10cSrcweirATL_INCLUDE_DIR=$(PSDK_HOME)$/include$/atl$/ 48cdf0e10cSrcweir 49cdf0e10cSrcweirDIRECTXSDK_INCLUDE_DIR=$(DIRECTXSDK_HOME)$/include$/ 50cdf0e10cSrcweir 51cdf0e10cSrcweirFILES_TO_COPY_FROM_MINGW= \ 52cdf0e10cSrcweir excpt.h \ 53cdf0e10cSrcweir tchar.h 54cdf0e10cSrcweir 55cdf0e10cSrcweirFILES_TO_COPY_FROM_W32API= \ 56cdf0e10cSrcweir amvideo.h \ 57cdf0e10cSrcweir basetyps.h \ 58cdf0e10cSrcweir objidl.h \ 59cdf0e10cSrcweir specstrings.h \ 60cdf0e10cSrcweir uxtheme.h \ 61cdf0e10cSrcweir winbase.h \ 62cdf0e10cSrcweir windef.h \ 63cdf0e10cSrcweir wininet.h \ 64cdf0e10cSrcweir winver.h \ 65cdf0e10cSrcweir wtypes.h 66cdf0e10cSrcweir 67cdf0e10cSrcweirFILES_TO_COPY_FROM_SYS= \ 68cdf0e10cSrcweir stat.h 69cdf0e10cSrcweir 70cdf0e10cSrcweirFILES_TO_COPY_FROM_PSDK= \ 71cdf0e10cSrcweir adoctint.h \ 72cdf0e10cSrcweir adodef.h \ 73cdf0e10cSrcweir adoguids.h \ 74cdf0e10cSrcweir adoint.h \ 75cdf0e10cSrcweir bcrypt.h \ 76cdf0e10cSrcweir commctrl.h \ 77cdf0e10cSrcweir control.h \ 78cdf0e10cSrcweir dispex.h \ 79cdf0e10cSrcweir filter.h \ 80cdf0e10cSrcweir gdiplusbitmap.h \ 81cdf0e10cSrcweir gdiplusbrush.h \ 82cdf0e10cSrcweir gdiplusenums.h \ 83cdf0e10cSrcweir gdiplusfont.h \ 84cdf0e10cSrcweir gdiplusheaders.h \ 85cdf0e10cSrcweir gdiplusimageattributes.h \ 86cdf0e10cSrcweir gdiplusimaging.h \ 87cdf0e10cSrcweir gdiplusmatrix.h \ 88cdf0e10cSrcweir gdipluspath.h \ 89cdf0e10cSrcweir gdipluspen.h \ 90cdf0e10cSrcweir gdiplusregion.h \ 91cdf0e10cSrcweir gdiplusstringformat.h \ 92cdf0e10cSrcweir imm.h \ 93cdf0e10cSrcweir imagehlp.h \ 94cdf0e10cSrcweir mapiwin.h \ 95cdf0e10cSrcweir msdasc.h \ 96cdf0e10cSrcweir msi.h \ 97cdf0e10cSrcweir msiquery.h \ 98cdf0e10cSrcweir multimon.h \ 99cdf0e10cSrcweir ntquery.h \ 100cdf0e10cSrcweir oaidl.h \ 101cdf0e10cSrcweir ocidl.h \ 102cdf0e10cSrcweir oleauto.h \ 103cdf0e10cSrcweir olectl.h \ 104cdf0e10cSrcweir oledb.h \ 105cdf0e10cSrcweir oleidl.h \ 106cdf0e10cSrcweir propidl.h \ 107cdf0e10cSrcweir propkeydef.h \ 108cdf0e10cSrcweir propsys.h \ 109cdf0e10cSrcweir propvarutil.h \ 110cdf0e10cSrcweir shlobj.h \ 111cdf0e10cSrcweir shobjidl.h \ 112cdf0e10cSrcweir shtypes.h \ 113cdf0e10cSrcweir sspi.h \ 114cdf0e10cSrcweir strmif.h \ 115cdf0e10cSrcweir strsafe.h \ 116cdf0e10cSrcweir structuredquery.h \ 117cdf0e10cSrcweir urlmon.h \ 118cdf0e10cSrcweir wincrypt.h \ 119cdf0e10cSrcweir winerror.h \ 120cdf0e10cSrcweir wingdi.h \ 121cdf0e10cSrcweir wintrust.h \ 122cdf0e10cSrcweir winuser.h \ 123cdf0e10cSrcweir wspiapi.h \ 124cdf0e10cSrcweir exdispid.h \ 125cdf0e10cSrcweir dshow.h \ 126cdf0e10cSrcweir gdiplus.h \ 127cdf0e10cSrcweir msxml.h \ 128cdf0e10cSrcweir ncrypt.h \ 129cdf0e10cSrcweir shlguid.h \ 130cdf0e10cSrcweir transact.h 131cdf0e10cSrcweir 132cdf0e10cSrcweir.IF "$(DISABLE_ATL)"=="" 133cdf0e10cSrcweirMINGWHEADER_ATL_PATCH_TARGET=$(MISC)$/mingwheader_atl_patch 134cdf0e10cSrcweirMINGWHEADER_ATL_COPY_TARGET=$(MISC)$/mingwheader_atl_copy 135cdf0e10cSrcweirFILES_TO_COPY_FROM_ATL= \ 136cdf0e10cSrcweir atlbase.h \ 137cdf0e10cSrcweir atlcom.h \ 138cdf0e10cSrcweir atlconv.h \ 139cdf0e10cSrcweir atlctl.h \ 140cdf0e10cSrcweir atlwin.h \ 141cdf0e10cSrcweir statreg.h 142cdf0e10cSrcweir.ENDIF 143cdf0e10cSrcweir 144cdf0e10cSrcweirFILES_TO_COPY_FROM_DIRECTXSDK= \ 145cdf0e10cSrcweir d3dtypes.h \ 146cdf0e10cSrcweir d3dx9core.h \ 147cdf0e10cSrcweir d3dx9math.h \ 148cdf0e10cSrcweir d3dx9math.inl \ 149cdf0e10cSrcweir dxtrans.h \ 150cdf0e10cSrcweir d3dx9.h 151cdf0e10cSrcweir 152cdf0e10cSrcweir$(MISC)$/mingwheader_patch_all : $(MISC)$/mingwheader_patch $(MINGWHEADER_ATL_PATCH_TARGET) $(LB)$/libmsvcrt.a 153cdf0e10cSrcweir 154cdf0e10cSrcweir$(MISC)$/mingwheader_patch : $(MISC)$/mingwheader_copy 155cdf0e10cSrcweir patch -bd $(MISC)$/mingw -p0 -N -f -Z <mingw_headers.patch 156cdf0e10cSrcweir $(TOUCH) $(MISC)$/mingwheader_patch 157cdf0e10cSrcweir 158cdf0e10cSrcweir.IF "$(DISABLE_ATL)"=="" 159cdf0e10cSrcweir$(MINGWHEADER_ATL_PATCH_TARGET) : $(MINGWHEADER_ATL_COPY_TARGET) 160cdf0e10cSrcweir patch -bd $(MISC)$/mingw -p0 -N -f -Z <mingw_atl_headers.patch 161cdf0e10cSrcweir $(TOUCH) $(MINGWHEADER_ATL_PATCH_TARGET) 162cdf0e10cSrcweir.ENDIF 163cdf0e10cSrcweir 164cdf0e10cSrcweir$(MISC)$/mingwheader_copy: 165cdf0e10cSrcweir $(MKDIRHIER) $(MISC)$/mingw$/include 166cdf0e10cSrcweir $(MKDIRHIER) $(MISC)$/mingw$/include/sys 167cdf0e10cSrcweir $(COPY) $(FILES_TO_COPY_FROM_MINGW:^$(MINGW_INCLUDE_DIR)) $(MISC)$/mingw$/include 168cdf0e10cSrcweir $(COPY) $(FILES_TO_COPY_FROM_W32API:^$(MINGW_W32API_INCLUDE_DIR)) $(MISC)$/mingw$/include 169cdf0e10cSrcweir $(COPY) $(FILES_TO_COPY_FROM_SYS:^$(SYS_INCLUDE_DIR)) $(MISC)$/mingw$/include$/sys 170cdf0e10cSrcweir $(COPY) $(FILES_TO_COPY_FROM_PSDK:^$(PSDK_INCLUDE_DIR)) $(MISC)$/mingw$/include 171cdf0e10cSrcweir $(COPY) $(FILES_TO_COPY_FROM_DIRECTXSDK:^$(DIRECTXSDK_INCLUDE_DIR)) $(MISC)$/mingw$/include 172cdf0e10cSrcweir $(TOUCH) $(MISC)$/mingwheader_copy 173cdf0e10cSrcweir 174cdf0e10cSrcweir.IF "$(DISABLE_ATL)"=="" 175cdf0e10cSrcweir$(MINGWHEADER_ATL_COPY_TARGET): 176cdf0e10cSrcweir $(MKDIRHIER) $(MISC)$/mingw$/include/atl 177cdf0e10cSrcweir $(COPY) $(FILES_TO_COPY_FROM_ATL:^$(ATL_INCLUDE_DIR)) $(MISC)$/mingw$/include$/atl 178cdf0e10cSrcweir $(TOUCH) $(MINGWHEADER_ATL_COPY_TARGET) 179cdf0e10cSrcweir.ENDIF 180cdf0e10cSrcweir 181cdf0e10cSrcweir$(LB)$/libmsvcrt.a: 182cdf0e10cSrcweir.IF "$(USE_MINGW)" == "cygwin" 183cdf0e10cSrcweir $(COPY) $(COMPATH)$/lib/mingw/libmsvcrt.a $(LB)$/libmsvcrt_orig.a 184cdf0e10cSrcweir.ELSE 185cdf0e10cSrcweir $(COPY) $(COMPATH)$/lib/libmsvcrt.a $(LB)$/libmsvcrt_orig.a 186cdf0e10cSrcweir.ENDIF 187cdf0e10cSrcweir cd $(LB) && ar -x libmsvcrt_orig.a ofmt_stub.o 188cdf0e10cSrcweir ar -d $(LB)$/libmsvcrt_orig.a ofmt_stub.o 189cdf0e10cSrcweir nm -g --defined-only $(LB)$/libmsvcrt_orig.a > $(MISC)$/msvcrt.nm 190cdf0e10cSrcweir echo EXPORTS > $(MISC)$/msvcrt.def 191cdf0e10cSrcweir sed -ne 's/.* T _//p' $(MISC)$/msvcrt.nm | sort >> $(MISC)$/msvcrt.def 192cdf0e10cSrcweir -sed -ne 's/.* I __imp__//p' $(MISC)$/msvcrt.nm | sort | diff - $(MISC)$/msvcrt.def | \ 193cdf0e10cSrcweir sed -ne 's/^< \(.*\)$/\1 DATA/p' > $(MISC)$/msvcrtdata.def 194cdf0e10cSrcweir cat $(MISC)$/msvcrtdata.def >> $(MISC)$/msvcrt.def 195cdf0e10cSrcweir dlltool --dllname msvcrt.dll --input-def=$(MISC)$/msvcrt.def --kill-at --output-lib=$(LB)$/libmsvcrt.a 196cdf0e10cSrcweir cd $(LB) && ar -rs libmsvcrt.a ofmt_stub.o 197cdf0e10cSrcweir 198cdf0e10cSrcweirclean: 199cdf0e10cSrcweir -$(RM) $(MISC)$/mingw$/include$/*.h 200cdf0e10cSrcweir -$(RM) $(MISC)$/mingwheader_copy 201cdf0e10cSrcweir -$(RM) $(MISC)$/mingwheader_patch 202cdf0e10cSrcweir 203cdf0e10cSrcweir.ENDIF 204cdf0e10cSrcweir 205cdf0e10cSrcweir.INCLUDE : target.mk 206cdf0e10cSrcweir 207