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