Skip to content

Commit 76a5eb2

Browse files
committed
bench: fix makefile and redorder variables
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 47731bb commit 76a5eb2

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

lib/node_modules/@stdlib/math/base/special/minmax/benchmark/c/native/Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# limitations under the License.
1717
#/
1818

19-
2019
# VARIABLES #
2120

2221
ifndef VERBOSE
@@ -70,18 +69,34 @@ else
7069
fPIC ?= -fPIC
7170
endif
7271

72+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73+
INCLUDE ?=
74+
75+
# List of source files:
76+
SOURCE_FILES ?=
77+
78+
# List of libraries (e.g., `-lopenblas -lpthread`):
79+
LIBRARIES ?=
80+
81+
# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
82+
LIBPATH ?=
83+
7384
# List of C targets:
7485
c_targets := benchmark.out
7586

7687

7788
# RULES #
7889

7990
#/
80-
# Compiles C source files.
91+
# Compiles source files.
8192
#
82-
# @param {string} [C_COMPILER] - C compiler
83-
# @param {string} [CFLAGS] - C compiler flags
84-
# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code
93+
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
94+
# @param {string} [CFLAGS] - C compiler options
95+
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
96+
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
97+
# @param {string} [SOURCE_FILES] - list of source files
98+
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
99+
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
85100
#
86101
# @example
87102
# make
@@ -97,12 +112,16 @@ all: $(c_targets)
97112
# Compiles C source files.
98113
#
99114
# @private
100-
# @param {string} CC - C compiler
101-
# @param {string} CFLAGS - C compiler flags
102-
# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code
115+
# @param {string} CC - C compiler (e.g., `gcc`)
116+
# @param {string} CFLAGS - C compiler options
117+
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
118+
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
119+
# @param {string} SOURCE_FILES - list of source files
120+
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
121+
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
103122
#/
104123
$(c_targets): %.out: %.c
105-
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm
124+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
106125

107126
#/
108127
# Runs compiled benchmarks.

lib/node_modules/@stdlib/math/base/special/minmax/benchmark/c/native/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ static double rand_double( void ) {
9090
* @return elapsed time in seconds
9191
*/
9292
static double benchmark( void ) {
93+
double x[ 100 ];
94+
double y[ 100 ];
9395
double elapsed;
9496
double min;
9597
double max;
96-
double x[ 100 ];
97-
double y[ 100 ];
9898
double t;
9999
int i;
100100

0 commit comments

Comments
 (0)