This commit is contained in:
Pherring04 2025-01-13 11:28:26 -06:00
parent c3cd94ea99
commit a2d4455480

View File

@ -106,11 +106,10 @@ BUILD_DIR := $(dir $(MAKE_OUT))
PY_LINK_LIST := $(BUILD_DIR)trickify_py_link_list
IO_LINK_LIST := $(BUILD_DIR)trickify_io_link_list
OBJ_LINK_LIST := trickify_obj_list
UNAME := $(shell uname)
ifdef FULL_TRICKIFY_BUILD
LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST) @$(OBJ_LINK_LIST)
FULL_TRICKIFY_BUILD = "1"
else
LINK_LISTS := @$(IO_LINK_LIST) @$(PY_LINK_LIST)
FULL_TRICKIFY_BUILD = "0"
endif
ifneq ($(wildcard $(BUILD_DIR)),)
SWIG_OBJECTS := $(shell cat $(PY_LINK_LIST))
@ -123,6 +122,7 @@ TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS)
# Ensure we can process all headers
TRICK_EXT_LIB_DIRS := $(TRICKIFY_EXT_LIB_DIRS)
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
SHARED_OPTIONS := -fPIC
else ifeq ($(UNAME), Darwin)
@ -134,22 +134,24 @@ endif
.PHONY: all
all: $(TRICKIFY_OBJECT_NAME) $(TRICKIFY_PYTHON_DIR)
.ONESHELL:
$(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME))
@while read -r line ; do \
export FILES="$$FILES $$line" ; \
done < $(PY_LINK_LIST)
@while read -r line ; do \
export FILES="$$FILES $$line" ; \
done < $(IO_LINK_LIST)
@if [ "$(FULL_TRICKIFY_BUILD)" = "1" ] ; then \
while read -r line ; do \
export FILES="$$FILES $$line" ; \
done < $(OBJ_LINK_LIST)
fi
@if [ "$(TRICKIFY_BUILD_TYPE)" = "PLO" ] ; then \
$(LD) $(LD_PARTIAL) -o $@ $(LINK_LISTS) ; \
$(LD) $(LD_PARTIAL) -o $@ $$FILES ; \
elif [ "$(TRICKIFY_BUILD_TYPE)" = "SHARED" ] ; then \
$(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $(LINK_LISTS) ; \
$(TRICK_CXX) $(SHARED_LIB_OPT) $(SHARED_OPTIONS) -o $@ $$FILES ; \
elif [ "$(TRICKIFY_BUILD_TYPE)" = "STATIC" ] ; then \
export FILES= ; \
while read -r line ; do \
export FILES="$$FILES $$line" ; \
done < $(PY_LINK_LIST) ; \
while read -r line ; do \
export FILES="$$FILES $$line" ; \
done < $(IO_LINK_LIST) ; \
while read -r line ; do \
export FILES="$$FILES $$line" ; \
done < $(OBJ_LINK_LIST) ; \
ar rcs $@ $ $$FILES ; \
fi