xref: /aoo4110/main/python/makefile.mk (revision b1cdbd2c)
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
24PRJ=.
25
26PRJNAME=so_python
27TARGET=so_python
28
29# --- Settings -----------------------------------------------------
30
31.INCLUDE :	settings.mk
32.INCLUDE :      pyversion.mk
33
34.IF "$(SYSTEM_PYTHON)" == "YES"
35all:
36	@echo "An already available installation of python should exist on your system."
37	@echo "Therefore the version provided here does not need to be built in addition."
38.ENDIF
39
40
41# --- Files --------------------------------------------------------
42
43
44TARFILE_NAME=Python-$(PYVERSION)
45TARFILE_MD5=38c84292658ed4456157195f1c9bcbe1
46PATCH_FILES=\
47	python-solaris.patch \
48	python-freebsd.patch \
49	python-md5.patch \
50	python-ssl.patch \
51	python-solver-before-std.patch \
52	python-$(PYVERSION)-sysbase.patch \
53	python-$(PYVERSION)-nohardlink.patch
54
55.IF "$(GUI)"=="WNT"
56.IF "$(CPUNAME)"=="INTEL"
57PATCH_FILES += python-$(PYVERSION)-msvs9.patch
58.ELIF "$(CPUNAME)"=="X86_64"
59PATCH_FILES += \
60	python-$(PYVERSION)-msvs9-win64.patch \
61	python-$(PYVERSION)-msvs9-win64-target.patch \
62	python-$(PYVERSION)-msvs9-subsystem.patch \
63	python-$(PYVERSION)-msvs9-dir.patch \
64	python-$(PYVERSION)-msvs9-no-host-python.patch \
65	python-$(PYVERSION)-msvs9-python-path.patch
66.ENDIF
67.ENDIF
68
69CONFIGURE_DIR=
70
71.IF "$(GUI)"=="UNX"
72BUILD_DIR=
73MYCWD=$(shell @pwd)/$(INPATH)/misc/build
74
75# CLFLAGS get overwritten in Makefile.pre.in
76.IF "$(SYSBASE)"!=""
77CC+:=-I$(SYSBASE)$/usr$/include
78python_LDFLAGS+=-L$(SYSBASE)/usr/lib
79.IF "$(COMNAME)"=="sunpro5"
80CC+:=$(C_RESTRICTIONFLAGS)
81.ENDIF			# "$(COMNAME)"=="sunpro5"
82.ENDIF			# "$(SYSBASE)"!=""
83
84.IF "$(OS)$(CPU)"=="SOLARISU"
85CC+:=$(ARCH_FLAGS)
86python_LDFLAGS+=$(ARCH_FLAGS)
87.ENDIF
88
89CONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
90.IF "$(OS)$(CPU)" == "SOLARISI"
91CONFIGURE_ACTION += --disable-ipv6
92.ENDIF
93BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
94.ELSE
95# ----------------------------------
96# WINDOWS
97# ----------------------------------
98.IF "$(COM)"=="GCC"
99#PATCH_FILES=python-$(PYVERSION)-mingw.patch
100BUILD_DIR=
101MYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
102python_CFLAGS=-mno-cygwin -mthreads
103python_LDFLAGS=-mno-cygwin -mthreads
104.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
105python_LDFLAGS+=-shared-libgcc
106.ENDIF
107python_LDFLAGS+=-shared-libgcc -Wl,--enable-runtime-pseudo-reloc-v2
108CONFIGURE_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)"
109BUILD_ACTION=$(ENV_BUILD) make && make install
110.ELSE
111#PYTHONPATH:=..$/Lib
112#.EXPORT : PYTHONPATH
113
114#.IF "$(CCNUMVER)" <= "001400000000"
115#EXFLAGS="/GX /YX"
116#.ELSE
117#.IF "$(WINDOWS_VISTA_PSDK)"!=""
118#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
119#ADDITIONALLIBS=ws2_32.lib
120#.ELSE  #"$(WINDOWS_VISTA_PSDK)"!=""
121#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
122#.ENDIF #"$(WINDOWS_VISTA_PSDK)"!=""
123#.ENDIF
124
125# Requires adapting for according to the MSVC compiler version.
126# Normally PCBuild will carry the latest supported build files.
127BUILD_DIR=PC/VS9.0
128
129# Build python executable and then runs a minimal script. Running the minimal script
130# ensures that certain *.pyc files are generated which would otherwise be created on
131# solver during registration in insetoo_native
132.IF "$(CPUNAME)"=="INTEL"
133BUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|Win32"
134.ELIF "$(CPUNAME)"=="X86_64"
135BUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|x64"
136.ENDIF
137.ENDIF
138.ENDIF
139
140PYVERSIONFILE=$(MISC)$/pyversion.mk
141
142# --- Targets ------------------------------------------------------
143
144
145.INCLUDE : set_ext.mk
146.INCLUDE : target.mk
147.INCLUDE : tg_ext.mk
148
149.IF "$(L10N_framework)"==""
150.IF "$(GUI)" != "UNX"
151.IF "$(COM)"!="GCC"
152PYCONFIG:=$(MISC)$/build$/pyconfig.h
153$(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h : $(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE)
154
155$(PACKAGE_DIR)$/$(BUILD_FLAG_FILE) : $(PYCONFIG)
156
157$(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
158	-rm -f $@
159	cat $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h > $@
160.ENDIF
161.ENDIF
162
163ALLTAR : $(PYVERSIONFILE)
164.ENDIF          # "$(L10N_framework)"==""
165
166
167$(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
168	-rm -f $@
169	cat $? > $@
170