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