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