xref: /aoo4110/main/python/makefile.mk (revision b1cdbd2c)
1*b1cdbd2cSJim Jagielski#**************************************************************
2*b1cdbd2cSJim Jagielski#
3*b1cdbd2cSJim Jagielski#  Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski#  or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski#  distributed with this work for additional information
6*b1cdbd2cSJim Jagielski#  regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski#  to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski#  "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski#  with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski#
11*b1cdbd2cSJim Jagielski#    http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski#
13*b1cdbd2cSJim Jagielski#  Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski#  software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski#  KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski#  specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski#  under the License.
19*b1cdbd2cSJim Jagielski#
20*b1cdbd2cSJim Jagielski#**************************************************************
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim JagielskiPRJ=.
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim JagielskiPRJNAME=so_python
27*b1cdbd2cSJim JagielskiTARGET=so_python
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski# --- Settings -----------------------------------------------------
30*b1cdbd2cSJim Jagielski
31*b1cdbd2cSJim Jagielski.INCLUDE :	settings.mk
32*b1cdbd2cSJim Jagielski.INCLUDE :      pyversion.mk
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski.IF "$(SYSTEM_PYTHON)" == "YES"
35*b1cdbd2cSJim Jagielskiall:
36*b1cdbd2cSJim Jagielski	@echo "An already available installation of python should exist on your system."
37*b1cdbd2cSJim Jagielski	@echo "Therefore the version provided here does not need to be built in addition."
38*b1cdbd2cSJim Jagielski.ENDIF
39*b1cdbd2cSJim Jagielski
40*b1cdbd2cSJim Jagielski
41*b1cdbd2cSJim Jagielski# --- Files --------------------------------------------------------
42*b1cdbd2cSJim Jagielski
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim JagielskiTARFILE_NAME=Python-$(PYVERSION)
45*b1cdbd2cSJim JagielskiTARFILE_MD5=38c84292658ed4456157195f1c9bcbe1
46*b1cdbd2cSJim JagielskiPATCH_FILES=\
47*b1cdbd2cSJim Jagielski	python-solaris.patch \
48*b1cdbd2cSJim Jagielski	python-freebsd.patch \
49*b1cdbd2cSJim Jagielski	python-md5.patch \
50*b1cdbd2cSJim Jagielski	python-ssl.patch \
51*b1cdbd2cSJim Jagielski	python-solver-before-std.patch \
52*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-sysbase.patch \
53*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-nohardlink.patch
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski.IF "$(GUI)"=="WNT"
56*b1cdbd2cSJim Jagielski.IF "$(CPUNAME)"=="INTEL"
57*b1cdbd2cSJim JagielskiPATCH_FILES += python-$(PYVERSION)-msvs9.patch
58*b1cdbd2cSJim Jagielski.ELIF "$(CPUNAME)"=="X86_64"
59*b1cdbd2cSJim JagielskiPATCH_FILES += \
60*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-msvs9-win64.patch \
61*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-msvs9-win64-target.patch \
62*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-msvs9-subsystem.patch \
63*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-msvs9-dir.patch \
64*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-msvs9-no-host-python.patch \
65*b1cdbd2cSJim Jagielski	python-$(PYVERSION)-msvs9-python-path.patch
66*b1cdbd2cSJim Jagielski.ENDIF
67*b1cdbd2cSJim Jagielski.ENDIF
68*b1cdbd2cSJim Jagielski
69*b1cdbd2cSJim JagielskiCONFIGURE_DIR=
70*b1cdbd2cSJim Jagielski
71*b1cdbd2cSJim Jagielski.IF "$(GUI)"=="UNX"
72*b1cdbd2cSJim JagielskiBUILD_DIR=
73*b1cdbd2cSJim JagielskiMYCWD=$(shell @pwd)/$(INPATH)/misc/build
74*b1cdbd2cSJim Jagielski
75*b1cdbd2cSJim Jagielski# CLFLAGS get overwritten in Makefile.pre.in
76*b1cdbd2cSJim Jagielski.IF "$(SYSBASE)"!=""
77*b1cdbd2cSJim JagielskiCC+:=-I$(SYSBASE)$/usr$/include
78*b1cdbd2cSJim Jagielskipython_LDFLAGS+=-L$(SYSBASE)/usr/lib
79*b1cdbd2cSJim Jagielski.IF "$(COMNAME)"=="sunpro5"
80*b1cdbd2cSJim JagielskiCC+:=$(C_RESTRICTIONFLAGS)
81*b1cdbd2cSJim Jagielski.ENDIF			# "$(COMNAME)"=="sunpro5"
82*b1cdbd2cSJim Jagielski.ENDIF			# "$(SYSBASE)"!=""
83*b1cdbd2cSJim Jagielski
84*b1cdbd2cSJim Jagielski.IF "$(OS)$(CPU)"=="SOLARISU"
85*b1cdbd2cSJim JagielskiCC+:=$(ARCH_FLAGS)
86*b1cdbd2cSJim Jagielskipython_LDFLAGS+=$(ARCH_FLAGS)
87*b1cdbd2cSJim Jagielski.ENDIF
88*b1cdbd2cSJim Jagielski
89*b1cdbd2cSJim JagielskiCONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
90*b1cdbd2cSJim Jagielski.IF "$(OS)$(CPU)" == "SOLARISI"
91*b1cdbd2cSJim JagielskiCONFIGURE_ACTION += --disable-ipv6
92*b1cdbd2cSJim Jagielski.ENDIF
93*b1cdbd2cSJim JagielskiBUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
94*b1cdbd2cSJim Jagielski.ELSE
95*b1cdbd2cSJim Jagielski# ----------------------------------
96*b1cdbd2cSJim Jagielski# WINDOWS
97*b1cdbd2cSJim Jagielski# ----------------------------------
98*b1cdbd2cSJim Jagielski.IF "$(COM)"=="GCC"
99*b1cdbd2cSJim Jagielski#PATCH_FILES=python-$(PYVERSION)-mingw.patch
100*b1cdbd2cSJim JagielskiBUILD_DIR=
101*b1cdbd2cSJim JagielskiMYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
102*b1cdbd2cSJim Jagielskipython_CFLAGS=-mno-cygwin -mthreads
103*b1cdbd2cSJim Jagielskipython_LDFLAGS=-mno-cygwin -mthreads
104*b1cdbd2cSJim Jagielski.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
105*b1cdbd2cSJim Jagielskipython_LDFLAGS+=-shared-libgcc
106*b1cdbd2cSJim Jagielski.ENDIF
107*b1cdbd2cSJim Jagielskipython_LDFLAGS+=-shared-libgcc -Wl,--enable-runtime-pseudo-reloc-v2
108*b1cdbd2cSJim JagielskiCONFIGURE_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)"
109*b1cdbd2cSJim JagielskiBUILD_ACTION=$(ENV_BUILD) make && make install
110*b1cdbd2cSJim Jagielski.ELSE
111*b1cdbd2cSJim Jagielski#PYTHONPATH:=..$/Lib
112*b1cdbd2cSJim Jagielski#.EXPORT : PYTHONPATH
113*b1cdbd2cSJim Jagielski
114*b1cdbd2cSJim Jagielski#.IF "$(CCNUMVER)" <= "001400000000"
115*b1cdbd2cSJim Jagielski#EXFLAGS="/GX /YX"
116*b1cdbd2cSJim Jagielski#.ELSE
117*b1cdbd2cSJim Jagielski#.IF "$(WINDOWS_VISTA_PSDK)"!=""
118*b1cdbd2cSJim Jagielski#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
119*b1cdbd2cSJim Jagielski#ADDITIONALLIBS=ws2_32.lib
120*b1cdbd2cSJim Jagielski#.ELSE  #"$(WINDOWS_VISTA_PSDK)"!=""
121*b1cdbd2cSJim Jagielski#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
122*b1cdbd2cSJim Jagielski#.ENDIF #"$(WINDOWS_VISTA_PSDK)"!=""
123*b1cdbd2cSJim Jagielski#.ENDIF
124*b1cdbd2cSJim Jagielski
125*b1cdbd2cSJim Jagielski# Requires adapting for according to the MSVC compiler version.
126*b1cdbd2cSJim Jagielski# Normally PCBuild will carry the latest supported build files.
127*b1cdbd2cSJim JagielskiBUILD_DIR=PC/VS9.0
128*b1cdbd2cSJim Jagielski
129*b1cdbd2cSJim Jagielski# Build python executable and then runs a minimal script. Running the minimal script
130*b1cdbd2cSJim Jagielski# ensures that certain *.pyc files are generated which would otherwise be created on
131*b1cdbd2cSJim Jagielski# solver during registration in insetoo_native
132*b1cdbd2cSJim Jagielski.IF "$(CPUNAME)"=="INTEL"
133*b1cdbd2cSJim JagielskiBUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|Win32"
134*b1cdbd2cSJim Jagielski.ELIF "$(CPUNAME)"=="X86_64"
135*b1cdbd2cSJim JagielskiBUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|x64"
136*b1cdbd2cSJim Jagielski.ENDIF
137*b1cdbd2cSJim Jagielski.ENDIF
138*b1cdbd2cSJim Jagielski.ENDIF
139*b1cdbd2cSJim Jagielski
140*b1cdbd2cSJim JagielskiPYVERSIONFILE=$(MISC)$/pyversion.mk
141*b1cdbd2cSJim Jagielski
142*b1cdbd2cSJim Jagielski# --- Targets ------------------------------------------------------
143*b1cdbd2cSJim Jagielski
144*b1cdbd2cSJim Jagielski
145*b1cdbd2cSJim Jagielski.INCLUDE : set_ext.mk
146*b1cdbd2cSJim Jagielski.INCLUDE : target.mk
147*b1cdbd2cSJim Jagielski.INCLUDE : tg_ext.mk
148*b1cdbd2cSJim Jagielski
149*b1cdbd2cSJim Jagielski.IF "$(L10N_framework)"==""
150*b1cdbd2cSJim Jagielski.IF "$(GUI)" != "UNX"
151*b1cdbd2cSJim Jagielski.IF "$(COM)"!="GCC"
152*b1cdbd2cSJim JagielskiPYCONFIG:=$(MISC)$/build$/pyconfig.h
153*b1cdbd2cSJim Jagielski$(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h : $(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE)
154*b1cdbd2cSJim Jagielski
155*b1cdbd2cSJim Jagielski$(PACKAGE_DIR)$/$(BUILD_FLAG_FILE) : $(PYCONFIG)
156*b1cdbd2cSJim Jagielski
157*b1cdbd2cSJim Jagielski$(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
158*b1cdbd2cSJim Jagielski	-rm -f $@
159*b1cdbd2cSJim Jagielski	cat $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h > $@
160*b1cdbd2cSJim Jagielski.ENDIF
161*b1cdbd2cSJim Jagielski.ENDIF
162*b1cdbd2cSJim Jagielski
163*b1cdbd2cSJim JagielskiALLTAR : $(PYVERSIONFILE)
164*b1cdbd2cSJim Jagielski.ENDIF          # "$(L10N_framework)"==""
165*b1cdbd2cSJim Jagielski
166*b1cdbd2cSJim Jagielski
167*b1cdbd2cSJim Jagielski$(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
168*b1cdbd2cSJim Jagielski	-rm -f $@
169*b1cdbd2cSJim Jagielski	cat $? > $@
170