Makefile.inc 1.5 KB

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