Makefile.inc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. # default CFLAGS, LDFLAGS
  30. #
  31. CFLAGS =
  32. LDFLAGS =
  33. DYFLAGS =
  34. # build CFLAGS, LDFLAGS
  35. #
  36. ifeq (${OPENAIS_BUILD}, RELEASE)
  37. CFLAGS += -O3 -Wall
  38. # -Wstrict-aliasing=2 TODO sameday fix all of these
  39. ifndef OPENAIS_PROFILE
  40. CFLAGS += -fomit-frame-pointer
  41. endif
  42. LDFLAGS +=
  43. endif
  44. ifeq (${OPENAIS_BUILD}, DEBUG)
  45. CFLAGS += -O0 -g -Wall -DDEBUG
  46. LDFLAGS += -g
  47. endif
  48. ifdef OPENAIS_PROFILE
  49. CFLAGS += -pg
  50. LDFLAGS += -pg
  51. endif
  52. ifdef OPENAIS_COVERAGE
  53. CFLAGS += -ftest-coverage -fprofile-arcs
  54. LDFLAGS += -ftest-coverage -fprofile-arcs
  55. endif
  56. # platform specific CFLAGS, LDFLAGS
  57. #
  58. ifeq (${OPENAIS_COMPAT}, LINUX)
  59. override CFLAGS += -DOPENAIS_LINUX
  60. override LDFLAGS += -ldl -lpthread
  61. override DYFLAGS += -rdynamic
  62. endif
  63. ifeq (${OPENAIS_COMPAT}, BSD)
  64. override CFLAGS += -DOPENAIS_BSD
  65. override LDFLAGS += -pthread
  66. override DYFLAGS += -export-dynamic
  67. endif
  68. ifeq (${OPENAIS_COMPAT}, DARWIN)
  69. override CFLAGS += -DOPENAIS_DARWIN
  70. override LDFLAGS += -lpthread
  71. endif