xref: /trunk/main/python/makefile.mk (revision 20601043)
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=17add4bf0ad0ec2f08e0cae6d205c700
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	python-$(PYVERSION)-pcbuild.patch
55
56CONFIGURE_DIR=
57
58.IF "$(GUI)"=="UNX"
59BUILD_DIR=
60MYCWD=$(shell @pwd)/$(INPATH)/misc/build
61
62# CLFLAGS get overwritten in Makefile.pre.in
63.IF "$(SYSBASE)"!=""
64CC+:=-I$(SYSBASE)$/usr$/include
65python_LDFLAGS+=-L$(SYSBASE)/usr/lib
66.IF "$(COMNAME)"=="sunpro5"
67CC+:=$(C_RESTRICTIONFLAGS)
68.ENDIF			# "$(COMNAME)"=="sunpro5"
69.ENDIF			# "$(SYSBASE)"!=""
70
71.IF "$(OS)$(CPU)"=="SOLARISU"
72CC+:=$(ARCH_FLAGS)
73python_LDFLAGS+=$(ARCH_FLAGS)
74.ENDIF
75
76CONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
77.IF "$(OS)$(CPU)" == "SOLARISI"
78CONFIGURE_ACTION += --disable-ipv6
79.ENDIF
80BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
81.ELSE
82# ----------------------------------
83# WINDOWS
84# ----------------------------------
85.IF "$(COM)"=="GCC"
86PATCH_FILES=python-$(PYVERSION)-mingw.patch
87BUILD_DIR=
88MYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
89python_CFLAGS=-mno-cygwin -mthreads
90python_LDFLAGS=-mno-cygwin -mthreads
91.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
92python_LDFLAGS+=-shared-libgcc
93.ENDIF
94python_LDFLAGS+=-shared-libgcc -Wl,--enable-runtime-pseudo-reloc-v2
95CONFIGURE_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)"
96BUILD_ACTION=$(ENV_BUILD) make && make install
97.ELSE
98#PYTHONPATH:=..$/Lib
99#.EXPORT : PYTHONPATH
100
101#.IF "$(CCNUMVER)" <= "001400000000"
102#EXFLAGS="/GX /YX"
103#.ELSE
104#.IF "$(WINDOWS_VISTA_PSDK)"!=""
105#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
106#ADDITIONALLIBS=ws2_32.lib
107#.ELSE  #"$(WINDOWS_VISTA_PSDK)"!=""
108#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
109#.ENDIF #"$(WINDOWS_VISTA_PSDK)"!=""
110#.ENDIF
111
112# Requires adapting for according to the MSVC compiler version.
113# Normally PCBuild will carry the latest supported build files.
114BUILD_DIR=PC/VS9.0
115
116# Build python executable and then runs a minimal script. Running the minimal script
117# ensures that certain *.pyc files are generated which would otherwise be created on
118# solver during registration in insetoo_native
119BUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|Win32"
120.ENDIF
121.ENDIF
122
123PYVERSIONFILE=$(MISC)$/pyversion.mk
124
125# --- Targets ------------------------------------------------------
126
127
128.INCLUDE : set_ext.mk
129.INCLUDE : target.mk
130.INCLUDE : tg_ext.mk
131
132.IF "$(L10N_framework)"==""
133.IF "$(GUI)" != "UNX"
134.IF "$(COM)"!="GCC"
135PYCONFIG:=$(MISC)$/build$/pyconfig.h
136$(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h : $(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE)
137
138$(PACKAGE_DIR)$/$(BUILD_FLAG_FILE) : $(PYCONFIG)
139
140$(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
141	-rm -f $@
142	cat $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h > $@
143.ENDIF
144.ENDIF
145
146ALLTAR : $(PYVERSIONFILE)
147.ENDIF          # "$(L10N_framework)"==""
148
149
150$(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
151	-rm -f $@
152	cat $? > $@
153
154