Makefile 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # find the OS
  2. uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
  3. ifeq ($(uname_S),Darwin)
  4. SHOBJ_CFLAGS ?= -W -Wall -dynamic -fno-common -g -ggdb -std=c99 -O2
  5. SHOBJ_LDFLAGS ?= -bundle -undefined dynamic_lookup
  6. else # Linux, others
  7. SHOBJ_CFLAGS ?= -W -Wall -fno-common -g -ggdb -std=c99 -O2
  8. SHOBJ_LDFLAGS ?= -shared
  9. endif
  10. ifeq ($(uname_S),Linux)
  11. LD = gcc
  12. CC = gcc
  13. endif
  14. # OS X 11.x doesn't have /usr/lib/libSystem.dylib and needs an explicit setting.
  15. ifeq ($(uname_S),Darwin)
  16. ifeq ("$(wildcard /usr/lib/libSystem.dylib)","")
  17. LIBS = -L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -lsystem
  18. endif
  19. endif
  20. TEST_MODULES = \
  21. commandfilter.so \
  22. basics.so \
  23. testrdb.so \
  24. fork.so \
  25. infotest.so \
  26. propagate.so \
  27. misc.so \
  28. hooks.so \
  29. blockonkeys.so \
  30. blockonbackground.so \
  31. scan.so \
  32. datatype.so \
  33. datatype2.so \
  34. auth.so \
  35. keyspace_events.so \
  36. blockedclient.so \
  37. getkeys.so \
  38. test_lazyfree.so \
  39. timer.so \
  40. defragtest.so \
  41. keyspecs.so \
  42. hash.so \
  43. zset.so \
  44. stream.so \
  45. aclcheck.so \
  46. list.so \
  47. subcommands.so \
  48. reply.so
  49. .PHONY: all
  50. all: $(TEST_MODULES)
  51. 32bit:
  52. $(MAKE) CFLAGS="-m32" LDFLAGS="-m32"
  53. %.xo: %.c ../../src/redismodule.h
  54. $(CC) -I../../src $(CFLAGS) $(SHOBJ_CFLAGS) -fPIC -c $< -o $@
  55. %.so: %.xo
  56. $(LD) -o $@ $< $(SHOBJ_LDFLAGS) $(LDFLAGS) $(LIBS)
  57. .PHONY: clean
  58. clean:
  59. rm -f $(TEST_MODULES) $(TEST_MODULES:.so=.xo)