-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (27 loc) · 863 Bytes
/
Copy pathMakefile
File metadata and controls
38 lines (27 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Copyright (c) 2019-2026 Praveen Vaddadi. Apache-2.0 License.
CC ?= gcc
CFLAGS = -std=gnu11 -O3 -Wall -pthread -fno-omit-frame-pointer
LDLIBS = -ldl -lm
TIMEOUT ?= 120s
BUILD_DIR = build/$(notdir $(CC))
LIB = $(BUILD_DIR)/libcactus.so
TESTS = fib nqueens matmul quicksort
TEST_BINS = $(addprefix $(BUILD_DIR)/,$(TESTS))
ARGS_fib = 30
ARGS_nqueens = 11
ARGS_matmul = 64
ARGS_quicksort = 10000000
.PHONY: all lib test clean
all: lib $(TEST_BINS)
lib: $(LIB)
test: $(addprefix run-,$(TESTS))
$(BUILD_DIR):
mkdir -p $@
$(LIB): cactus.c cactus.h | $(BUILD_DIR)
$(CC) $(CFLAGS) -fPIC -shared $< $(LDLIBS) -o $@
$(BUILD_DIR)/%: tests/%.c tests/test.h $(LIB)
$(CC) $(CFLAGS) -I. $< -L$(BUILD_DIR) -lcactus $(LDLIBS) -Wl,-rpath,'$$ORIGIN' -o $@
run-%: $(BUILD_DIR)/%
@timeout $(TIMEOUT) $< $(ARGS_$*)
clean:
rm -rf build