xref: /aoo41x/main/python/makefile.mk (revision 82f0e0ac)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28PRJ=.
29
30PRJNAME=so_python
31TARGET=so_python
32
33# --- Settings -----------------------------------------------------
34
35.INCLUDE :	settings.mk
36.INCLUDE :      pyversion.mk
37
38.IF "$(SYSTEM_PYTHON)" == "YES"
39all:
40	@echo "An already available installation of python should exist on your system."
41	@echo "Therefore the version provided here does not need to be built in addition."
42.ENDIF
43
44
45# --- Files --------------------------------------------------------
46
47
48TARFILE_NAME=Python-$(PYVERSION)
49TARFILE_MD5=e81c2f0953aa60f8062c05a4673f2be0
50PATCH_FILES=\
51	Python-$(PYVERSION).patch \
52	Python-parallel-make.patch \
53	Python-ssl.patch \
54    Python-2.6.1-sysbase.patch\
55	Python-2.6.1-nohardlink.patch \
56	Python-disable-dbm.patch \
57	Python-linux3.patch
58
59CONFIGURE_DIR=
60
61.IF "$(GUI)"=="UNX"
62BUILD_DIR=
63MYCWD=$(shell @pwd)/$(INPATH)/misc/build
64
65# CLFLAGS get overwritten in Makefile.pre.in
66.IF "$(SYSBASE)"!=""
67CC+:=-I$(SYSBASE)$/usr$/include
68python_LDFLAGS+=-L$(SYSBASE)/usr/lib
69.IF "$(COMNAME)"=="sunpro5"
70CC+:=$(C_RESTRICTIONFLAGS)
71.ENDIF			# "$(COMNAME)"=="sunpro5"
72.ENDIF			# "$(SYSBASE)"!=""
73
74.IF "$(OS)$(CPU)"=="SOLARISU"
75CC+:=$(ARCH_FLAGS)
76python_LDFLAGS+=$(ARCH_FLAGS)
77.ENDIF
78
79CONFIGURE_ACTION=$(AUGMENT_LIBRARY_PATH) ./configure --prefix=$(MYCWD)/python-inst --enable-shared CFLAGS="$(python_CFLAGS)" LDFLAGS="$(python_LDFLAGS)"
80.IF "$(OS)$(CPU)" == "SOLARISI"
81CONFIGURE_ACTION += --disable-ipv6
82.ENDIF
83BUILD_ACTION=$(ENV_BUILD) $(GNUMAKE) -j$(EXTMAXPROCESS) && $(GNUMAKE) install && chmod -R ug+w $(MYCWD)/python-inst && chmod g+w Include
84.ELSE
85# ----------------------------------
86# WINDOWS
87# ----------------------------------
88.IF "$(COM)"=="GCC"
89PATCH_FILES=Python-$(PYVERSION)-mingw.patch
90BUILD_DIR=
91MYCWD=$(shell cygpath -m $(shell @pwd))/$(INPATH)/misc/build
92python_CFLAGS=-mno-cygwin -mthreads
93python_LDFLAGS=-mno-cygwin -mthreads
94.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
95python_LDFLAGS+=-shared-libgcc
96.ENDIF
97python_LDFLAGS+=-shared-libgcc -Wl,--enable-runtime-pseudo-reloc-v2
98CONFIGURE_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)"
99BUILD_ACTION=$(ENV_BUILD) make && make install
100.ELSE
101#PYTHONPATH:=..$/Lib
102#.EXPORT : PYTHONPATH
103
104#.IF "$(CCNUMVER)" <= "001400000000"
105#EXFLAGS="/GX /YX"
106#.ELSE
107#.IF "$(WINDOWS_VISTA_PSDK)"!=""
108#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
109#ADDITIONALLIBS=ws2_32.lib
110#.ELSE  #"$(WINDOWS_VISTA_PSDK)"!=""
111#EXFLAGS="/EHa /Zc:wchar_t- /D "_CRT_SECURE_NO_DEPRECATE""
112#.ENDIF #"$(WINDOWS_VISTA_PSDK)"!=""
113#.ENDIF
114
115BUILD_DIR=PCbuild
116
117# Build python executable and then runs a minimal script. Running the minimal script
118# ensures that certain *.pyc files are generated which would otherwise be created on
119# solver during registration in insetoo_native
120.IF "$(SYSBASE)" != ""
121BUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe -useenv pcbuild.sln "Release|Win32"
122.ELSE
123BUILD_ACTION=$(COMPATH)$/vcpackages$/vcbuild.exe pcbuild.sln "Release|Win32"
124.ENDIF # "$(SYSBASE)" != ""
125.ENDIF
126.ENDIF
127
128PYVERSIONFILE=$(MISC)$/pyversion.mk
129
130# --- Targets ------------------------------------------------------
131
132
133.INCLUDE : set_ext.mk
134.INCLUDE : target.mk
135.INCLUDE : tg_ext.mk
136
137.IF "$(L10N_framework)"==""
138.IF "$(GUI)" != "UNX"
139.IF "$(COM)"!="GCC"
140PYCONFIG:=$(MISC)$/build$/pyconfig.h
141$(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h : $(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE)
142
143$(PACKAGE_DIR)$/$(BUILD_FLAG_FILE) : $(PYCONFIG)
144
145$(PYCONFIG) : $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h
146	-rm -f $@
147	cat $(MISC)$/build$/$(TARFILE_NAME)$/PC$/pyconfig.h > $@
148.ENDIF
149.ENDIF
150
151ALLTAR : $(PYVERSIONFILE)
152.ENDIF          # "$(L10N_framework)"==""
153
154
155$(PYVERSIONFILE) : pyversion.mk $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
156	-rm -f $@
157	cat $? > $@
158
159