Makefile.inc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Common options
  2. PREFIX=/usr/local
  3. DESTDIR=
  4. # Do not modify below this line
  5. # Basic OS detection
  6. #
  7. UNAME=$(shell uname)
  8. CP=cp
  9. ifeq "$(UNAME)" "Linux"
  10. OPENAIS_COMPAT=LINUX
  11. endif
  12. ifeq "$(UNAME)" "Darwin"
  13. OPENAIS_COMPAT=DARWIN
  14. CP=rsync
  15. endif
  16. ifneq "" "$(findstring BSD,$(UNAME))"
  17. OPENAIS_COMPAT=BSD
  18. endif
  19. ifeq "$(UNAME)" "SunOS"
  20. OPENAIS_COMPAT=SOLARIS
  21. # Note that CC must be set to gcc compiled to link with gnu-ld
  22. endif
  23. ifndef OPENAIS_COMPAT
  24. $(error "OPENAIS_COMPAT cannot be detected, it must be manually defined")
  25. endif
  26. # BUILD_DYNAMIC can be defined to 1 to build for dynamic loading of service
  27. # handler modules. If the developer intends to debug, building without
  28. # dynamic modules should provide an easier route.
  29. ifndef BUILD_DYNAMIC
  30. BUILD_DYNAMIC=1
  31. endif
  32. # OPENAIS_BUILD can be defined as RELEASE or DEBUG
  33. #
  34. ifndef OPENAIS_BUILD
  35. OPENAIS_BUILD=RELEASE
  36. endif
  37. # OPENAIS_PROFILE
  38. # default CFLAGS, LDFLAGS
  39. #
  40. CFLAGS =
  41. LDFLAGS =
  42. DYFLAGS =
  43. # Adding the TS_CLASS flag enables not being scheduled RR
  44. #CFLAGS += -DTS_CLASS
  45. # build CFLAGS, LDFLAGS
  46. #
  47. ifeq (${OPENAIS_BUILD}, RELEASE)
  48. CFLAGS += -O3 -Wall
  49. # -Wstrict-aliasing=2 TODO sameday fix all of these
  50. ifndef OPENAIS_PROFILE
  51. CFLAGS += -fomit-frame-pointer
  52. endif
  53. LDFLAGS +=
  54. endif
  55. ifeq (${OPENAIS_BUILD}, DEBUG)
  56. CFLAGS += -O0 -g -Wall -DDEBUG
  57. LDFLAGS += -g
  58. ifeq (${OPENAIS_COMPAT}, SOLARIS)
  59. CFLAGS += -Werror -DTS_CLASS
  60. endif
  61. endif
  62. ifeq (${OPENAIS_BUILD}, COVERAGE)
  63. CFLAGS += -O0 -g -ftest-coverage -fprofile-arcs
  64. LDFLAGS += -g -ftest-coverage -fprofile-arcs
  65. BUILD_DYNAMIC=0
  66. endif
  67. ifdef OPENAIS_PROFILE
  68. CFLAGS += -pg
  69. LDFLAGS += -pg
  70. endif
  71. # platform specific CFLAGS, LDFLAGS
  72. #
  73. ifeq (${OPENAIS_COMPAT}, LINUX)
  74. override CFLAGS += -DOPENAIS_LINUX
  75. override LDFLAGS += -ldl -lpthread
  76. override DYFLAGS += -rdynamic
  77. endif
  78. ifeq (${OPENAIS_COMPAT}, BSD)
  79. override CFLAGS += -DOPENAIS_BSD
  80. override LDFLAGS += -pthread
  81. override DYFLAGS += -export-dynamic
  82. endif
  83. ifeq (${OPENAIS_COMPAT}, DARWIN)
  84. override CFLAGS += -DOPENAIS_DARWIN
  85. override LDFLAGS += -lpthread
  86. endif
  87. ifeq (${OPENAIS_COMPAT}, SOLARIS)
  88. override CFLAGS += -DOPENAIS_SOLARIS -D_REENTRANT
  89. override LDFLAGS += -lpthread
  90. # See http://sources.redhat.com/ml/bug-gnu-utils/2000-07/msg00168.html
  91. override LDFLAGS += -Wl,--export-dynamic -Wl,-rpath-link=/usr/lib
  92. ifeq ($(shell uname -r), 5.10)
  93. override CFLAGS += -DHAVE_GETPEERUCRED -DHAVE_SCANDIR -DHAVE_ALPHASORT
  94. endif
  95. ifeq ($(shell uname -r), 5.11)
  96. override CFLAGS += -DHAVE_GETPEERUCRED -DHAVE_SCANDIR -DHAVE_ALPHASORT
  97. endif
  98. endif