From 183d264e9e8576b4ab2f087b33f6532f80edc79a Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Wed, 23 Oct 2019 19:32:35 +0300 Subject: [PATCH] Modules: improve tests Makefile. Removes some boilerplate per module, add clean target. --- tests/modules/Makefile | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/tests/modules/Makefile b/tests/modules/Makefile index 988ecf58a..f357faad2 100644 --- a/tests/modules/Makefile +++ b/tests/modules/Makefile @@ -11,34 +11,25 @@ else SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup endif -.SUFFIXES: .c .so .xo .o +TEST_MODULES = \ + commandfilter.so \ + testrdb.so \ + fork.so \ + infotest.so \ + propagate.so \ + hooks.so -all: commandfilter.so testrdb.so fork.so infotest.so propagate.so hooks.so +.PHONY: all -.c.xo: +all: $(TEST_MODULES) + +%.xo: %.c ../../src/redismodule.h $(CC) -I../../src $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@ -commandfilter.xo: ../../src/redismodule.h -fork.xo: ../../src/redismodule.h -testrdb.xo: ../../src/redismodule.h -infotest.xo: ../../src/redismodule.h -propagate.xo: ../../src/redismodule.h -hooks.xo: ../../src/redismodule.h - -commandfilter.so: commandfilter.xo +%.so: %.xo $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc -fork.so: fork.xo - $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc +.PHONY: clean -testrdb.so: testrdb.xo - $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc - -infotest.so: infotest.xo - $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc - -propagate.so: propagate.xo - $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc - -hooks.so: hooks.xo - $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LIBS) -lc +clean: + rm -f $(TEST_MODULES) $(TEST_MODULES:.so=.xo)