Skip to content

Commit dc62f61

Browse files
committed
build: add separate configurations for benchmarks and examples
1 parent eb88d43 commit dc62f61

File tree

3 files changed

+260
-15
lines changed

3 files changed

+260
-15
lines changed

lib/node_modules/@stdlib/blas/base/saxpy/benchmark/c/Makefile

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,17 @@ else
6969
fPIC ?= -fPIC
7070
endif
7171

72+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73+
INCLUDE ?=
74+
7275
# List of source files:
73-
c_src := ../../src/saxpy.c
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 ?=
7483

7584
# List of C targets:
7685
c_targets := benchmark.length.out
@@ -79,11 +88,15 @@ c_targets := benchmark.length.out
7988
# RULES #
8089

8190
#/
82-
# Compiles C source files.
91+
# Compiles source files.
8392
#
8493
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
8594
# @param {string} [CFLAGS] - C compiler options
86-
# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`)
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`)
87100
#
88101
# @example
89102
# make
@@ -99,12 +112,16 @@ all: $(c_targets)
99112
# Compiles C source files.
100113
#
101114
# @private
102-
# @param {string} CC - C compiler
103-
# @param {string} CFLAGS - C compiler flags
104-
# @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`)
105122
#/
106123
$(c_targets): %.out: %.c
107-
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -I ../../include -o $@ $(c_src) $< -lm
124+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
108125

109126
#/
110127
# Runs compiled benchmarks.

lib/node_modules/@stdlib/blas/base/saxpy/examples/c/Makefile

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,17 @@ else
6969
fPIC ?= -fPIC
7070
endif
7171

72+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
73+
INCLUDE ?=
74+
7275
# List of source files:
73-
c_src := ../../src/saxpy.c
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 ?=
7483

7584
# List of C targets:
7685
c_targets := example.out
@@ -79,11 +88,15 @@ c_targets := example.out
7988
# RULES #
8089

8190
#/
82-
# Compiles C source files.
91+
# Compiles source files.
8392
#
8493
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
8594
# @param {string} [CFLAGS] - C compiler options
86-
# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`)
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`)
87100
#
88101
# @example
89102
# make
@@ -99,15 +112,19 @@ all: $(c_targets)
99112
# Compiles C source files.
100113
#
101114
# @private
102-
# @param {string} CC - C compiler
103-
# @param {string} CFLAGS - C compiler flags
104-
# @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`)
105122
#/
106123
$(c_targets): %.out: %.c
107-
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -I ../../include -o $@ $(c_src) $< -lm
124+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
108125

109126
#/
110-
# Runs compiled benchmarks.
127+
# Runs compiled examples.
111128
#
112129
# @example
113130
# make run

