Makefile.inc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. # default CFLAGS, LDFLAGS
  38. #
  39. CFLAGS =
  40. LDFLAGS =
  41. DYFLAGS =
  42. # build CFLAGS, LDFLAGS
  43. #
  44. ifeq (${OPENAIS_BUILD}, RELEASE)
  45. CFLAGS += -O3 -Wall
  46. ifndef OPENAIS_PROFILE
  47. CFLAGS += -fomit-frame-pointer
  48. endif
  49. LDFLAGS +=
  50. endif
  51. ifeq (${OPENAIS_BUILD}, DEBUG)
  52. CFLAGS += -O0 -g -Wall
  53. LDFLAGS += -g
  54. endif
  55. ifdef OPENAIS_PROFILE
  56. CFLAGS += -pg
  57. LDFLAGS += -pg
  58. endif
  59. ifdef OPENAIS_COVERAGE
  60. CFLAGS += -ftest-coverage -fprofile-arcs
  61. LDFLAGS += -ftest-coverage -fprofile-arcs
  62. endif
  63. # platform specific CFLAGS, LDFLAGS
  64. #
  65. ifeq (${OPENAIS_COMPAT}, LINUX)
  66. CFLAGS += -DOPENAIS_LINUX
  67. LDFLAGS += -ldl -lpthread
  68. DYFLAGS += -rdynamic
  69. endif
  70. ifeq (${OPENAIS_COMPAT}, BSD)
  71. CFLAGS += -DOPENAIS_BSD
  72. LDFLAGS += -pthread
  73. DYFLAGS += -export-dynamic
  74. endif
  75. ifeq (${OPENAIS_COMPAT}, DARWIN)
  76. CFLAGS += -DOPENAIS_DARWIN
  77. LDFLAGS += -lpthread
  78. endif