Created
March 19, 2018 03:07
-
-
Save anonymous/d7f65f36137dd7bffb61821cdb6036d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reference makefile: | |
| # https://gist.github.com/anonymous/b469f85762e93ea1b51f0f0f97e19acc | |
| # All the flags created by configure | |
| OPT = [ | |
| "-DNDEBUG", | |
| "-g", | |
| "-fwrapv", | |
| "-O3", | |
| "-Wall", | |
| "-Wstrict-prototypes", | |
| ] | |
| BASECFLAGS = [ | |
| "-Wno-unused-result", | |
| "-Wsign-compare", | |
| ] | |
| BASECPPFLAGS = [] | |
| CONFIGURE_CFLAGS = [] | |
| CONFIGURE_CFLAGS_NODIST = [ | |
| "-std=c99", | |
| "-Wextra", | |
| "-Wno-unused-result", | |
| "-Wno-unused-parameter", | |
| "-Wno-missing-field-initializers", | |
| "-Werror=implicit-function-declaration", | |
| ] | |
| CONFIGURE_CPPFLAGS = [] | |
| CONFIGURE_LDFLAGS = [] | |
| PY_CFLAGS = BASECFLAGS + OPT + CONFIGURE_CFLAGS | |
| PY_CFLAGS_NODIST = CONFIGURE_CFLAGS_NODIST | |
| PY_CPPFLAGS = BASECPPFLAGS + CONFIGURE_CPPFLAGS | |
| PY_LDFLAGS = CONFIGURE_LDFLAGS | |
| CCSHARED = ["-fPIC"] | |
| LINKFORSHARED = [ | |
| "-Xlinker", | |
| "-export-dynamic", | |
| ] | |
| ARFLAGS = ["rcs"] | |
| CFLAGSFORSHARED = [] | |
| PY_CORE_CFLAGS = PY_CFLAGS + PY_CFLAGS_NODIST + PY_CPPFLAGS + \ | |
| CFLAGSFORSHARED + ["-DPy_BUILD_CORE"] | |
| CFLAGS_ALIASING = [] | |
| LIBS = [ | |
| "-lpthread", | |
| "-ldl", | |
| "-lutil", | |
| ] | |
| VERSION = "3.7" | |
| ABIFLAGS = "m" | |
| LDVERSION = VERSION + ABIFLAGS | |
| LIBRARY = "".join([ | |
| "libpython", | |
| VERSION, | |
| ABIFLAGS, | |
| ".a", | |
| ]) | |
| LDLIBRARY = LIBRARY | |
| PREFIX = "/usr/local" | |
| EXEC_PREFIX = PREFIX | |
| genrule( | |
| name = "run-config", | |
| srcs = glob(["**/*"]), | |
| outs = [ | |
| "Modules/config.c", | |
| "pyconfig.h", | |
| ], | |
| cmd = "$(location configure) --enable-optimizations --disable-shared && find | grep \"config.c\"", | |
| ) | |
| cc_library( | |
| name = "includes", | |
| hdrs = glob( | |
| ["Include/**/*.h"], | |
| ), | |
| strip_include_prefix = "Include", | |
| visibility = ["//visibility:public"], | |
| ) | |
| cc_library( | |
| name = "pobjs", | |
| srcs = [ | |
| "Parser/acceler.c", | |
| "Parser/bitset.c", | |
| "Parser/firstsets.c", | |
| "Parser/grammar.c", | |
| "Parser/grammar1.c", | |
| "Parser/listnode.c", | |
| "Parser/metagrammar.c", | |
| "Parser/node.c", | |
| "Parser/parser.c", | |
| "Parser/pgen.c", | |
| ], | |
| hdrs = glob(["Parser/**/*.h"]) + ["pyconfig.h"], | |
| copts = PY_CORE_CFLAGS, | |
| deps = [ | |
| ":includes", | |
| ], | |
| ) | |
| cc_library( | |
| name = "parser_objs", | |
| srcs = [ | |
| "Parser/myreadline.c", | |
| "Parser/parsetok.c", | |
| "Parser/tokenizer.c", | |
| ], | |
| hdrs = [ | |
| "Parser/parser.h", | |
| "Parser/tokenizer.h", | |
| ], | |
| copts = PY_CORE_CFLAGS, | |
| deps = [ | |
| ":includes", | |
| ":pobjs", | |
| ], | |
| ) | |
| cc_library( | |
| name = "pgenobjs", | |
| srcs = [ | |
| "Objects/obmalloc.c", | |
| "Parser/parsetok_pgen.c", | |
| "Parser/pgenmain.c", | |
| "Parser/printgrammar.c", | |
| "Parser/tokenizer_pgen.c", | |
| "Python/dynamic_annotations.c", | |
| "Python/mysnprintf.c", | |
| "Python/pyctype.c", | |
| ], | |
| hdrs = [ | |
| "Parser/parsetok.c", | |
| "Parser/tokenizer.c", | |
| ], | |
| copts = PY_CORE_CFLAGS, | |
| strip_include_prefix = "Include", | |
| deps = [ | |
| ":pobjs", | |
| ], | |
| ) | |
| cc_binary( | |
| name = "pgen", | |
| copts = OPT, | |
| linkopts = LIBS, | |
| deps = [":pgenobjs"], | |
| ) | |
| cc_library( | |
| name = "dynload_shlib", | |
| srcs = ["Python/dynload_shlib.c"], | |
| hdrs = [ | |
| "Python/importdl.h", | |
| "pyconfig.h", | |
| ], | |
| copts = PY_CORE_CFLAGS + ["-DSOABI='\"cpython-37m-x86_64-linux-gnu\"'"], | |
| deps = [":includes"], | |
| ) | |
| cc_library( | |
| name = "getpath", | |
| srcs = ["Modules/getpath.c"], | |
| hdrs = ["pyconfig.h"], | |
| copts = PY_CORE_CFLAGS + [ | |
| "-DPYTHONPATH='\"\"'", | |
| "-DPREFIX='\"\"'", | |
| "-DEXEC_PREFIX='\"{}\"'".format(EXEC_PREFIX), | |
| "-DVERSION='\"{}\"'".format(VERSION), | |
| "-DVPATH='\"\"'", | |
| ], | |
| deps = [":includes"], | |
| ) | |
| # Not sure if I should care about this information or not. | |
| # Ignoring for now. | |
| cc_library( | |
| name = "getbuildinfo", | |
| srcs = [ | |
| "Modules/getbuildinfo.c", | |
| ], | |
| hdrs = ["pyconfig.h"], | |
| copts = PY_CORE_CFLAGS + [ | |
| #"-DGITVERSION=\"\"", | |
| #"-DGITTAG=\"\"", | |
| #"-DGITBRANCH=\"\"", | |
| ], | |
| deps = [":includes"], | |
| ) | |
| cc_library( | |
| name = "frozen", | |
| srcs = [ | |
| "Python/frozen.c", | |
| "Python/importlib.h", | |
| "Python/importlib_external.h", | |
| ], | |
| hdrs = ["pyconfig.h"], | |
| deps = [":includes"], | |
| ) | |
| cc_library( | |
| name = "cpython", | |
| srcs = [ | |
| "Modules/_abc.c", | |
| "Modules/_codecsmodule.c", | |
| "Modules/_collectionsmodule.c", | |
| "Modules/_functoolsmodule.c", | |
| "Modules/_io/_iomodule.c", | |
| "Modules/_io/bufferedio.c", | |
| "Modules/_io/bytesio.c", | |
| "Modules/_io/fileio.c", | |
| "Modules/_io/iobase.c", | |
| "Modules/_io/stringio.c", | |
| "Modules/_io/textio.c", | |
| "Modules/_localemodule.c", | |
| "Modules/_operator.c", | |
| "Modules/_sre.c", | |
| "Modules/_stat.c", | |
| "Modules/_threadmodule.c", | |
| "Modules/_tracemalloc.c", | |
| "Modules/_weakref.c", | |
| "Modules/atexitmodule.c", | |
| "Modules/config.c", | |
| "Modules/errnomodule.c", | |
| "Modules/faulthandler.c", | |
| "Modules/gcmodule.c", | |
| "Modules/hashtable.c", | |
| "Modules/itertoolsmodule.c", | |
| "Modules/main.c", | |
| "Modules/posixmodule.c", | |
| "Modules/pwdmodule.c", | |
| "Modules/signalmodule.c", | |
| "Modules/symtablemodule.c", | |
| "Modules/timemodule.c", | |
| "Modules/xxsubtype.c", | |
| "Modules/zipimport.c", | |
| "Objects/abstract.c", | |
| "Objects/accu.c", | |
| "Objects/boolobject.c", | |
| "Objects/bytearrayobject.c", | |
| "Objects/bytes_methods.c", | |
| "Objects/bytesobject.c", | |
| "Objects/call.c", | |
| "Objects/capsule.c", | |
| "Objects/cellobject.c", | |
| "Objects/classobject.c", | |
| "Objects/codeobject.c", | |
| "Objects/complexobject.c", | |
| "Objects/descrobject.c", | |
| "Objects/dictobject.c", | |
| "Objects/enumobject.c", | |
| "Objects/exceptions.c", | |
| "Objects/fileobject.c", | |
| "Objects/floatobject.c", | |
| "Objects/frameobject.c", | |
| "Objects/funcobject.c", | |
| "Objects/genobject.c", | |
| "Objects/iterobject.c", | |
| "Objects/listobject.c", | |
| "Objects/longobject.c", | |
| "Objects/memoryobject.c", | |
| "Objects/methodobject.c", | |
| "Objects/moduleobject.c", | |
| "Objects/namespaceobject.c", | |
| "Objects/object.c", | |
| "Objects/obmalloc.c", | |
| "Objects/odictobject.c", | |
| "Objects/rangeobject.c", | |
| "Objects/setobject.c", | |
| "Objects/sliceobject.c", | |
| "Objects/structseq.c", | |
| "Objects/tupleobject.c", | |
| "Objects/typeobject.c", | |
| "Objects/typeslots.inc", | |
| "Objects/unicodectype.c", | |
| "Objects/unicodeobject.c", | |
| "Objects/weakrefobject.c", | |
| "Python/Python-ast.c", | |
| "Python/_warnings.c", | |
| "Python/asdl.c", | |
| "Python/ast.c", | |
| "Python/ast_opt.c", | |
| "Python/ast_unparse.c", | |
| "Python/bltinmodule.c", | |
| "Python/bootstrap_hash.c", | |
| "Python/ceval.c", | |
| "Python/codecs.c", | |
| "Python/compile.c", | |
| "Python/context.c", | |
| "Python/dtoa.c", | |
| "Python/dynamic_annotations.c", | |
| "Python/errors.c", | |
| "Python/fileutils.c", | |
| "Python/formatter_unicode.c", | |
| "Python/frozenmain.c", | |
| "Python/future.c", | |
| "Python/getargs.c", | |
| "Python/getcompiler.c", | |
| "Python/getcopyright.c", | |
| "Python/getopt.c", | |
| "Python/getplatform.c", | |
| "Python/getversion.c", | |
| "Python/graminit.c", | |
| "Python/hamt.c", | |
| "Python/import.c", | |
| "Python/importdl.c", | |
| "Python/marshal.c", | |
| "Python/modsupport.c", | |
| "Python/mysnprintf.c", | |
| "Python/mystrtoul.c", | |
| "Python/pathconfig.c", | |
| "Python/peephole.c", | |
| "Python/pyarena.c", | |
| "Python/pyctype.c", | |
| "Python/pyfpe.c", | |
| "Python/pyhash.c", | |
| "Python/pylifecycle.c", | |
| "Python/pymath.c", | |
| "Python/pystate.c", | |
| "Python/pystrcmp.c", | |
| "Python/pystrhex.c", | |
| "Python/pystrtod.c", | |
| "Python/pythonrun.c", | |
| "Python/pytime.c", | |
| "Python/structmember.c", | |
| "Python/symtable.c", | |
| "Python/sysmodule.c", | |
| "Python/thread.c", | |
| "Python/traceback.c", | |
| ], | |
| hdrs = glob([ | |
| "Python/**/*.h", | |
| "Modules/**/*.h", | |
| "Objects/**/*.h", | |
| ]) + ["pyconfig.h"], | |
| copts = PY_CORE_CFLAGS, | |
| linkopts = LIBS, | |
| visibility = ["//visibility:public"], | |
| deps = [ | |
| ":dynload_shlib", | |
| ":frozen", | |
| ":getbuildinfo", | |
| ":getpath", | |
| ":includes", | |
| ":parser_objs", | |
| ], | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment