xref: /trunk/main/python/makefile.mk (revision 31bbceb0f9d64c0c2c3b22a794a1666c1f33396e)
17871dc3eSAndrew Rist#**************************************************************
2cdf0e10cSrcweir#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
19cdf0e10cSrcweir#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweirPRJ=.
25cdf0e10cSrcweir
26cdf0e10cSrcweirPRJNAME=so_python
27cdf0e10cSrcweirTARGET=so_python
28cdf0e10cSrcweir
29cdf0e10cSrcweir# --- Settings -----------------------------------------------------
30cdf0e10cSrcweir
31cdf0e10cSrcweir.INCLUDE :  settings.mk
321c25f252Sdamjan.INCLUDE :      pyversion_dmake.mk
33cdf0e10cSrcweir
34cdf0e10cSrcweir.IF "$(SYSTEM_PYTHON)" == "YES"
35cdf0e10cSrcweirall:
36cdf0e10cSrcweir    @echo "An already available installation of python should exist on your system."
37cdf0e10cSrcweir    @echo "Therefore the version provided here does not need to be built in addition."
38cdf0e10cSrcweir.ENDIF
39cdf0e10cSrcweir
40cdf0e10cSrcweir
41cdf0e10cSrcweir# --- Files --------------------------------------------------------
42cdf0e10cSrcweir
43cdf0e10cSrcweir
44cdf0e10cSrcweirTARFILE_NAME=Python-$(PYVERSION)
45*26aca12fSDon LewisTARFILE_MD5=38c84292658ed4456157195f1c9bcbe1
46cdf0e10cSrcweirPATCH_FILES=\
47d55fe0f2SPedro Giffuni    python-solaris.patch \
480a45483eSPedro Giffuni    python-freebsd.patch \
490a45483eSPedro Giffuni    python-md5.patch \
500a45483eSPedro Giffuni    python-ssl.patch \
5159dd616dSHerbert Dürr    python-solver-before-std.patch \
520a45483eSPedro Giffuni    python-$(PYVERSION)-sysbase.patch \
5339616696SDamjan Jovanovic    python-$(PYVERSION)-nohardlink.patch
5439616696SDamjan Jovanovic
5539616696SDamjan Jovanovic.IF "$(GUI)"=="WNT"
5639616696SDamjan Jovanovic.IF "$(CPUNAME)"=="INTEL"
57f3053659SPedro GiffuniPATCH_FILES += python-$(PYVERSION)-msvs9.patch
5839616696SDamjan Jovanovic.ELIF "$(CPUNAME)"=="X86_64"
5939616696SDamjan JovanovicPATCH_FILES += \
60f3053659SPedro Giffuni    python-$(PYVERSION)-msvs9-win64.patch \
61f3053659SPedro Giffuni    python-$(PYVERSION)-msvs9-win64-target.patch \
62f3053659SPedro Giffuni    python-$(PYVERSION)-msvs9-subsystem.patch \
63f3053659SPedro Giffuni    python-$(PYVERSION)-msvs9-dir.patch \
64f3053659SPedro Giffuni    python-$(PYVERSION)-msvs9-no-host-python.patch \
65f3053659SPedro Giffuni    python-$(PYVERSION)-msvs9-python-path.patch
6639616696SDamjan Jovanovic.ENDIF
6739616696SDamjan Jovanovic.ENDIF
68cdf0e10cSrcweir
69cdf0e10cSrcweirCONFIGURE_DIR=
70cdf0e10cSrcweir
71cdf0e10cSrcweir.IF "$(GUI)"=="UNX"
72cdf0e10cSrcweirBUILD_DIR=
73cdf0e10cSrcweirMYCWD=$(shell @pwd)/$(INPATH)/misc/build
74cdf0e10cSrcweir
75cdf0e10cSrcweir# CLFLAGS get overwritten in Makefile.pre.in
76cdf0e10cSrcweir.IF "$(SYSBASE)"!=""
77cdf0e10cSrcweirCC+:=-I$(SYSBASE)$/usr$/include
78cdf0e10cSrcweirpython_LDFLAGS+=-L$(SYSBASE)/usr/lib
79cdf0e10cSrcweir.IF "$(COMNAME)"=="sunpro5"
80cdf0e10cSrcweirCC+:=$(C_RESTRICTIONFLAGS)
81cdf0e10cSrcweir.ENDIF          # "$(COMNAME)"=="sunpro5"
82cdf0e10cSrcweir.ENDIF          # "$(SYSBASE)"!=""
83cdf0e10cSrcweir
84cdf0e10cSrcweir.IF "$(OS)$(CPU)"=="SOLARISU"
85cdf0e10cSrcweirCC+:=$(ARCH_FLAGS)
86cdf0e10cSrcweirpython_LDFLAGS+=$(ARCH_FLAGS)
87cdf0e10cSrcweir.ENDIF
88cdf0e10cSrcweir
89cdf0e10cSrcweirCONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
90cdf0e10cSrcweir.IF "$(OS)$(CPU)" == "SOLARISI"
91cdf0e10cSrcweirCONFIGURE_ACTION += --disable-ipv6
92cdf0e10cSrcweir.ENDIF
93cdf0e10cSrcweirBUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
94cdf0e10cSrcweir.ELSE
95cdf0e10cSrcweir# ----------------------------------
96cdf0e10cSrcweir# WINDOWS
97cdf0e10cSrcweir# ----------------------------------
98cdf0e10cSrcweir.IF "$(COM)"=="GCC"
997cdbaf76SPedro Giffuni#PATCH_FILES=python-$(PYVERSION)-mingw.patch
100cdf0e10cSrcweirBUILD_DIR=
101cdf0e10cSrcweirMYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
102cdf0e10cSrcweirpython_CFLAGS=-mno-cygwin -mthreads
103cdf0e10cSrcweirpython_LDFLAGS=-mno-cygwin -mthreads
104cdf0e10cSrcweir.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
105cdf0e10cSrcweirpython_LDFLAGS+=-shared-libgcc
106cdf0e10cSrcweir.ENDIF
107cdf0e10cSrcweirpython_LDFLAGS+=-shared-libgcc -Wl,--enable-runtime-pseudo-reloc-v2
108cdf0e10cSrcweirCONFIGURE_ACTION=./configure --prefix=$(MYCWD)/python-inst --enable-shared CC="$(CC:s/guw.exe //)" CXX="$(CXX:s/guw.exe //)" MACHDEP=MINGW32 LN="cp -p" CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
109cdf0e10cSrcweirBUILD_ACTION=$(ENV_BUILD) make && make install
110cdf0e10cSrcweir.ELSE
111cdf0e10cSrcweir#PYTHONPATH:=..$/Lib
112cdf0e10cSrcweir#.EXPORT : PYTHONPATH
113cdf0e10cSrcweir
114cdf0e10cSrcweir#.IF "$(CCNUMVER)" <= "001400000000"
115cdf0e10cSrcweir#EXFLAGS="/GX /YX"
116cdf0e10cSrcweir#.ELSE
117cdf0e10cSrcweir#.IF "$(WINDOWS_VISTA_PSDK)"!=""
118cdf0e10cSrcweir#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
119cdf0e10cSrcweir#ADDITIONALLIBS=ws2_32.lib
120cdf0e10cSrcweir#.ELSE  #"$(WINDOWS_VISTA_PSDK)"!=""
121cdf0e10cSrcweir#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
122cdf0e10cSrcweir#.ENDIF #"$(WINDOWS_VISTA_PSDK)"!=""
123cdf0e10cSrcweir#.ENDIF
124cdf0e10cSrcweir
1253352667fSpfg# Requires adapting for according to the MSVC compiler version.
1263352667fSpfg# Normally PCBuild will carry the latest supported build files.
1273352667fSpfgBUILD_DIR=PC/VS9.0
128cdf0e10cSrcweir
129cdf0e10cSrcweir# Build python executable and then runs a minimal script. Running the minimal script
130cdf0e10cSrcweir# ensures that certain *.pyc files are generated which would otherwise be created on
131cdf0e10cSrcweir# solver during registration in insetoo_native
13239616696SDamjan Jovanovic.IF "$(CPUNAME)"=="INTEL"
133cdf0e10cSrcweirBUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|Win32"
13439616696SDamjan Jovanovic.ELIF "$(CPUNAME)"=="X86_64"
13539616696SDamjan JovanovicBUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|x64"
13639616696SDamjan Jovanovic.ENDIF
137cdf0e10cSrcweir.ENDIF
138cdf0e10cSrcweir.ENDIF
139cdf0e10cSrcweir
1401c25f252SdamjanPYVERSIONFILE_DMAKE=$(MISC)$/pyversion_dmake.mk
141cdf0e10cSrcweirPYVERSIONFILE=$(MISC)$/pyversion.mk
142cdf0e10cSrcweir
143cdf0e10cSrcweir# --- Targets ------------------------------------------------------
144cdf0e10cSrcweir
145cdf0e10cSrcweir
146cdf0e10cSrcweir.INCLUDE : set_ext.mk
147cdf0e10cSrcweir.INCLUDE : target.mk
148cdf0e10cSrcweir.INCLUDE : tg_ext.mk
149cdf0e10cSrcweir
150cdf0e10cSrcweir.IF "$(L10N_framework)"==""
151cdf0e10cSrcweir.IF "$(GUI)" != "UNX"
152cdf0e10cSrcweir.IF "$(COM)"!="GCC"
153cdf0e10cSrcweirPYCONFIG:=$(MISC)$/build$/pyconfig.h
154cdf0e10cSrcweir$(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h : $(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE)
155cdf0e10cSrcweir
156cdf0e10cSrcweir$(PACKAGE_DIR)$/$(BUILD_FLAG_FILE) : $(PYCONFIG)
157cdf0e10cSrcweir
158cdf0e10cSrcweir$(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
159cdf0e10cSrcweir    -rm -f $@
160cdf0e10cSrcweir    cat $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h > $@
161cdf0e10cSrcweir.ENDIF
162cdf0e10cSrcweir.ENDIF
163cdf0e10cSrcweir
1641c25f252SdamjanALLTAR : $(PYVERSIONFILE_DMAKE) $(PYVERSIONFILE)
165cdf0e10cSrcweir.ENDIF          # "$(L10N_framework)"==""
166cdf0e10cSrcweir
167cdf0e10cSrcweir
1681c25f252Sdamjan$(PYVERSIONFILE_DMAKE) : pyversion_dmake.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
1691c25f252Sdamjan    -rm -f $@
1701c25f252Sdamjan    cat $? > $@
1711c25f252Sdamjan
172cdf0e10cSrcweir$(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
173cdf0e10cSrcweir    -rm -f $@
174cdf0e10cSrcweir    cat $? > $@
175