lib/node_modules/@stdlib/blas/base/saxpy/manifest.json

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"options": {
3+
"task": "build",
34
"os": "linux",
45
"blas": "",
56
"wasm": false
@@ -28,6 +29,7 @@
2829
],
2930
"confs": [
3031
{
32+
"task": "build",
3133
"os": "linux",
3234
"blas": "",
3335
"wasm": false,
@@ -49,6 +51,38 @@
4951
]
5052
},
5153
{
54+
"task": "benchmark",
55+
"os": "linux",
56+
"blas": "",
57+
"wasm": false,
58+
"src": [
59+
"./src/saxpy.c"
60+
],
61+
"include": [
62+
"./include"
63+
],
64+
"libraries": [],
65+
"libpath": [],
66+
"dependencies": []
67+
},
68+
{
69+
"task": "examples",
70+
"os": "linux",
71+
"blas": "",
72+
"wasm": false,
73+
"src": [
74+
"./src/saxpy.c"
75+
],
76+
"include": [
77+
"./include"
78+
],
79+
"libraries": [],
80+
"libpath": [],
81+
"dependencies": []
82+
},
83+
84+
{
85+
"task": "build",
5286
"os": "linux",
5387
"blas": "openblas",
5488
"wasm": false,
@@ -72,6 +106,44 @@
72106
]
73107
},
74108
{
109+
"task": "benchmark",
110+
"os": "linux",
111+
"blas": "openblas",
112+
"wasm": false,
113+
"src": [
114+
"./src/saxpy_cblas.c"
115+
],
116+
"include": [
117+
"./include"
118+
],
119+
"libraries": [
120+
"-lopenblas",
121+
"-lpthread"
122+
],
123+
"libpath": [],
124+
"dependencies": []
125+
},
126+
{
127+
"task": "examples",
128+
"os": "linux",
129+
"blas": "openblas",
130+
"wasm": false,
131+
"src": [
132+
"./src/saxpy_cblas.c"
133+
],
134+
"include": [
135+
"./include"
136+
],
137+
"libraries": [
138+
"-lopenblas",
139+
"-lpthread"
140+
],
141+
"libpath": [],
142+
"dependencies": []
143+
},
144+
145+
{
146+
"task": "build",
75147
"os": "mac",
76148
"blas": "",
77149
"wasm": false,
@@ -93,6 +165,38 @@
93165
]
94166
},
95167
{
168+
"task": "benchmark",
169+
"os": "mac",
170+
"blas": "",
171+
"wasm": false,
172+
"src": [
173+
"./src/saxpy.c"
174+
],
175+
"include": [
176+
"./include"
177+
],
178+
"libraries": [],
179+
"libpath": [],
180+
"dependencies": []
181+
},
182+
{
183+
"task": "examples",
184+
"os": "mac",
185+
"blas": "",
186+
"wasm": false,
187+
"src": [
188+
"./src/saxpy.c"
189+
],
190+
"include": [
191+
"./include"
192+
],
193+
"libraries": [],
194+
"libpath": [],
195+
"dependencies": []
196+
},
197+
198+
{
199+
"task": "build",
96200
"os": "mac",
97201
"blas": "apple_accelerate_framework",
98202
"wasm": false,
@@ -115,6 +219,42 @@
115219
]
116220
},
117221
{
222+
"task": "benchmark",
223+
"os": "mac",
224+
"blas": "apple_accelerate_framework",
225+
"wasm": false,
226+
"src": [
227+
"./src/saxpy_cblas.c"
228+
],
229+
"include": [
230+
"./include"
231+
],
232+
"libraries": [
233+
"-lblas"
234+
],
235+
"libpath": [],
236+
"dependencies": []
237+
},
238+
{
239+
"task": "examples",
240+
"os": "mac",
241+
"blas": "apple_accelerate_framework",
242+
"wasm": false,
243+
"src": [
244+
"./src/saxpy_cblas.c"
245+
],
246+
"include": [
247+
"./include"
248+
],
249+
"libraries": [
250+
"-lblas"
251+
],
252+
"libpath": [],
253+
"dependencies": []
254+
},
255+
256+
{
257+
"task": "build",
118258
"os": "mac",
119259
"blas": "openblas",
120260
"wasm": false,
@@ -138,6 +278,44 @@
138278
]
139279
},
140280
{
281+
"task": "benchmark",
282+
"os": "mac",
283+
"blas": "openblas",
284+
"wasm": false,
285+
"src": [
286+
"./src/saxpy_cblas.c"
287+
],
288+
"include": [
289+
"./include"
290+
],
291+
"libraries": [
292+
"-lopenblas",
293+
"-lpthread"
294+
],
295+
"libpath": [],
296+
"dependencies": []
297+
},
298+
{
299+
"task": "examples",
300+
"os": "mac",
301+
"blas": "openblas",
302+
"wasm": false,
303+
"src": [
304+
"./src/saxpy_cblas.c"
305+
],
306+
"include": [
307+
"./include"
308+
],
309+
"libraries": [
310+
"-lopenblas",
311+
"-lpthread"
312+
],
313+
"libpath": [],
314+
"dependencies": []
315+
},
316+
317+
{
318+
"task": "build",
141319
"os": "win",
142320
"blas": "",
143321
"wasm": false,
@@ -152,11 +330,44 @@
152330
"dependencies": [
153331
"@stdlib/napi/export",
154332
"@stdlib/napi/argv",
333+
"@stdlib/napi/argv-float",
155334
"@stdlib/napi/argv-int64",
156335
"@stdlib/napi/argv-strided-float32array"
157336
]
158337
},
159338
{
339+
"task": "benchmark",
340+
"os": "win",
341+
"blas": "",
342+
"wasm": false,
343+
"src": [
344+
"./src/saxpy.c"
345+
],
346+
"include": [
347+
"./include"
348+
],
349+
"libraries": [],
350+
"libpath": [],
351+
"dependencies": []
352+
},
353+
{
354+
"task": "examples",
355+
"os": "win",
356+
"blas": "",
357+
"wasm": false,
358+
"src": [
359+
"./src/saxpy.c"
360+
],
361+
"include": [
362+
"./include"
363+
],
364+
"libraries": [],
365+
"libpath": [],
366+
"dependencies": []
367+
},
368+
369+
{
370+
"task": "build",
160371
"os": "",
161372
"blas": "",
162373
"wasm": true,

0 commit comments

Comments
 (0)