xref: /linux/tools/testing/selftests/sync/Makefile (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
282208160SEmilio LópezCFLAGS += -O2 -g -std=gnu89 -pthread -Wall -Wextra
3*5ad0c8e4SMathieu DesnoyersCFLAGS += $(KHDR_INCLUDES)
482208160SEmilio LópezLDFLAGS += -pthread
582208160SEmilio López
6b2fc6adeSShuah Khan.PHONY: all clean
782208160SEmilio López
882208160SEmilio Lópezinclude ../lib.mk
982208160SEmilio López
10b2fc6adeSShuah Khan# lib.mk TEST_CUSTOM_PROGS var is for custom tests that need special
11b2fc6adeSShuah Khan# build rules. lib.mk will run and install them.
12b2fc6adeSShuah Khan
13b2fc6adeSShuah KhanTEST_CUSTOM_PROGS := $(OUTPUT)/sync_test
14b2fc6adeSShuah Khanall: $(TEST_CUSTOM_PROGS)
15b2fc6adeSShuah Khan
1682208160SEmilio LópezOBJS = sync_test.o sync.o
1782208160SEmilio López
1882208160SEmilio LópezTESTS += sync_alloc.o
196a5b7d2cSEmilio LópezTESTS += sync_fence.o
201c5839c6SEmilio LópezTESTS += sync_merge.o
21fdba7cffSEmilio LópezTESTS += sync_wait.o
2254b519f3SEmilio LópezTESTS += sync_stress_parallelism.o
23c52dee50SEmilio LópezTESTS += sync_stress_consumer.o
24499a1d11SEmilio LópezTESTS += sync_stress_merge.o
2582208160SEmilio López
26b2fc6adeSShuah KhanOBJS := $(patsubst %,$(OUTPUT)/%,$(OBJS))
27b2fc6adeSShuah KhanTESTS := $(patsubst %,$(OUTPUT)/%,$(TESTS))
2882208160SEmilio López
29b2fc6adeSShuah Khan$(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
30b2fc6adeSShuah Khan	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
31b2fc6adeSShuah Khan
32b2fc6adeSShuah Khan$(OBJS): $(OUTPUT)/%.o: %.c
33b2c93e30SAnders Roxell	$(CC) -c $^ -o $@ $(CFLAGS)
34b2fc6adeSShuah Khan
35b2fc6adeSShuah Khan$(TESTS): $(OUTPUT)/%.o: %.c
36b2fc6adeSShuah Khan	$(CC) -c $^ -o $@
37b2fc6adeSShuah Khan
38b2fc6adeSShuah KhanEXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)
39