Skip to content

Commit 6ab6eec

Browse files
committed
Add support for specifying linked libraries and library paths
1 parent 33d19ac commit 6ab6eec

File tree

1 file changed

+8
-2
lines changed
  • tools/snippets/benchmark/c/native

1 file changed

+8
-2
lines changed

tools/snippets/benchmark/c/native/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@ else
4646
fPIC ?= -fPIC
4747
endif
4848

49-
# List of includes:
49+
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
5050
INCLUDE ?=
5151

5252
# List of source files:
5353
SOURCE_FILES ?=
5454

55+
# List of libraries (e.g., `-lopenblas -lpthread`):
56+
LIBRARIES ?=
57+
58+
# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
59+
LIBPATH ?=
60+
5561
# List of C targets:
5662
c_targets := TODO.out
5763

@@ -72,7 +78,7 @@ all: $(c_targets)
7278
# This target compiles C source files.
7379

7480
$(c_targets): %.out: %.c
75-
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< -lm
81+
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)
7682

7783

7884
# Run a benchmark.

0 commit comments

Comments
 (0)