Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions extra/nrnivmodl-core.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@ params_MODS_PATH="."
params_BUILD_TYPE="@COMPILE_LIBRARY_TYPE@"

# prefix for common options : make sure to rename these if options are changed.
MAKE_OPTIONS="MECHLIB_SUFFIX NMODL_BINARY DEST_DIR INCFLAGS LINKFLAGS MODS_PATH VERBOSE BUILD_TYPE"
MAKE_OPTIONS="MECHLIB_SUFFIX NMODL_BINARY NMODL_RUNTIME_FLAGS DEST_DIR INCFLAGS LINKFLAGS MODS_PATH VERBOSE BUILD_TYPE"

# parse CLI args
while getopts "n:m:v:d:i:l:p:b:hV" OPT; do
while getopts "n:m:a:d:i:l:V:p:b:h" OPT; do
case "$OPT" in
n)
# suffix for mechanism library
params_MECHLIB_SUFFIX="$OPTARG";;
m)
# nmodl or mod2c binary to use
params_NMODL_BINARY="$OPTARG";;
a)
# additional nmodl flags to be used
params_NMODL_RUNTIME_FLAGS="$OPTARG";;
d)
# destination install directory
params_DEST_DIR="$OPTARG";;
Expand All @@ -52,14 +55,15 @@ while getopts "n:m:v:d:i:l:p:b:hV" OPT; do
h)
echo "$APP_NAME [options, ...] [mods_path]"
echo "Options:"
echo " -n <name> The model name, used as a suffix in the shared library"
echo " -m <mod2c_bin> NMODL code generation compiler path"
echo " -i <incl_flags> Definitions passed to the compiler, typically '-I dir..'"
echo " -l <link_flags> Definitions passed to the linker, typically '-Lx -lylib..'"
echo " -d <dest_dir> Install to dest_dir. Default: Off."
echo " -V Verbose: show commands executed by make"
echo " -p <n_procs> Number of parallel builds (Default: $PARALLEL_BUILDS)"
echo " -b <STATIC|SHARED> libcorenrnmech library type"
echo " -n <name> The model name, used as a suffix in the shared library"
echo " -m <nmodl_bin> NMODL/mod2c code generation compiler path"
echo " -a <nmodl_runtime_flags> Runtime flags for NMODL/mod2c"
echo " -i <incl_flags> Definitions passed to the compiler, typically '-I dir..'"
echo " -l <link_flags> Definitions passed to the linker, typically '-Lx -lylib..'"
echo " -d <dest_dir> Install to dest_dir. Default: Off."
echo " -V Verbose: show commands executed by make"
echo " -p <n_procs> Number of parallel builds (Default: $PARALLEL_BUILDS)"
echo " -b <STATIC|SHARED> libcorenrnmech library type"
exit 0;;
?)
exit 1;;
Expand Down
11 changes: 9 additions & 2 deletions extra/nrnivmodl_core_makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ ALL_OBJS = $(MOD_FUNC_OBJ) $(DIMPLIC_OBJ) $(mod_cpp_objs) $(mod_ispc_objs)
C_RESET := \033[0m
C_GREEN := \033[32m

# Default nmodl flags. Override if NMODL_RUNTIME_FLAGS is not empty
NMODL_FLAGS_ISPC = $(if $(NMODL_RUNTIME_FLAGS),$(NMODL_RUNTIME_FLAGS),@nmodl_arguments_ispc@)
NMODL_FLAGS_C = $(if $(NMODL_RUNTIME_FLAGS),$(NMODL_RUNTIME_FLAGS),@nmodl_arguments_c@)
$(info Default nmodl flags: $(if (@CORENRN_ENABLE_ISPC@ == ON), @nmodl_arguments_ispc@, @nmodl_arguments_c@))
ifneq ($(NMODL_RUNTIME_FLAGS),)
$(warning Runtime nmodl flags (they replace the default ones): $(NMODL_RUNTIME_FLAGS))
endif

# ======== MAIN BUILD RULES ============

Expand Down Expand Up @@ -186,11 +193,11 @@ $(MOD_OBJS_DIR)/%.obj: $(MOD_TO_CPP_DIR)/%.ispc | $(MOD_OBJS_DIR)

# translate MOD files to ISPC using NMODL
$(mod_ispc_files): $(MOD_TO_CPP_DIR)/%.ispc: $(MODS_PATH)/%.mod | $(MOD_TO_CPP_DIR)
$(NMODL_ENV_VAR) $(NMODL_BINARY_PATH) $< -o $(MOD_TO_CPP_DIR)/ @nmodl_arguments_ispc@
$(NMODL_ENV_VAR) $(NMODL_BINARY_PATH) $< -o $(MOD_TO_CPP_DIR)/ $(NMODL_FLAGS_ISPC)

# translate MOD files to CPP using mod2c/NMODL
$(mod_cpp_files): $(MOD_TO_CPP_DIR)/%.cpp: $(MODS_PATH)/%.mod | $(MOD_TO_CPP_DIR)
$(NMODL_ENV_VAR) $(NMODL_BINARY_PATH) $< -o $(MOD_TO_CPP_DIR)/ @nmodl_arguments_c@
$(NMODL_ENV_VAR) $(NMODL_BINARY_PATH) $< -o $(MOD_TO_CPP_DIR)/ $(NMODL_FLAGS_C)

# static pattern to set up the dependencies for the previous recipe
$(mod_ispc_cpp_files): $(MOD_TO_CPP_DIR)/%.cpp: $(MOD_TO_CPP_DIR)/%.ispc
Expand Down