Skip to content

Commit d2ef442

Browse files
committed
build: add separate configurations for benchmarks and examples
1 parent 9937304 commit d2ef442

File tree

3 files changed

+259
-15
lines changed

3 files changed

+259
-15
lines changed

lib/node_modules/@stdlib/blas/base/sswap/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/sswap.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/sswap/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/sswap.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/sswap/manifest.json

Lines changed: 210 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,
@@ -48,6 +50,38 @@
4850
]
4951
},
5052
{
53+
"task": "benchmark",
54+
"os": "linux",
55+
"blas": "",
56+
"wasm": false,
57+
"src": [
58+
"./src/sswap.c"
59+
],
60+
"include": [
61+
"./include"
62+
],
63+
"libraries": [],
64+
"libpath": [],
65+
"dependencies": []
66+
},
67+
{
68+
"task": "examples",
69+
"os": "linux",
70+
"blas": "",
71+
"wasm": false,
72+
"src": [
73+
"./src/sswap.c"
74+
],
75+
"include": [
76+
"./include"
77+
],
78+
"libraries": [],
79+
"libpath": [],
80+
"dependencies": []
81+
},
82+
83+
{
84+
"task": "build",
5185
"os": "linux",
5286
"blas": "openblas",
5387
"wasm": false,
@@ -70,6 +104,44 @@
70104
]
71105
},
72106
{
107+
"task": "benchmark",
108+
"os": "linux",
109+
"blas": "openblas",
110+
"wasm": false,
111+
"src": [
112+
"./src/sswap_cblas.c"
113+
],
114+
"include": [
115+
"./include"
116+
],
117+
"libraries": [
118+
"-lopenblas",
119+
"-lpthread"
120+
],
121+
"libpath": [],
122+
"dependencies": []
123+
},
124+
{
125+
"task": "examples",
126+
"os": "linux",
127+
"blas": "openblas",
128+
"wasm": false,
129+
"src": [
130+
"./src/sswap_cblas.c"
131+
],
132+
"include": [
133+
"./include"
134+
],
135+
"libraries": [
136+
"-lopenblas",
137+
"-lpthread"
138+
],
139+
"libpath": [],
140+
"dependencies": []
141+
},
142+
143+
{
144+
"task": "build",
73145
"os": "mac",
74146
"blas": "",
75147
"wasm": false,
@@ -90,6 +162,38 @@
90162
]
91163
},
92164
{
165+
"task": "benchmark",
166+
"os": "mac",
167+
"blas": "",
168+
"wasm": false,
169+
"src": [
170+
"./src/sswap.c"
171+
],
172+
"include": [
173+
"./include"
174+
],
175+
"libraries": [],
176+
"libpath": [],
177+
"dependencies": []
178+
},
179+
{
180+
"task": "examples",
181+
"os": "mac",
182+
"blas": "",
183+
"wasm": false,
184+
"src": [
185+
"./src/sswap.c"
186+
],
187+
"include": [
188+
"./include"
189+
],
190+
"libraries": [],
191+
"libpath": [],
192+
"dependencies": []
193+
},
194+
195+
{
196+
"task": "build",
93197
"os": "mac",
94198
"blas": "apple_accelerate_framework",
95199
"wasm": false,
@@ -111,6 +215,42 @@
111215
]
112216
},
113217
{
218+
"task": "benchmark",
219+
"os": "mac",
220+
"blas": "apple_accelerate_framework",
221+
"wasm": false,
222+
"src": [
223+
"./src/sswap_cblas.c"
224+
],
225+
"include": [
226+
"./include"
227+
],
228+
"libraries": [
229+
"-lblas"
230+
],
231+
"libpath": [],
232+
"dependencies": []
233+
},
234+
{
235+
"task": "examples",
236+
"os": "mac",
237+
"blas": "apple_accelerate_framework",
238+
"wasm": false,
239+
"src": [
240+
"./src/sswap_cblas.c"
241+
],
242+
"include": [
243+
"./include"
244+
],
245+
"libraries": [
246+
"-lblas"
247+
],
248+
"libpath": [],
249+
"dependencies": []
250+
},
251+
252+
{
253+
"task": "build",
114254
"os": "mac",
115255
"blas": "openblas",
116256
"wasm": false,
@@ -133,6 +273,44 @@
133273
]
134274
},
135275
{
276+
"task": "benchmark",
277+
"os": "mac",
278+
"blas": "openblas",
279+
"wasm": false,
280+
"src": [
281+
"./src/sswap_cblas.c"
282+
],
283+
"include": [
284+
"./include"
285+
],
286+
"libraries": [
287+
"-lopenblas",
288+
"-lpthread"
289+
],
290+
"libpath": [],
291+
"dependencies": []
292+
},
293+
{
294+
"task": "examples",
295+
"os": "mac",
296+
"blas": "openblas",
297+
"wasm": false,
298+
"src": [
299+
"./src/sswap_cblas.c"
300+
],
301+
"include": [
302+
"./include"
303+
],
304+
"libraries": [
305+
"-lopenblas",
306+
"-lpthread"
307+
],
308+
"libpath": [],
309+
"dependencies": []
310+
},
311+
312+
{
313+
"task": "build",
136314
"os": "win",
137315
"blas": "",
138316
"wasm": false,
@@ -152,6 +330,38 @@
152330
]
153331
},
154332
{
333+
"task": "benchmark",
334+
"os": "win",
335+
"blas": "",
336+
"wasm": false,
337+
"src": [
338+
"./src/sswap.c"
339+
],
340+
"include": [
341+
"./include"
342+
],
343+
"libraries": [],
344+
"libpath": [],
345+
"dependencies": []
346+
},
347+
{
348+
"task": "examples",
349+
"os": "win",
350+
"blas": "",
351+
"wasm": false,
352+
"src": [
353+
"./src/sswap.c"
354+
],
355+
"include": [
356+
"./include"
357+
],
358+
"libraries": [],
359+
"libpath": [],
360+
"dependencies": []
361+
},
362+
363+
{
364+
"task": "build",
155365
"os": "",
156366
"blas": "",
157367
"wasm": true,

0 commit comments

Comments
 (0)