/Makefile.pre.in

http://unladen-swallow.googlecode.com/ · Autoconf · 1391 lines · 1033 code · 188 blank · 170 comment · 62 complexity · 84e45d5c7a4a44cf00b3b72cec5c8220 MD5 · raw file

  1. # Top-level Makefile for Python
  2. #
  3. # As distributed, this file is called Makefile.pre.in; it is processed
  4. # into the real Makefile by running the script ./configure, which
  5. # replaces things like @spam@ with values appropriate for your system.
  6. # This means that if you edit Makefile, your changes get lost the next
  7. # time you run the configure script. Ideally, you can do:
  8. #
  9. # ./configure
  10. # make
  11. # make test
  12. # make install
  13. #
  14. # If you have a previous version of Python installed that you don't
  15. # want to overwrite, you can use "make altinstall" instead of "make
  16. # install". Refer to the "Installing" section in the README file for
  17. # additional details.
  18. #
  19. # See also the section "Build instructions" in the README file.
  20. # === Variables set by makesetup ===
  21. MODOBJS= _MODOBJS_
  22. MODLIBS= _MODLIBS_
  23. # === Variables set by configure
  24. VERSION= @VERSION@
  25. srcdir= @srcdir@
  26. VPATH= @srcdir@
  27. CC= @CC@
  28. CXX= @CXX@
  29. MAINCC= @MAINCC@
  30. LINKCC= @LINKCC@
  31. AR= @AR@
  32. RANLIB= @RANLIB@
  33. SVNVERSION= @SVNVERSION@
  34. FORCE_C= @FORCE_C@
  35. # Shell used by make (some versions default to the login shell, which is bad)
  36. SHELL= /bin/sh
  37. # Use this to make a link between python$(VERSION) and python in $(BINDIR)
  38. LN= @LN@
  39. # Portable install script (configure doesn't always guess right)
  40. INSTALL= @INSTALL@
  41. INSTALL_PROGRAM=@INSTALL_PROGRAM@
  42. INSTALL_SCRIPT= @INSTALL_SCRIPT@
  43. INSTALL_DATA= @INSTALL_DATA@
  44. # Shared libraries must be installed with executable mode on some systems;
  45. # rather than figuring out exactly which, we always give them executable mode.
  46. # Also, making them read-only seems to be a good idea...
  47. INSTALL_SHARED= ${INSTALL} -m 555
  48. MAKESETUP= $(srcdir)/Modules/makesetup
  49. # Compiler options
  50. OPT= @OPT@
  51. BASECFLAGS= @BASECFLAGS@
  52. BASECXXFLAGS= @BASECXXFLAGS@
  53. CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
  54. CXXFLAGS= $(BASECXXFLAGS) $(OPT) $(EXTRA_CXXFLAGS)
  55. # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
  56. # be able to build extension modules using the directories specified in the
  57. # environment variables
  58. CPPFLAGS= -I. -IInclude -I$(srcdir) -I$(srcdir)/Include @CPPFLAGS@
  59. LDFLAGS= @LDFLAGS@
  60. LDLAST= @LDLAST@
  61. SGI_ABI= @SGI_ABI@
  62. CCSHARED= @CCSHARED@
  63. LINKFORSHARED= @LINKFORSHARED@
  64. # Extra C flags added for building the interpreter object files.
  65. CFLAGSFORSHARED=@CFLAGSFORSHARED@
  66. # C flags used for building the interpreter object files
  67. PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
  68. PY_CXXFLAGS= $(CXXFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE -Wno-write-strings
  69. # LLVM integration options
  70. WITH_LLVM= @WITH_LLVM@
  71. LLVM_CONFIG= @LLVM_CONFIG@
  72. LLVM_INC_DIR= @LLVM_INC_DIR@
  73. LLVM_BIN_DIR= @LLVM_BIN_DIR@
  74. LLVM_CXXFLAGS= @LLVM_CXXFLAGS@
  75. LLVM_LDFLAGS= @LLVM_LDFLAGS@
  76. LLVM_LIB_PATHS= @LLVM_LIB_PATHS@
  77. # Machine-dependent subdirectories
  78. MACHDEP= @MACHDEP@
  79. # Install prefix for architecture-independent files
  80. prefix= @prefix@
  81. # Install prefix for architecture-dependent files
  82. exec_prefix= @exec_prefix@
  83. # Install prefix for data files
  84. datarootdir= @datarootdir@
  85. # Expanded directories
  86. BINDIR= $(exec_prefix)/bin
  87. LIBDIR= $(exec_prefix)/lib
  88. MANDIR= @mandir@
  89. INCLUDEDIR= @includedir@
  90. CONFINCLUDEDIR= $(exec_prefix)/include
  91. SCRIPTDIR= $(prefix)/lib
  92. # Detailed destination directories
  93. BINLIBDEST= $(LIBDIR)/python$(VERSION)
  94. LIBDEST= $(SCRIPTDIR)/python$(VERSION)
  95. INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
  96. CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(VERSION)
  97. LIBP= $(LIBDIR)/python$(VERSION)
  98. # Symbols used for using shared libraries
  99. SO= @SO@
  100. LDSHARED= @LDSHARED@
  101. BLDSHARED= @BLDSHARED@
  102. DESTSHARED= $(BINLIBDEST)/lib-dynload
  103. # Executable suffix (.exe on Windows and Mac OS X)
  104. EXE= @EXEEXT@
  105. BUILDEXE= @BUILDEXEEXT@
  106. # Short name and location for Mac OS X Python framework
  107. UNIVERSALSDK=@UNIVERSALSDK@
  108. PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
  109. PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
  110. PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
  111. PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
  112. # Deployment target selected during configure, to be checked
  113. # by distutils. The export statement is needed to ensure that the
  114. # deployment target is active during build.
  115. MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
  116. @EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
  117. # Options to enable prebinding (for fast startup prior to Mac OS X 10.3)
  118. OTHER_LIBTOOL_OPT=@OTHER_LIBTOOL_OPT@
  119. # Environment to run shared python without installed libraries
  120. RUNSHARED= @RUNSHARED@
  121. # Modes for directories, executables and data files created by the
  122. # install process. Default to user-only-writable for all file types.
  123. DIRMODE= 755
  124. EXEMODE= 755
  125. FILEMODE= 644
  126. # configure script arguments
  127. CONFIG_ARGS= @CONFIG_ARGS@
  128. # Subdirectories with code
  129. SRCDIRS= @SRCDIRS@
  130. # Other subdirectories
  131. SUBDIRSTOO= Include Lib Misc Demo
  132. # Files and directories to be distributed
  133. CONFIGFILES= configure configure.in acconfig.h pyconfig.h.in Makefile.pre.in
  134. DISTFILES= README ChangeLog $(CONFIGFILES)
  135. DISTDIRS= $(SUBDIRS) $(SUBDIRSTOO) Ext-dummy
  136. DIST= $(DISTFILES) $(DISTDIRS)
  137. LIBRARY= @LIBRARY@
  138. LDLIBRARY= @LDLIBRARY@
  139. BLDLIBRARY= @BLDLIBRARY@
  140. DLLLIBRARY= @DLLLIBRARY@
  141. ifneq ($(WITH_LLVM), 0)
  142. BCLIBRARY= Modules/libpython$(VERSION).bc
  143. else
  144. BCLIBRARY=
  145. endif
  146. LDLIBRARYDIR= @LDLIBRARYDIR@
  147. INSTSONAME= @INSTSONAME@
  148. LIBS= @LIBS@
  149. LIBM= @LIBM@
  150. LIBC= @LIBC@
  151. SYSLIBS= $(LIBM) $(LIBC)
  152. SHLIBS= @SHLIBS@
  153. THREADOBJ= @THREADOBJ@
  154. DLINCLDIR= @DLINCLDIR@
  155. DYNLOADFILE= @DYNLOADFILE@
  156. MACHDEP_OBJS= @MACHDEP_OBJS@
  157. LIBOBJDIR= Python/
  158. LIBOBJS= @LIBOBJS@
  159. UNICODE_OBJS= @UNICODE_OBJS@
  160. PYTHON= python$(EXE)
  161. BUILDPYTHON= python$(BUILDEXE)
  162. # The task to run while instrument when building the profile-opt target
  163. PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
  164. #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
  165. # === Definitions added by makesetup ===
  166. ##########################################################################
  167. # Modules
  168. MODULE_OBJS= \
  169. Modules/config.o \
  170. Modules/getpath.o \
  171. Modules/main.o \
  172. Modules/gcmodule.o
  173. # Used of signalmodule.o is not available
  174. SIGNAL_OBJS= @SIGNAL_OBJS@
  175. ##########################################################################
  176. # Grammar
  177. GRAMMAR_H= $(srcdir)/Include/graminit.h
  178. GRAMMAR_C= $(srcdir)/Python/graminit.c
  179. GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
  180. ##########################################################################
  181. # Parser
  182. PGEN= Parser/pgen$(EXE)
  183. POBJS= \
  184. Parser/acceler.o \
  185. Parser/grammar1.o \
  186. Parser/listnode.o \
  187. Parser/node.o \
  188. Parser/parser.o \
  189. Parser/parsetok.o \
  190. Parser/bitset.o \
  191. Parser/metagrammar.o \
  192. Parser/firstsets.o \
  193. Parser/grammar.o \
  194. Parser/pgen.o
  195. PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
  196. PGOBJS= \
  197. Objects/obmalloc.o \
  198. Python/mysnprintf.o \
  199. Parser/tokenizer_pgen.o \
  200. Parser/printgrammar.o \
  201. Parser/pgenmain.o
  202. PARSER_HEADERS= \
  203. Parser/parser.h \
  204. Parser/tokenizer.h
  205. PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
  206. ##########################################################################
  207. # AST
  208. AST_H_DIR= $(srcdir)/Include
  209. AST_H= $(AST_H_DIR)/Python-ast.h
  210. AST_C_DIR= $(srcdir)/Python
  211. AST_C= $(AST_C_DIR)/Python-ast.c
  212. AST_ASDL= $(srcdir)/Parser/Python.asdl
  213. ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
  214. # XXX Note that a build now requires Python exist before the build starts
  215. ASDLGEN= $(srcdir)/Parser/asdl_c.py
  216. ##########################################################################
  217. # Python
  218. OPCODETARGETS_H= \
  219. $(srcdir)/Python/opcode_targets.h
  220. OPCODETARGETGEN= \
  221. $(srcdir)/Python/makeopcodetargets.py
  222. OPCODETARGETGEN_FILES= \
  223. $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
  224. PYTHON_OBJS= \
  225. Python/_warnings.o \
  226. Python/Python-ast.o \
  227. Python/asdl.o \
  228. Python/ast.o \
  229. Python/bltinmodule.o \
  230. Python/eval.o \
  231. Python/compile.o \
  232. Python/codecs.o \
  233. Python/errors.o \
  234. Python/frozen.o \
  235. Python/frozenmain.o \
  236. Python/future.o \
  237. Python/getargs.o \
  238. Python/getcompiler.o \
  239. Python/getcopyright.o \
  240. Python/getmtime.o \
  241. Python/getplatform.o \
  242. Python/getversion.o \
  243. Python/graminit.o \
  244. Python/import.o \
  245. Python/importdl.o \
  246. Python/marshal.o \
  247. Python/modsupport.o \
  248. Python/mystrtoul.o \
  249. Python/mysnprintf.o \
  250. Python/peephole.o \
  251. Python/pyarena.o \
  252. Python/pyfpe.o \
  253. Python/pymath.o \
  254. Python/pystate.o \
  255. Python/pythonrun.o \
  256. Python/structmember.o \
  257. Python/symtable.o \
  258. Python/sysmodule.o \
  259. Python/traceback.o \
  260. Python/getopt.o \
  261. Python/pystrcmp.o \
  262. Python/pystrtod.o \
  263. Python/formatter_unicode.o \
  264. Python/formatter_string.o \
  265. Python/$(DYNLOADFILE) \
  266. $(LIBOBJS) \
  267. $(MACHDEP_OBJS) \
  268. $(THREADOBJ)
  269. ifneq ($(WITH_LLVM), 0)
  270. PYTHON_OBJS += \
  271. JIT/ConstantMirror.o \
  272. JIT/DeadGlobalElim.o \
  273. JIT/global_llvm_data.o \
  274. JIT/llvm_compile.o \
  275. JIT/llvm_fbuilder.o \
  276. JIT/llvm_state.o \
  277. JIT/PyAliasAnalysis.o \
  278. JIT/PyBytecodeDispatch.o \
  279. JIT/PyBytecodeIterator.o \
  280. JIT/PyTBAliasAnalysis.o \
  281. JIT/PyTypeBuilder.o \
  282. JIT/RuntimeFeedback.o \
  283. JIT/SingleFunctionInliner.o \
  284. JIT/opcodes/attributes.o \
  285. JIT/opcodes/binops.o \
  286. JIT/opcodes/block.o \
  287. JIT/opcodes/call.o \
  288. JIT/opcodes/closure.o \
  289. JIT/opcodes/cmpops.o \
  290. JIT/opcodes/container.o \
  291. JIT/opcodes/control.o \
  292. JIT/opcodes/globals.o \
  293. JIT/opcodes/locals.o \
  294. JIT/opcodes/loop.o \
  295. JIT/opcodes/name.o \
  296. JIT/opcodes/slice.o \
  297. JIT/opcodes/stack.o \
  298. JIT/opcodes/unaryops.o \
  299. Util/EventTimer.o \
  300. Util/PySmallPtrSet.o \
  301. Util/Stats.o
  302. endif
  303. ##########################################################################
  304. # Objects
  305. OBJECT_OBJS= \
  306. Objects/abstract.o \
  307. Objects/boolobject.o \
  308. Objects/bufferobject.o \
  309. Objects/bytes_methods.o \
  310. Objects/bytearrayobject.o \
  311. Objects/cellobject.o \
  312. Objects/classobject.o \
  313. Objects/cobject.o \
  314. Objects/codeobject.o \
  315. Objects/complexobject.o \
  316. Objects/descrobject.o \
  317. Objects/enumobject.o \
  318. Objects/exceptions.o \
  319. Objects/genobject.o \
  320. Objects/fileobject.o \
  321. Objects/floatobject.o \
  322. Objects/frameobject.o \
  323. Objects/funcobject.o \
  324. Objects/intobject.o \
  325. Objects/iterobject.o \
  326. Objects/listobject.o \
  327. Objects/longobject.o \
  328. Objects/dictobject.o \
  329. Objects/methodobject.o \
  330. Objects/moduleobject.o \
  331. Objects/object.o \
  332. Objects/obmalloc.o \
  333. Objects/rangeobject.o \
  334. Objects/setobject.o \
  335. Objects/sliceobject.o \
  336. Objects/stringobject.o \
  337. Objects/structseq.o \
  338. Objects/tupleobject.o \
  339. Objects/typeobject.o \
  340. Objects/weakrefobject.o \
  341. $(UNICODE_OBJS)
  342. ifneq ($(WITH_LLVM), 0)
  343. OBJECT_OBJS += \
  344. Objects/_llvmfunctionobject.o
  345. endif
  346. ##########################################################################
  347. # objects that get linked into the Python library
  348. LIBRARY_OBJS= \
  349. Modules/getbuildinfo.o \
  350. $(PARSER_OBJS) \
  351. $(OBJECT_OBJS) \
  352. $(PYTHON_OBJS) \
  353. $(MODULE_OBJS) \
  354. $(SIGNAL_OBJS) \
  355. $(MODOBJS)
  356. #########################################################################
  357. # Rules
  358. # Default target
  359. all: build_all
  360. build_all: $(BUILDPYTHON) oldsharedmods sharedmods
  361. # Compile a binary with gcc profile guided optimization.
  362. profile-opt:
  363. @echo "Building with support for profile generation:"
  364. $(MAKE) clean
  365. $(MAKE) build_all_generate_profile
  366. @echo "Running benchmark to generate profile data:"
  367. $(MAKE) profile-removal
  368. $(MAKE) run_profile_task
  369. @echo "Rebuilding with profile guided optimizations:"
  370. $(MAKE) clean
  371. $(MAKE) build_all_use_profile
  372. build_all_generate_profile:
  373. $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
  374. run_profile_task:
  375. ./$(BUILDPYTHON) $(PROFILE_TASK)
  376. build_all_use_profile:
  377. $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
  378. coverage:
  379. @echo "Building with support for coverage checking:"
  380. $(MAKE) clean
  381. $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
  382. sysconfig:
  383. @case $(WITH_LLVM) in \
  384. 1) ( echo "LLVM_CXXFLAGS=$(LLVM_CXXFLAGS)"; echo "LLVM_LDFLAGS=$(LLVM_LDFLAGS)" ) > sysconfig;; \
  385. 0) touch sysconfig;; \
  386. esac
  387. # Build the interpreter
  388. $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) $(BCLIBRARY) sysconfig
  389. $(LINKCC) $(LDFLAGS) -o $@ Modules/python.o $(LINKFORSHARED) $(BLDLIBRARY) \
  390. $(LIBS) $(MODLIBS) $(SYSLIBS) $(LLVM_LDFLAGS) $(LDLAST)
  391. platform: $(BUILDPYTHON)
  392. $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from distutils.util import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
  393. # Build the shared modules
  394. sharedmods: $(BUILDPYTHON)
  395. @case $$MAKEFLAGS in \
  396. *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' LDFLAGS='$(LDFLAGS)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
  397. *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' LDFLAGS='$(LDFLAGS)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
  398. esac
  399. # Build static library
  400. # avoid long command lines, same as LIBRARY_OBJS.
  401. $(LIBRARY): $(LIBRARY_OBJS) $(LLVM_LIB_PATHS)
  402. -rm -f $@
  403. $(AR) cqS $@ $(LIBRARY_OBJS)
  404. $(RANLIB) $@
  405. libpython$(VERSION).so: $(LIBRARY_OBJS)
  406. if test $(INSTSONAME) != $(LDLIBRARY); then \
  407. $(LDSHARED) $(LLVM_LDFLAGS) $(LDFLAGS) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  408. $(LN) -f $(INSTSONAME) $@; \
  409. else \
  410. $(LDSHARED) $(LLVM_LDFLAGS) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  411. fi
  412. libpython$(VERSION).dylib: $(LIBRARY_OBJS)
  413. $(CC) -dynamiclib -Wl,-single_module $(LLVM_LDFLAGS) $(LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(VERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
  414. libpython$(VERSION).sl: $(LIBRARY_OBJS)
  415. $(LDSHARED) $(LLVM_LDFLAGS) $(LDFLAGS) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST)
  416. # This rule is here for OPENSTEP/Rhapsody/MacOSX. It builds a temporary
  417. # minimal framework (not including the Lib directory and such) in the current
  418. # directory.
  419. RESSRCDIR=Mac/Resources/framework
  420. $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
  421. $(LIBRARY) \
  422. $(RESSRCDIR)/Info.plist
  423. $(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
  424. if test "${UNIVERSALSDK}"; then \
  425. $(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
  426. -isysroot "${UNIVERSALSDK}" \
  427. -all_load $(LIBRARY) -Wl,-single_module \
  428. -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
  429. -compatibility_version $(VERSION) \
  430. -current_version $(VERSION); \
  431. else \
  432. /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
  433. @LIBTOOL_CRUFT@ ;\
  434. fi
  435. $(INSTALL) -d -m $(DIRMODE) \
  436. $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj
  437. $(INSTALL_DATA) $(RESSRCDIR)/Info.plist \
  438. $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/Info.plist
  439. $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKDIR)/Versions/Current
  440. $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
  441. $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKDIR)/Headers
  442. $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources
  443. # This rule builds the Cygwin Python DLL and import library if configured
  444. # for a shared core library; otherwise, this rule is a noop.
  445. $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS)
  446. if test -n "$(DLLLIBRARY)"; then \
  447. $(LDSHARED) $(LLVM_LDFLAGS) $(LDFLAGS) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
  448. $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST); \
  449. else true; \
  450. fi
  451. oldsharedmods: $(SHAREDMODS)
  452. Makefile Modules/config.c: Makefile.pre \
  453. $(srcdir)/Modules/config.c.in \
  454. $(MAKESETUP) \
  455. Modules/Setup.config \
  456. Modules/Setup \
  457. Modules/Setup.local
  458. $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
  459. -s Modules \
  460. Modules/Setup.config \
  461. Modules/Setup.local \
  462. Modules/Setup
  463. @mv config.c Modules
  464. @echo "The Makefile was updated, you may need to re-run make."
  465. Modules/Setup: $(srcdir)/Modules/Setup.dist
  466. @if test -f Modules/Setup; then \
  467. echo "-----------------------------------------------"; \
  468. echo "Modules/Setup.dist is newer than Modules/Setup;"; \
  469. echo "check to make sure you have all the updates you"; \
  470. echo "need in your Modules/Setup file."; \
  471. echo "Usually, copying Modules/Setup.dist to Modules/Setup will work."; \
  472. echo "-----------------------------------------------"; \
  473. fi
  474. ############################################################################
  475. # Special rules for object files
  476. Modules/getbuildinfo.o: $(PARSER_OBJS) \
  477. $(OBJECT_OBJS) \
  478. $(PYTHON_OBJS) \
  479. $(MODULE_OBJS) \
  480. $(SIGNAL_OBJS) \
  481. $(MODOBJS) \
  482. $(srcdir)/Modules/getbuildinfo.c
  483. $(CC) -c $(PY_CFLAGS) -DSVNVERSION="\"`LC_ALL=C $(SVNVERSION)`\"" -o $@ $(srcdir)/Modules/getbuildinfo.c
  484. Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
  485. $(CC) -c $(PY_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
  486. -DPREFIX='"$(prefix)"' \
  487. -DEXEC_PREFIX='"$(exec_prefix)"' \
  488. -DVERSION='"$(VERSION)"' \
  489. -DVPATH='"$(VPATH)"' \
  490. -o $@ $(srcdir)/Modules/getpath.c
  491. Modules/python.o: $(srcdir)/Modules/python.c
  492. $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
  493. $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
  494. -@$(INSTALL) -d Include
  495. -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  496. $(PGEN): $(PGENOBJS)
  497. $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
  498. Parser/grammar.o: $(srcdir)/Parser/grammar.c \
  499. $(srcdir)/Include/token.h \
  500. $(srcdir)/Include/grammar.h
  501. Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
  502. Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
  503. Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
  504. $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
  505. $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
  506. $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
  507. $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
  508. Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
  509. Python/getplatform.o: $(srcdir)/Python/getplatform.c
  510. $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
  511. Python/importdl.o: $(srcdir)/Python/importdl.c
  512. $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
  513. Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
  514. $(srcdir)/Objects/unicodetype_db.h
  515. STRINGLIB_HEADERS= \
  516. $(srcdir)/Include/bytes_methods.h \
  517. $(srcdir)/Objects/stringlib/count.h \
  518. $(srcdir)/Objects/stringlib/ctype.h \
  519. $(srcdir)/Objects/stringlib/fastsearch.h \
  520. $(srcdir)/Objects/stringlib/find.h \
  521. $(srcdir)/Objects/stringlib/formatter.h \
  522. $(srcdir)/Objects/stringlib/partition.h \
  523. $(srcdir)/Objects/stringlib/stringdefs.h \
  524. $(srcdir)/Objects/stringlib/string_format.h \
  525. $(srcdir)/Objects/stringlib/transmogrify.h \
  526. $(srcdir)/Objects/stringlib/unicodedefs.h \
  527. $(srcdir)/Objects/stringlib/localeutil.h
  528. Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c \
  529. $(STRINGLIB_HEADERS)
  530. Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
  531. $(STRINGLIB_HEADERS)
  532. Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
  533. $(STRINGLIB_HEADERS)
  534. $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
  535. $(OPCODETARGETGEN) $(OPCODETARGETS_H)
  536. Python/eval.o: Python/eval.cc $(OPCODETARGETS_H)
  537. ifeq ($(WITH_LLVM), 0)
  538. $(CC) $(FORCE_C) -c $(PY_CFLAGS) -o $@ $<
  539. else
  540. $(CXX) -c $(LLVM_CXXFLAGS) $(PY_CXXFLAGS) -o $@ $<
  541. endif
  542. Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
  543. $(STRINGLIB_HEADERS)
  544. Python/formatter_string.o: $(srcdir)/Python/formatter_string.c \
  545. $(STRINGLIB_HEADERS)
  546. ############################################################################
  547. # Header files
  548. PYTHON_HEADERS= \
  549. Include/Python-ast.h \
  550. Include/Python.h \
  551. Include/abstract.h \
  552. Include/asdl.h \
  553. Include/ast.h \
  554. Include/bitset.h \
  555. Include/boolobject.h \
  556. Include/bytearrayobject.h \
  557. Include/bytes_methods.h \
  558. Include/bytesobject.h \
  559. Include/bufferobject.h \
  560. Include/cellobject.h \
  561. Include/classobject.h \
  562. Include/cobject.h \
  563. Include/code.h \
  564. Include/codecs.h \
  565. Include/compile.h \
  566. Include/complexobject.h \
  567. Include/descrobject.h \
  568. Include/dictobject.h \
  569. Include/enumobject.h \
  570. Include/errcode.h \
  571. Include/eval.h \
  572. Include/fileobject.h \
  573. Include/floatobject.h \
  574. Include/frameobject.h \
  575. Include/funcobject.h \
  576. Include/genobject.h \
  577. Include/import.h \
  578. Include/intobject.h \
  579. Include/intrcheck.h \
  580. Include/iterobject.h \
  581. Include/listobject.h \
  582. Include/longintrepr.h \
  583. Include/longobject.h \
  584. Include/marshal.h \
  585. Include/metagrammar.h \
  586. Include/methodobject.h \
  587. Include/modsupport.h \
  588. Include/moduleobject.h \
  589. Include/node.h \
  590. Include/object.h \
  591. Include/objimpl.h \
  592. Include/opcode.h \
  593. Include/osdefs.h \
  594. Include/parsetok.h \
  595. Include/patchlevel.h \
  596. Include/pgen.h \
  597. Include/pgenheaders.h \
  598. Include/pyarena.h \
  599. Include/pydebug.h \
  600. Include/pyerrors.h \
  601. Include/pyfpe.h \
  602. Include/pymath.h \
  603. Include/pygetopt.h \
  604. Include/pymem.h \
  605. Include/pyport.h \
  606. Include/pystate.h \
  607. Include/pystrcmp.h \
  608. Include/pystrtod.h \
  609. Include/pythonrun.h \
  610. Include/pythread.h \
  611. Include/rangeobject.h \
  612. Include/setobject.h \
  613. Include/sliceobject.h \
  614. Include/stringobject.h \
  615. Include/structmember.h \
  616. Include/structseq.h \
  617. Include/symtable.h \
  618. Include/sysmodule.h \
  619. Include/traceback.h \
  620. Include/tupleobject.h \
  621. Include/ucnhash.h \
  622. Include/unicodeobject.h \
  623. Include/warnings.h \
  624. Include/weakrefobject.h \
  625. Include/_llvmfunctionobject.h \
  626. JIT/ConstantMirror.h \
  627. JIT/DeadGlobalElim.h \
  628. JIT/global_llvm_data.h \
  629. JIT/global_llvm_data_fwd.h \
  630. JIT/llvm_compile.h \
  631. JIT/llvm_fbuilder.h \
  632. JIT/llvm_state.h \
  633. JIT/PyBytecodeDispatch.h \
  634. JIT/PyBytecodeIterator.h \
  635. JIT/PyTypeBuilder.h \
  636. JIT/PyTBAliasAnalysis.h \
  637. JIT/RuntimeFeedback.h \
  638. JIT/RuntimeFeedback_fwd.h \
  639. JIT/SingleFunctionInliner.h \
  640. JIT/opcodes/attributes.h \
  641. JIT/opcodes/binops.h \
  642. JIT/opcodes/block.h \
  643. JIT/opcodes/call.h \
  644. JIT/opcodes/closure.h \
  645. JIT/opcodes/cmpops.h \
  646. JIT/opcodes/container.h \
  647. JIT/opcodes/control.h \
  648. JIT/opcodes/globals.h \
  649. JIT/opcodes/locals.h \
  650. JIT/opcodes/loop.h \
  651. JIT/opcodes/name.h \
  652. JIT/opcodes/slice.h \
  653. JIT/opcodes/stack.h \
  654. JIT/opcodes/unaryops.h \
  655. Util/EventTimer.h \
  656. Util/PySmallPtrSet.h \
  657. Util/Stats.h \
  658. Util/Instrumentation.h \
  659. pyconfig.h \
  660. $(PARSER_HEADERS)
  661. $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
  662. ######################################################################
  663. # LLVM-related generated files
  664. BCLIBRARY_OBJS := JIT/llvm_inline_functions.bc
  665. $(BCLIBRARY:.bc=.unopt.bc): $(BCLIBRARY_OBJS)
  666. $(LLVM_BIN_DIR)/llvm-link -o $@ $(filter %.bc, $^)
  667. $(BCLIBRARY): $(BCLIBRARY:.bc=.unopt.bc)
  668. $(LLVM_BIN_DIR)/opt -o $@ -O3 $<
  669. ######################################################################
  670. # Unit tests, using Googletest
  671. Unittests/googletest/gtest.o:
  672. $(CXX) -c $(PY_CXXFLAGS) -I$(srcdir)/Unittests/googletest \
  673. -I$(srcdir)/Unittests/googletest/include -o $@ $(srcdir)/Unittests/googletest/src/gtest-all.cc
  674. # Must be in the root object directory for Python to find libpython.bc.
  675. # BUILDPYTHON and python-config are order-only so that $^ doesn't pick them up.
  676. # The python-config line needs to come last, or this will be broken on Linux.
  677. #
  678. # gcc's TR1 <tuple> header depends on RTTI, so force googletest to use
  679. # its own tuple implementation. When we import googletest >=1.4.0, we
  680. # can drop the RTTI line.
  681. AllUnitTests: $(srcdir)/Unittests/*Test.cc $(srcdir)/Unittests/pytest_main.cc \
  682. $(LIBRARY) Unittests/googletest/gtest.o | $(BUILDPYTHON) python-config
  683. $(CXX) $(CPPFLAGS) -I$(srcdir)/Unittests/googletest/include \
  684. -DGTEST_HAS_RTTI=0 -DGTEST_HAS_TR1_TUPLE=0 -o $@ $^ \
  685. -L. $(LDFLAGS) `$(RUNSHARED) ./$(BUILDPYTHON) ./python-config --cxxflags --ldflags --libs`
  686. ifneq ($(WITH_LLVM), 0)
  687. unittest: AllUnitTests
  688. $(RUNSHARED) ./AllUnitTests
  689. else
  690. unittest:
  691. endif
  692. # Test the interpreter (twice, once without .pyc files, once with)
  693. # In the past, we've had problems where bugs in the marshalling or
  694. # elsewhere caused bytecode read from .pyc files to behave differently
  695. # than bytecode generated directly from a .py source file. Sometimes
  696. # the bytecode read from a .pyc file had the bug, somtimes the directly
  697. # generated bytecode. This is sometimes a very shy bug needing a lot of
  698. # sample data.
  699. TESTOPTS= -l $(EXTRATESTOPTS)
  700. TESTPROG= $(srcdir)/Lib/test/regrtest.py
  701. TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt $(TESTPYOPTS)
  702. test: all platform unittest
  703. -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
  704. -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
  705. $(TESTPYTHON) $(TESTPROG) $(TESTOPTS)
  706. testall: all platform unittest
  707. -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
  708. $(TESTPYTHON) $(srcdir)/Lib/compileall.py
  709. -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
  710. -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
  711. $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
  712. # Run the unitests for both architectures in a Universal build on OSX
  713. # Must be run on an Intel box.
  714. testuniversal: all platform unittest
  715. if [ `arch` != 'i386' ];then \
  716. echo "This can only be used on OSX/i386" ;\
  717. exit 1 ;\
  718. fi
  719. -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
  720. -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
  721. $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall
  722. $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E -tt $(TESTPROG) $(TESTOPTS) -uall
  723. # Like testall, but with a single pass only
  724. # run an optional script to include some information about the build environment
  725. buildbottest: all platform unittest
  726. -@if which pybuildbot.identify >/dev/null 2>&1; then \
  727. pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
  728. fi
  729. $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
  730. QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \
  731. test_unicodedata test_re test_sre test_select test_poll \
  732. test_linuxaudiodev test_struct test_sunaudiodev test_zlib
  733. quicktest: all platform unittest
  734. -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
  735. -$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
  736. $(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)
  737. MEMTESTOPTS= $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \
  738. test_longexp
  739. memtest: all platform unittest
  740. -rm -f $(srcdir)/Lib/test/*.py[co]
  741. -$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
  742. $(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)
  743. # Install everything
  744. install: @FRAMEWORKINSTALLFIRST@ altinstall bininstall maninstall @FRAMEWORKINSTALLLAST@
  745. # Install almost everything without disturbing previous versions
  746. altinstall: @FRAMEWORKALTINSTALLFIRST@ altbininstall libinstall inclinstall libainstall \
  747. sharedinstall oldsharedinstall @FRAMEWORKALTINSTALLLAST@
  748. # Install shared libraries enabled by Setup
  749. DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
  750. oldsharedinstall: $(DESTSHARED) $(SHAREDMODS)
  751. @for i in X $(SHAREDMODS); do \
  752. if test $$i != X; then \
  753. echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
  754. $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \
  755. fi; \
  756. done
  757. $(DESTSHARED):
  758. @for i in $(DESTDIRS); \
  759. do \
  760. if test ! -d $(DESTDIR)$$i; then \
  761. echo "Creating directory $$i"; \
  762. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  763. else true; \
  764. fi; \
  765. done
  766. # Install the interpreter (by creating a hard link to python$(VERSION))
  767. bininstall: altbininstall
  768. -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \
  769. then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \
  770. else true; \
  771. fi
  772. (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))
  773. -rm -f $(DESTDIR)$(BINDIR)/python-config
  774. (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python-config)
  775. # Install the interpreter with $(VERSION) affixed
  776. # This goes into $(exec_prefix)
  777. altbininstall: $(BUILDPYTHON)
  778. @for i in $(BINDIR) $(LIBDIR); \
  779. do \
  780. if test ! -d $(DESTDIR)$$i; then \
  781. echo "Creating directory $$i"; \
  782. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  783. else true; \
  784. fi; \
  785. done
  786. $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE)
  787. if test -f $(LDLIBRARY); then \
  788. if test -n "$(DLLLIBRARY)" ; then \
  789. $(INSTALL_SHARED) $(DLLLIBRARY) $(DESTDIR)$(BINDIR); \
  790. else \
  791. $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \
  792. if test $(LDLIBRARY) != $(INSTSONAME); then \
  793. (cd $(DESTDIR)$(LIBDIR); $(LN) -sf $(INSTSONAME) $(LDLIBRARY)) \
  794. fi \
  795. fi; \
  796. else true; \
  797. fi
  798. # Install the manual page
  799. maninstall:
  800. @for i in $(MANDIR) $(MANDIR)/man1; \
  801. do \
  802. if test ! -d $(DESTDIR)$$i; then \
  803. echo "Creating directory $$i"; \
  804. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  805. else true; \
  806. fi; \
  807. done
  808. $(INSTALL_DATA) $(srcdir)/Misc/python.man \
  809. $(DESTDIR)$(MANDIR)/man1/python.1
  810. # Install the library
  811. PLATDIR= plat-$(MACHDEP)
  812. EXTRAPLATDIR= @EXTRAPLATDIR@
  813. EXTRAMACHDEPPATH=@EXTRAMACHDEPPATH@
  814. MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
  815. XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
  816. PLATMACDIRS= plat-mac plat-mac/Carbon plat-mac/lib-scriptpackages \
  817. plat-mac/lib-scriptpackages/_builtinSuites \
  818. plat-mac/lib-scriptpackages/CodeWarrior \
  819. plat-mac/lib-scriptpackages/Explorer \
  820. plat-mac/lib-scriptpackages/Finder \
  821. plat-mac/lib-scriptpackages/Netscape \
  822. plat-mac/lib-scriptpackages/StdSuites \
  823. plat-mac/lib-scriptpackages/SystemEvents \
  824. plat-mac/lib-scriptpackages/Terminal
  825. PLATMACPATH=:plat-mac:plat-mac/lib-scriptpackages
  826. LIBSUBDIRS= lib-tk site-packages test test/output test/data \
  827. test/decimaltestdata \
  828. encodings compiler hotshot \
  829. email email/mime email/test email/test/data \
  830. json json/tests \
  831. sqlite3 sqlite3/test \
  832. logging bsddb bsddb/test csv wsgiref \
  833. lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
  834. ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \
  835. distutils distutils/command distutils/tests $(XMLLIBSUBDIRS) \
  836. multiprocessing multiprocessing/dummy \
  837. lib-old \
  838. curses $(MACHDEPS)
  839. libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
  840. @for i in $(SCRIPTDIR) $(LIBDEST); \
  841. do \
  842. if test ! -d $(DESTDIR)$$i; then \
  843. echo "Creating directory $$i"; \
  844. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  845. else true; \
  846. fi; \
  847. done
  848. @for d in $(LIBSUBDIRS); \
  849. do \
  850. a=$(srcdir)/Lib/$$d; \
  851. if test ! -d $$a; then continue; else true; fi; \
  852. b=$(LIBDEST)/$$d; \
  853. if test ! -d $(DESTDIR)$$b; then \
  854. echo "Creating directory $$b"; \
  855. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \
  856. else true; \
  857. fi; \
  858. done
  859. @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  860. do \
  861. if test -x $$i; then \
  862. $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
  863. echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \
  864. else \
  865. $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \
  866. echo $(INSTALL_DATA) $$i $(LIBDEST); \
  867. fi; \
  868. done
  869. @for d in $(LIBSUBDIRS); \
  870. do \
  871. a=$(srcdir)/Lib/$$d; \
  872. if test ! -d $$a; then continue; else true; fi; \
  873. if test `ls $$a | wc -l` -lt 1; then continue; fi; \
  874. b=$(LIBDEST)/$$d; \
  875. for i in $$a/*; \
  876. do \
  877. case $$i in \
  878. *CVS) ;; \
  879. *.py[co]) ;; \
  880. *.orig) ;; \
  881. *~) ;; \
  882. *) \
  883. if test -d $$i; then continue; fi; \
  884. if test -x $$i; then \
  885. echo $(INSTALL_SCRIPT) $$i $$b; \
  886. $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \
  887. else \
  888. echo $(INSTALL_DATA) $$i $$b; \
  889. $(INSTALL_DATA) $$i $(DESTDIR)$$b; \
  890. fi;; \
  891. esac; \
  892. done; \
  893. done
  894. $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
  895. PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  896. ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
  897. -d $(LIBDEST) -f \
  898. -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
  899. PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  900. ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
  901. -d $(LIBDEST) -f \
  902. -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
  903. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  904. ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
  905. -d $(LIBDEST)/site-packages -f \
  906. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  907. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  908. ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
  909. -d $(LIBDEST)/site-packages -f \
  910. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  911. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  912. ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
  913. # Create the PLATDIR source directory, if one wasn't distributed..
  914. $(srcdir)/Lib/$(PLATDIR):
  915. mkdir $(srcdir)/Lib/$(PLATDIR)
  916. cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
  917. export PATH; PATH="`pwd`:$$PATH"; \
  918. export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
  919. export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
  920. export EXE; EXE="$(BUILDEXE)"; \
  921. cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
  922. python-config: Misc/python-config.in
  923. # Substitution happens here, as the completely-expanded BINDIR
  924. # is not available in configure
  925. sed -e "s,@EXENAME@,$(BINDIR)/python$(VERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config
  926. # Install the include files
  927. INCLDIRSTOMAKE=$(INCLUDEDIR) $(CONFINCLUDEDIR) $(INCLUDEPY) $(CONFINCLUDEPY)
  928. inclinstall:
  929. @for i in $(INCLDIRSTOMAKE); \
  930. do \
  931. if test ! -d $(DESTDIR)$$i; then \
  932. echo "Creating directory $$i"; \
  933. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  934. else true; \
  935. fi; \
  936. done
  937. @for i in $(srcdir)/Include/*.h; \
  938. do \
  939. echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
  940. $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
  941. done
  942. $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
  943. # Install the library and miscellaneous stuff needed for extending/embedding
  944. # This goes into $(exec_prefix)
  945. LIBPL= $(LIBP)/config
  946. libainstall: all python-config
  947. @for i in $(LIBDIR) $(LIBP) $(LIBPL) $(DESTSHARED); \
  948. do \
  949. if test ! -d $(DESTDIR)$$i; then \
  950. echo "Creating directory $$i"; \
  951. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  952. else true; \
  953. fi; \
  954. done
  955. @if test -d $(LIBRARY); then :; else \
  956. if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
  957. if test "$(SO)" = .dll; then \
  958. $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
  959. else \
  960. $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
  961. $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
  962. fi; \
  963. else \
  964. echo Skip install of $(LIBRARY) - use make frameworkinstall; \
  965. fi; \
  966. fi
  967. @if test $(WITH_LLVM) != 0 ; then \
  968. $(INSTALL_DATA) $(BCLIBRARY) $(DESTDIR)$(DESTSHARED); \
  969. fi
  970. $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
  971. $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o
  972. $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
  973. $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile
  974. $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup
  975. $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
  976. $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config
  977. $(INSTALL_DATA) sysconfig $(DESTDIR)$(LIBPL)/sysconfig
  978. $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
  979. $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
  980. $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(VERSION)-config
  981. rm python-config
  982. @if [ -s Modules/python.exp -a \
  983. "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
  984. echo; echo "Installing support files for building shared extension modules on AIX:"; \
  985. $(INSTALL_DATA) Modules/python.exp \
  986. $(DESTDIR)$(LIBPL)/python.exp; \
  987. echo; echo "$(LIBPL)/python.exp"; \
  988. $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \
  989. $(DESTDIR)$(LIBPL)/makexp_aix; \
  990. echo "$(LIBPL)/makexp_aix"; \
  991. $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \
  992. $(DESTDIR)$(LIBPL)/ld_so_aix; \
  993. echo "$(LIBPL)/ld_so_aix"; \
  994. echo; echo "See Misc/AIX-NOTES for details."; \
  995. else true; \
  996. fi
  997. @case "$(MACHDEP)" in beos*) \
  998. echo; echo "Installing support files for building shared extension modules on BeOS:"; \
  999. $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
  1000. echo; echo "$(LIBPL)/README"; \
  1001. $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
  1002. echo "$(LIBPL)/ar_beos"; \
  1003. $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
  1004. echo "$(LIBPL)/ld_so_beos"; \
  1005. echo; echo "See Misc/BeOS-NOTES for details."; \
  1006. ;; \
  1007. esac
  1008. # Install the dynamically loadable modules
  1009. # This goes into $(exec_prefix)
  1010. sharedinstall:
  1011. $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
  1012. --prefix=$(prefix) \
  1013. --install-scripts=$(BINDIR) \
  1014. --install-platlib=$(DESTSHARED) \
  1015. --root=/$(DESTDIR)
  1016. # Here are a couple of targets for MacOSX again, to install a full
  1017. # framework-based Python. frameworkinstall installs everything, the
  1018. # subtargets install specific parts. Much of the actual work is offloaded to
  1019. # the Makefile in Mac
  1020. #
  1021. #
  1022. # This target is here for backward compatiblity, previous versions of Python
  1023. # hadn't integrated framework installation in the normal install process.
  1024. frameworkinstall: install
  1025. # On install, we re-make the framework
  1026. # structure in the install location, /Library/Frameworks/ or the argument to
  1027. # --enable-framework. If --enable-framework has been specified then we have
  1028. # automatically set prefix to the location deep down in the framework, so we
  1029. # only have to cater for the structural bits of the framework.
  1030. frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
  1031. frameworkinstallstructure: $(LDLIBRARY)
  1032. @if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
  1033. echo Not configured with --enable-framework; \
  1034. exit 1; \
  1035. else true; \
  1036. fi
  1037. @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\
  1038. if test ! -d $(DESTDIR)$$i; then \
  1039. echo "Creating directory $(DESTDIR)$$i"; \
  1040. $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \
  1041. else true; \
  1042. fi; \
  1043. done
  1044. $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
  1045. sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
  1046. $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
  1047. $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
  1048. $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
  1049. $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
  1050. $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
  1051. # This installs Mac/Lib into the framework
  1052. # Install a number of symlinks to keep software that expects a normal unix
  1053. # install (which includes python-config) happy.
  1054. frameworkinstallmaclib:
  1055. ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a"
  1056. cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)"
  1057. # This installs the IDE, the Launcher and other apps into /Applications
  1058. frameworkinstallapps:
  1059. cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
  1060. frameworkinstallapps4way:
  1061. cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
  1062. # This install the unix python and pythonw tools in /usr/local/bin
  1063. frameworkinstallunixtools:
  1064. cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
  1065. frameworkinstallunixtools4way:
  1066. cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
  1067. frameworkaltinstallunixtools:
  1068. cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
  1069. frameworkaltinstallunixtools4way:
  1070. cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
  1071. # This installs the Demos and Tools into the applications directory.
  1072. # It is not part of a normal frameworkinstall
  1073. frameworkinstallextras:
  1074. cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"
  1075. # This installs a few of the useful scripts in Tools/scripts
  1076. scriptsinstall:
  1077. SRCDIR=$(srcdir) $(RUNSHARED) \
  1078. ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
  1079. --prefix=$(prefix) \
  1080. --install-scripts=$(BINDIR) \
  1081. --root=/$(DESTDIR)
  1082. # Build the toplevel Makefile
  1083. Makefile.pre: Makefile.pre.in config.status
  1084. CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
  1085. $(MAKE) -f Makefile.pre Makefile
  1086. # Run the configure script.
  1087. config.status: $(srcdir)/configure
  1088. $(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
  1089. .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
  1090. # Some make's put the object file in the current directory
  1091. .c.o:
  1092. $(CC) -c $(PY_CFLAGS) -o $@ $<
  1093. # Configuring --without-llvm should completely cut out any dependency on C++.
  1094. %.o: %.cc
  1095. ifeq ($(WITH_LLVM), 0)
  1096. $(error Should not be building C++ files under --without-llvm)
  1097. else
  1098. $(CXX) -c $(LLVM_CXXFLAGS) $(PY_CXXFLAGS) -o $@ $<
  1099. endif
  1100. %.bc : %.c $(PYTHON_HEADERS)
  1101. $(LLVM_BIN_DIR)/clang -O3 -emit-llvm -c $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE $< -o $@
  1102. %.ll : %.bc
  1103. $(LLVM_BIN_DIR)/llvm-dis $< -o $@
  1104. # Run reindent on the library
  1105. reindent:
  1106. ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/reindent.py -r $(srcdir)/Lib
  1107. # Rerun configure with the same options as it was run last time,
  1108. # provided the config.status script exists
  1109. recheck:
  1110. $(SHELL) config.status --recheck
  1111. $(SHELL) config.status
  1112. # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
  1113. autoconf:
  1114. (cd $(srcdir); autoconf)
  1115. (cd $(srcdir); autoheader)
  1116. # Create a tags file for vi
  1117. tags::
  1118. cd $(srcdir); \
  1119. ctags -w -t Include/*.h; \
  1120. for i in $(SRCDIRS); do ctags -w -t -a $$i/*.[ch]; \
  1121. done; \
  1122. sort -o tags tags
  1123. # Create a tags file for GNU Emacs
  1124. TAGS::
  1125. cd $(srcdir); etags `find . -name \*.c -o -name \*.c -o -name \*.cc`
  1126. # Sanitation targets -- clean leaves libraries, executables and tags
  1127. # files, which clobber removes as well
  1128. pycremoval:
  1129. find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
  1130. clean: pycremoval
  1131. find . -name '*.o' -exec rm -f {} ';'
  1132. find . -name '*.s[ol]' -exec rm -f {} ';'
  1133. find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
  1134. find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
  1135. rm -f sysconfig # Our empty targets.
  1136. rm -f $(BCLIBRARY_OBJS)
  1137. rm -f $(BCLIBRARY)
  1138. -rm -f Lib/lib2to3/*Grammar*.pickle
  1139. profile-removal:
  1140. find . -name '*.gc??' -exec rm -f {} ';'
  1141. clobber: clean profile-removal
  1142. -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
  1143. tags TAGS \
  1144. config.cache config.log pyconfig.h Modules/config.c
  1145. -rm -rf build platform
  1146. -rm -rf $(PYTHONFRAMEWORKDIR)
  1147. # Make things extra clean, before making a distribution:
  1148. # remove all generated files, even Makefile[.pre]
  1149. # Keep configure and Python-ast.[ch], it's possible they can't be generated
  1150. distclean: clobber
  1151. -rm -f core Makefile Makefile.pre config.status \
  1152. Modules/Setup Modules/Setup.local Modules/Setup.config
  1153. find $(srcdir) '(' -name '*.fdc' -o -name '*~' \
  1154. -o -name '[@,#]*' -o -name '*.old' \
  1155. -o -name '*.orig' -o -name '*.rej' \
  1156. -o -name '*.bak' ')' \
  1157. -exec rm -f {} ';'
  1158. # Check for smelly exported symbols (not starting with Py/_Py)
  1159. smelly: all
  1160. nm -p $(LIBRARY) | \
  1161. sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
  1162. # Find files with funny names
  1163. funny:
  1164. find $(DISTDIRS) -type d \
  1165. -o -name '*.[chs]' \
  1166. -o -name '*.py' \
  1167. -o -name '*.doc' \
  1168. -o -name '*.sty' \
  1169. -o -name '*.bib' \
  1170. -o -name '*.dat' \
  1171. -o -name '*.el' \
  1172. -o -name '*.fd' \
  1173. -o -name '*.in' \
  1174. -o -name '*.tex' \
  1175. -o -name '*,[vpt]' \
  1176. -o -name 'Setup' \
  1177. -o -name 'Setup.*' \
  1178. -o -name README \
  1179. -o -name Makefile \
  1180. -o -name ChangeLog \
  1181. -o -name Repository \
  1182. -o -name Root \
  1183. -o -name Entries \
  1184. -o -name Tag \
  1185. -o -name tags \
  1186. -o -name TAGS \
  1187. -o -name .cvsignore \
  1188. -o -name MANIFEST \
  1189. -o -print
  1190. # Perform some verification checks on any modified files.
  1191. patchcheck:
  1192. $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
  1193. # Dependencies
  1194. Python/thread.o: @THREADHEADERS@
  1195. # Declare targets that aren't real files
  1196. .PHONY: all build_all sharedmods oldsharedmods test quicktest memtest
  1197. .PHONY: install altinstall oldsharedinstall bininstall altbininstall
  1198. .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
  1199. .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
  1200. .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
  1201. .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
  1202. .PHONY: smelly funny patchcheck
  1203. # IF YOU PUT ANYTHING HERE IT WILL GO AWAY