Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Nov 24, 2024
1 parent 97dbdfa commit 7ba5e2d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

<details>

- [`b0e68c5`](https://github.com/stdlib-js/stdlib/commit/b0e68c5bc8ee985794eb2ea1791c9337cd15fbd0) - **chore:** update to modern benchmark Makefile _(by Philipp Burckhardt)_
- [`d8a4cfb`](https://github.com/stdlib-js/stdlib/commit/d8a4cfb578a949ed07c7a18749e48096f4f9b488) - **revert:** chore: update to modern benchmark Makefile _(by Philipp Burckhardt)_
- [`97a27cf`](https://github.com/stdlib-js/stdlib/commit/97a27cf2746042026c3e68416b7c5f9da2bb24d9) - **chore:** update to modern benchmark Makefile _(by Philipp Burckhardt)_
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_
Expand Down
56 changes: 38 additions & 18 deletions benchmark/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

ifndef VERBOSE
QUIET := @
else
QUIET :=
endif

# Determine the OS:
# Determine the OS ([1][1], [2][2]).
#
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
# [2]: http://stackoverflow.com/a/27776822/2225624
Expand All @@ -36,6 +38,10 @@ ifneq (, $(findstring MSYS,$(OS)))
else
ifneq (, $(findstring CYGWIN,$(OS)))
OS := WINNT
else
ifneq (, $(findstring Windows_NT,$(OS)))
OS := WINNT
endif
endif
endif
endif
Expand All @@ -54,7 +60,7 @@ CFLAGS ?= \
-Wall \
-pedantic

# Determine whether to generate [position independent code][1]:
# Determine whether to generate position independent code ([1][1], [2][2]).
#
# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
Expand All @@ -68,39 +74,53 @@ endif
c_targets := benchmark.out


# TARGETS #
# RULES #

# Default target.
#/
# Compiles C source files.
#
# This target is the default target.

# @param {string} [C_COMPILER] - C compiler
# @param {string} [CFLAGS] - C compiler flags
# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code
#
# @example
# make
#
# @example
# make all
#/
all: $(c_targets)

.PHONY: all


# Compile C source.
#/
# Compiles C source files.
#
# This target compiles C source files.

# @private
# @param {string} CC - C compiler
# @param {string} CFLAGS - C compiler flags
# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code
#/
$(c_targets): %.out: %.c
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -o $@ $< -lm


# Run a benchmark.
#/
# Runs compiled benchmarks.
#
# This target runs a benchmark.

# @example
# make run
#/
run: $(c_targets)
$(QUIET) ./$<

.PHONY: run


# Perform clean-up.
#/
# Removes generated files.
#
# This target removes generated files.

# @example
# make clean
#/
clean:
$(QUIET) -rm -f *.o *.out

Expand Down

0 comments on commit 7ba5e2d

Please sign in to comment.