2021-08-08 21:19:30 +00:00
|
|
|
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
|
|
|
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
|
|
|
|
|
|
|
PKGS += THIRD_PARTY_PYTHON
|
|
|
|
|
|
|
|
THIRD_PARTY_PYTHON_ARTIFACTS = THIRD_PARTY_PYTHON_A
|
|
|
|
THIRD_PARTY_PYTHON = $(THIRD_PARTY_PYTHON_DEPS) $(THIRD_PARTY_PYTHON_A)
|
|
|
|
THIRD_PARTY_PYTHON_A = o/$(MODE)/third_party/python/libpython3.6m.a
|
|
|
|
|
|
|
|
include third_party/python/python-modules.mk
|
|
|
|
include third_party/python/python-stdlib.mk
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_OBJECT_SRCS_C = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(wildcard third_party/python/Objects/*.c)
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_PARSER_SKIP_SRCS_C = \
|
|
|
|
third_party/python/Parser/tokenizer_pgen.c \
|
|
|
|
third_party/python/Parser/pgenmain.c \
|
|
|
|
third_party/python/Parser/printgrammar.c \
|
|
|
|
third_party/python/Parser/parsetok_pgen.c
|
|
|
|
THIRD_PARTY_PYTHON_PARSER_SRCS_C = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(filter-out $(THIRD_PARTY_PYTHON_PARSER_SKIP_SRCS_C),$(wildcard third_party/python/Parser/*.c))
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_CORE_SKIP_SRCS_C = \
|
|
|
|
third_party/python/Python/dynload_%.c \
|
|
|
|
third_party/python/Python/strdup.c \
|
2021-08-08 21:19:30 +00:00
|
|
|
third_party/python/Python/thread.c
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_CORE_SRCS_C = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(filter-out $(THIRD_PARTY_PYTHON_CORE_SKIP_SRCS_C),$(wildcard third_party/python/Python/*.c)) \
|
|
|
|
third_party/python/Python/dynload_shlib.c
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_SRCS_C = \
|
|
|
|
third_party/python/Programs/python.c \
|
|
|
|
$(THIRD_PARTY_PYTHON_OBJECT_SRCS_C) \
|
|
|
|
$(THIRD_PARTY_PYTHON_PARSER_SRCS_C) \
|
|
|
|
$(THIRD_PARTY_PYTHON_CORE_SRCS_C) \
|
|
|
|
$(THIRD_PARTY_PYTHON_MODULES_SRCS_C)
|
2021-08-08 21:19:30 +00:00
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_OBJS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_SRCS_C:%.c=o/$(MODE)/%.o)
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_A_OBJS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(filter-out o/$(MODE)/third_party/python/Programs/python.o,$(THIRD_PARTY_PYTHON_OBJS))
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_BINS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_COMS) $(THIRD_PARTY_PYTHON_COMS:%=%.dbg)
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_COMS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
o/$(MODE)/third_party/python/python.com
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_A_CHECKS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_A).pkg
|
|
|
|
# add .h.ok check here
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_A_DIRECTDEPS0 = \
|
|
|
|
$(THIRD_PARTY_PYTHON_MODULES_DIRECTDEPS) \
|
|
|
|
LIBC_ALG \
|
|
|
|
LIBC_BITS \
|
|
|
|
LIBC_CALLS \
|
|
|
|
LIBC_FMT \
|
|
|
|
LIBC_INTRIN \
|
|
|
|
LIBC_LOG \
|
|
|
|
LIBC_MEM \
|
|
|
|
LIBC_NEXGEN32E \
|
|
|
|
LIBC_RAND \
|
|
|
|
LIBC_RUNTIME \
|
|
|
|
LIBC_SOCK \
|
|
|
|
LIBC_DNS \
|
|
|
|
LIBC_STDIO \
|
|
|
|
LIBC_STR \
|
|
|
|
LIBC_STUBS \
|
|
|
|
LIBC_SYSV \
|
|
|
|
LIBC_SYSV_CALLS \
|
|
|
|
LIBC_TIME \
|
|
|
|
LIBC_TINYMATH \
|
|
|
|
LIBC_UNICODE \
|
|
|
|
LIBC_ZIPOS \
|
|
|
|
THIRD_PARTY_GDTOA \
|
|
|
|
THIRD_PARTY_GETOPT \
|
|
|
|
THIRD_PARTY_MUSL \
|
|
|
|
THIRD_PARTY_ZLIB
|
|
|
|
|
|
|
|
THIRD_PARTY_PYTHON_A_DIRECTDEPS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(call uniq,$(THIRD_PARTY_PYTHON_A_DIRECTDEPS0))
|
2021-08-09 13:52:35 +00:00
|
|
|
THIRD_PARTY_PYTHON_A_DEPS = \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(call uniq,$(foreach x,$(THIRD_PARTY_PYTHON_A_DIRECTDEPS),$($(x))))
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
o/$(MODE)/third_party/python/python.com.dbg: \
|
|
|
|
$(THIRD_PARTY_PYTHON_A_DEPS) \
|
|
|
|
$(THIRD_PARTY_PYTHON_A) \
|
|
|
|
$(THIRD_PARTY_PYTHON_STDLIB_PY_OBJS) \
|
|
|
|
o/$(MODE)/third_party/python/Programs/python.o \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(CRT) \
|
2021-08-09 13:52:35 +00:00
|
|
|
$(APE)
|
2021-08-08 21:19:30 +00:00
|
|
|
-@$(APELINK)
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_A): \
|
|
|
|
third_party/python \
|
|
|
|
$(THIRD_PARTY_PYTHON_A).pkg \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_A_OBJS)
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_A).pkg: \
|
|
|
|
$(THIRD_PARTY_PYTHON_A_OBJS) \
|
2021-08-08 21:19:30 +00:00
|
|
|
$(foreach x,$(THIRD_PARTY_PYTHON_A_DIRECTDEPS),$($(x)_A).pkg)
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_OBJS): \
|
|
|
|
OVERRIDE_CFLAGS += \
|
|
|
|
-DPy_BUILD_CORE \
|
|
|
|
-DPLATFORM='"linux"' \
|
|
|
|
-DMULTIARCH='"x86_64-linux-gnu"' \
|
|
|
|
-isystem libc/isystem \
|
|
|
|
-Ithird_party/python \
|
2021-08-08 21:19:30 +00:00
|
|
|
-Ithird_party/python/Include
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
o/$(MODE)/third_party/python/Programs/python.o \
|
|
|
|
o/$(MODE)/third_party/python/Python/marshal.o \
|
|
|
|
o/$(MODE)/third_party/python/Python/sysmodule.o \
|
|
|
|
o/$(MODE)/third_party/python/Modules/selectmodule.o \
|
|
|
|
o/$(MODE)/third_party/python/Modules/getpath.o \
|
|
|
|
o/$(MODE)/third_party/python/Objects/listobject.o: \
|
|
|
|
OVERRIDE_CFLAGS += \
|
2021-08-08 21:19:30 +00:00
|
|
|
-DSTACK_FRAME_UNLIMITED
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
o/$(MODE)/third_party/python/Python/dynload_shlib.o: \
|
|
|
|
OVERRIDE_CFLAGS += \
|
2021-08-08 21:19:30 +00:00
|
|
|
-DSOABI='"cpython36m-x86_64-linux-gnu"'
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
o/$(MODE)/third_party/python/Python/sysmodule.o: \
|
|
|
|
OVERRIDE_CFLAGS += \
|
2021-08-08 21:19:30 +00:00
|
|
|
-DABIFLAGS='"m"'
|
|
|
|
|
|
|
|
|
2021-08-09 13:52:35 +00:00
|
|
|
$(THIRD_PARTY_PYTHON_OBJS): \
|
|
|
|
third_party/python/python.mk \
|
2021-08-08 21:19:30 +00:00
|
|
|
third_party/python/python-modules.mk
|
|
|
|
|
|
|
|
.PHONY: o/$(MODE)/third_party/python
|
2021-08-09 13:52:35 +00:00
|
|
|
o/$(MODE)/third_party/python: \
|
|
|
|
$(THIRD_PARTY_PYTHON_BINS) \
|
|
|
|
$(THIRD_PARTY_PYTHON_CHECKS)
|