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