From 044693b03c4886839df89b64267b9a1fdb21a16f Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Thu, 17 Oct 2024 15:13:21 -0500 Subject: [PATCH] Partial work --- .../makefiles/build_trickify_S_source_hh.py | 18 ++++++++++++++++++ share/trick/makefiles/trickify.mk | 7 ++++++- .../trickified_project/trickified/Makefile | 4 +++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 share/trick/makefiles/build_trickify_S_source_hh.py diff --git a/share/trick/makefiles/build_trickify_S_source_hh.py b/share/trick/makefiles/build_trickify_S_source_hh.py new file mode 100644 index 00000000..64889126 --- /dev/null +++ b/share/trick/makefiles/build_trickify_S_source_hh.py @@ -0,0 +1,18 @@ +from pathlib import Path +import os + +def_ext = ["h", "hh", "hpp", "H", "hxx", "h++"] + +loc = "" +if "TRICKIFY_SOURCE" in os.environ: + loc = os.getenv("TRICKIFY_SOURCE") + +def find_files_by_extension(loc, ext): + path = Path(loc) + files = list(path.rglob(f'*.{ext}')) + return files + +files = find_files_by_extension("/users/plherrin/trick/include/", "hh") +s_source = open("S_source.hh", 'w') +for i in range(len(files)): + s_source.write('#include "' + str(files[i]) + '"\n') diff --git a/share/trick/makefiles/trickify.mk b/share/trick/makefiles/trickify.mk index 9f2ab8c9..3d79c308 100644 --- a/share/trick/makefiles/trickify.mk +++ b/share/trick/makefiles/trickify.mk @@ -50,6 +50,8 @@ # The file into which generated Python modules are zipped. The default # value is python (in the current directory). # +# TRICKIFY_SOURCE +# # ----------------------------------------------------------------------------- # # EXAMPLE: @@ -166,6 +168,9 @@ $(TRICKIFY_PYTHON_DIR): $(SWIG_OBJECTS:.o=.cpp) | $(dir $(TRICKIFY_PYTHON_DIR)) $(info $(call COLOR,Zipping) Python modules into $@) $(call ECHO_AND_LOG,cd .trick && zip -Arq $@ .) +S_source.hh : + python3 ${TRICK_HOME}/share/trick/makefiles/build_trickify_S_source_hh.py + # SWIG_OBJECTS and IO_OBJECTS are meant to contain all of the *_py and io_* # object file names, respectively, by looking at products of ICG and # make_makefile_swig. However, we can't run a rule for ICG before those @@ -197,7 +202,7 @@ $(TRICKIFY_PYTHON_DIR): $(SWIG_OBJECTS:.o=.cpp) | $(dir $(TRICKIFY_PYTHON_DIR)) # dependency list. The method is laid out in more detail here: # http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ -$(BUILD_DIR)S_source.d: | $(BUILD_DIR) +$(BUILD_DIR)S_source.d: | $(BUILD_DIR) S_source.hh $(call ECHO_AND_LOG,$(TRICK_HOME)/bin/trick-ICG $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_ICGFLAGS) S_source.hh) $(call ECHO_AND_LOG,$(TRICK_HOME)/$(LIBEXEC)/trick/make_makefile_swig) $(call ECHO_AND_LOG,$(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh) diff --git a/test/SIM_trickified/trickified_project/trickified/Makefile b/test/SIM_trickified/trickified_project/trickified/Makefile index ae6eb310..1ad40edd 100644 --- a/test/SIM_trickified/trickified_project/trickified/Makefile +++ b/test/SIM_trickified/trickified_project/trickified/Makefile @@ -1,7 +1,9 @@ PROJECT_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..) TRICK_HOME := $(abspath $(PROJECT_HOME)/../../..) -export TRICKIFY_OBJECT_NAME := trickified_myproject.o +export TRICKIFY_SOURCE := $(PROJECT_HOME)/include +export TRICKIFY_BUILD_TYPE := STATIC +export TRICKIFY_OBJECT_NAME := trickified_myproject.a export TRICKIFY_CXX_FLAGS := -I$(PROJECT_HOME)/include -I$(TRICK_HOME)/include all: