18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ciCFLAGS += -O2 -g -std=gnu89 -pthread -Wall -Wextra
38c2ecf20Sopenharmony_ciCFLAGS += -I../../../../usr/include/
48c2ecf20Sopenharmony_ciLDFLAGS += -pthread
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci.PHONY: all clean
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciinclude ../lib.mk
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci# lib.mk TEST_CUSTOM_PROGS var is for custom tests that need special
118c2ecf20Sopenharmony_ci# build rules. lib.mk will run and install them.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciTEST_CUSTOM_PROGS := $(OUTPUT)/sync_test
148c2ecf20Sopenharmony_ciall: $(TEST_CUSTOM_PROGS)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciOBJS = sync_test.o sync.o
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciTESTS += sync_alloc.o
198c2ecf20Sopenharmony_ciTESTS += sync_fence.o
208c2ecf20Sopenharmony_ciTESTS += sync_merge.o
218c2ecf20Sopenharmony_ciTESTS += sync_wait.o
228c2ecf20Sopenharmony_ciTESTS += sync_stress_parallelism.o
238c2ecf20Sopenharmony_ciTESTS += sync_stress_consumer.o
248c2ecf20Sopenharmony_ciTESTS += sync_stress_merge.o
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciOBJS := $(patsubst %,$(OUTPUT)/%,$(OBJS))
278c2ecf20Sopenharmony_ciTESTS := $(patsubst %,$(OUTPUT)/%,$(TESTS))
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci$(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
308c2ecf20Sopenharmony_ci	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci$(OBJS): $(OUTPUT)/%.o: %.c
338c2ecf20Sopenharmony_ci	$(CC) -c $^ -o $@ $(CFLAGS)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci$(TESTS): $(OUTPUT)/%.o: %.c
368c2ecf20Sopenharmony_ci	$(CC) -c $^ -o $@
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciEXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS)
39