Makefile.inc 2.5 KB

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