Makefile.inc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 -DDEBUG
  51. # -Wstrict-aliasing=2 TODO sameday fix all of these
  52. ifndef OPENAIS_PROFILE
  53. CFLAGS += -fomit-frame-pointer
  54. endif
  55. LDFLAGS +=
  56. endif
  57. ifeq (${OPENAIS_BUILD}, DEBUG)
  58. CFLAGS += -O0 -g -Wall -DDEBUG
  59. LDFLAGS += -g
  60. endif
  61. ifdef OPENAIS_PROFILE
  62. CFLAGS += -pg
  63. LDFLAGS += -pg
  64. endif
  65. ifdef OPENAIS_COVERAGE
  66. CFLAGS += -ftest-coverage -fprofile-arcs
  67. LDFLAGS += -ftest-coverage -fprofile-arcs
  68. endif
  69. # platform specific CFLAGS, LDFLAGS
  70. #
  71. ifeq (${OPENAIS_COMPAT}, LINUX)
  72. CFLAGS += -DOPENAIS_LINUX
  73. LDFLAGS += -ldl -lpthread
  74. DYFLAGS += -rdynamic
  75. endif
  76. ifeq (${OPENAIS_COMPAT}, BSD)
  77. CFLAGS += -DOPENAIS_BSD
  78. LDFLAGS += -pthread
  79. DYFLAGS += -export-dynamic
  80. endif
  81. ifeq (${OPENAIS_COMPAT}, DARWIN)
  82. CFLAGS += -DOPENAIS_DARWIN
  83. LDFLAGS += -lpthread
  84. endif