1ccba8b64SMathieu Desnoyers# SPDX-License-Identifier: GPL-2.0+ OR MIT
2ccba8b64SMathieu DesnoyersCFLAGS += -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./
3ccba8b64SMathieu DesnoyersLDLIBS += -lpthread
4ccba8b64SMathieu Desnoyers
5ccba8b64SMathieu Desnoyers# Own dependencies because we only want to build against 1st prerequisite, but
6ccba8b64SMathieu Desnoyers# still track changes to header files and depend on shared object.
7ccba8b64SMathieu DesnoyersOVERRIDE_TARGETS = 1
8ccba8b64SMathieu Desnoyers
9ccba8b64SMathieu DesnoyersTEST_GEN_PROGS = basic_test basic_percpu_ops_test param_test \
10ccba8b64SMathieu Desnoyers		param_test_benchmark param_test_compare_twice
11ccba8b64SMathieu Desnoyers
12ccba8b64SMathieu DesnoyersTEST_GEN_PROGS_EXTENDED = librseq.so
13ccba8b64SMathieu Desnoyers
14ccba8b64SMathieu DesnoyersTEST_PROGS = run_param_test.sh
15ccba8b64SMathieu Desnoyers
16ccba8b64SMathieu Desnoyersinclude ../lib.mk
17ccba8b64SMathieu Desnoyers
18ccba8b64SMathieu Desnoyers$(OUTPUT)/librseq.so: rseq.c rseq.h rseq-*.h
19ccba8b64SMathieu Desnoyers	$(CC) $(CFLAGS) -shared -fPIC $< $(LDLIBS) -o $@
20ccba8b64SMathieu Desnoyers
21ccba8b64SMathieu Desnoyers$(OUTPUT)/%: %.c $(TEST_GEN_PROGS_EXTENDED) rseq.h rseq-*.h
22ccba8b64SMathieu Desnoyers	$(CC) $(CFLAGS) $< $(LDLIBS) -lrseq -o $@
23ccba8b64SMathieu Desnoyers
24ccba8b64SMathieu Desnoyers$(OUTPUT)/param_test_benchmark: param_test.c $(TEST_GEN_PROGS_EXTENDED) \
25ccba8b64SMathieu Desnoyers					rseq.h rseq-*.h
26ccba8b64SMathieu Desnoyers	$(CC) $(CFLAGS) -DBENCHMARK $< $(LDLIBS) -lrseq -o $@
27ccba8b64SMathieu Desnoyers
28ccba8b64SMathieu Desnoyers$(OUTPUT)/param_test_compare_twice: param_test.c $(TEST_GEN_PROGS_EXTENDED) \
29ccba8b64SMathieu Desnoyers					rseq.h rseq-*.h
30ccba8b64SMathieu Desnoyers	$(CC) $(CFLAGS) -DRSEQ_COMPARE_TWICE $< $(LDLIBS) -lrseq -o $@
31