Makefile.inc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Basic OS detection
  2. #
  3. UNAME=$(shell uname)
  4. ifeq "$(UNAME)" "Linux"
  5. OPENAIS_COMPAT=LINUX
  6. endif
  7. ifeq "$(UNAME)" "Darwin"
  8. OPENAIS_COMPAT=DARWIN
  9. endif
  10. ifneq "" "$(findstring BSD,$(UNAME))"
  11. OPENAIS_COMPAT=BSD
  12. endif
  13. ifndef OPENAIS_COMPAT
  14. $(error "OPENAIS_COMPAT cannot be detected, it must be manually defined")
  15. endif
  16. # BUILD_DYNAMIC can be defined to 1 to build for dynamic loading of service
  17. # handler modules. If the developer intends to debug, building without
  18. # dynamic modules should provide an easier route.
  19. ifndef BUILD_DYNAMIC
  20. BUILD_DYNAMIC=1
  21. endif
  22. # OPENAIS_BUILD can be defined as RELEASE or DEBUG
  23. #
  24. ifndef OPENAIS_BUILD
  25. OPENAIS_BUILD=RELEASE
  26. endif
  27. # OPENAIS_PROFILE
  28. # OPENAIS_COVERAGE
  29. # OPENAIS_USER, OPENAIS_GROUP default to ais
  30. #
  31. ifndef OPENAIS_USER
  32. OPENAIS_USER=ais
  33. endif
  34. ifndef OPENAIS_GROUP
  35. OPENAIS_GROUP=ais
  36. endif
  37. # OPENAIS_CONFDIR, directory where configuration files are stored
  38. #
  39. ifndef OPENAIS_CONFDIR
  40. OPENAIS_CONFDIR=/etc/ais
  41. endif
  42. # default CFLAGS, LDFLAGS
  43. #
  44. CFLAGS =
  45. LDFLAGS =
  46. DYFLAGS =
  47. # build CFLAGS, LDFLAGS
  48. #
  49. ifeq (${OPENAIS_BUILD}, RELEASE)
  50. CFLAGS += -O3 -Wall
  51. ifndef OPENAIS_PROFILE
  52. CFLAGS += -fomit-frame-pointer
  53. endif
  54. LDFLAGS +=
  55. endif
  56. ifeq (${OPENAIS_BUILD}, DEBUG)
  57. CFLAGS += -O0 -g -Wall -DDEBUG
  58. LDFLAGS += -g
  59. endif
  60. ifdef OPENAIS_PROFILE
  61. CFLAGS += -pg
  62. LDFLAGS += -pg
  63. endif
  64. ifdef OPENAIS_COVERAGE
  65. CFLAGS += -ftest-coverage -fprofile-arcs
  66. LDFLAGS += -ftest-coverage -fprofile-arcs
  67. endif
  68. # platform specific CFLAGS, LDFLAGS
  69. #
  70. ifeq (${OPENAIS_COMPAT}, LINUX)
  71. CFLAGS += -DOPENAIS_LINUX
  72. LDFLAGS += -ldl -lpthread
  73. DYFLAGS += -rdynamic
  74. endif
  75. ifeq (${OPENAIS_COMPAT}, BSD)
  76. CFLAGS += -DOPENAIS_BSD
  77. LDFLAGS += -pthread
  78. DYFLAGS += -export-dynamic
  79. endif
  80. ifeq (${OPENAIS_COMPAT}, DARWIN)
  81. CFLAGS += -DOPENAIS_DARWIN
  82. LDFLAGS += -lpthread
  83. endif