1 # Copyright (c) 2002-2006 MontaVista Software, Inc.
2 # Copyright (c) 2006 Red Hat, Inc.
6 # This software licensed under BSD license, the text of which follows:
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
11 # - Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # - Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # - Neither the name of the MontaVista Software, Inc. nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 # THE POSSIBILITY OF SUCH DAMAGE.
34 # cleanup the path (make it absolute)
35 builddir
:=$(abspath
$(O
))/
38 $(warning your abspath function is not working
)
39 $(warning
> setting builddir to
$(builddir
))
43 THIS_MAKEFILE
:=$(realpath
$(lastword
$(MAKEFILE_LIST
)))
45 ifeq ($(THIS_MAKEFILE
),)
47 $(warning your realpath function is not working
)
48 $(warning
> setting
srcdir to
$(srcdir))
50 srcdir:=$(dir $(THIS_MAKEFILE
))
53 include $(srcdir)Makefile.inc
55 SBINDIR
=$(PREFIX
)/sbin
56 INCLUDEDIR
=$(PREFIX
)/include/openais
57 INCLUDEDIR_TOTEM
=$(PREFIX
)/include/openais
/totem
58 INCLUDEDIR_LCR
=$(PREFIX
)/include/openais
/lcr
59 INCLUDEDIR_SERVICE
=$(PREFIX
)/include/openais
/service
60 MANDIR
=$(PREFIX
)/share
/man
62 ARCH
=$(shell uname
-p
)
64 ifeq (,$(findstring 64,$(ARCH
)))
65 LIBDIR
=$(PREFIX
)/lib
/openais
67 LIBDIR
=$(PREFIX
)/lib64
/openais
70 LIBDIR
=$(PREFIX
)/lib
/openais
73 LIBDIR
=$(PREFIX
)/lib64
/openais
76 LIBDIR
=$(PREFIX
)/lib
/openais
79 SUBDIRS
:=$(builddir
)lcr
$(builddir
)lib
$(builddir
)exec
$(builddir
)test
80 sub_make
= srcdir=$(srcdir) builddir
=$(builddir
) subdir
=$(1)/ $(MAKE
) -I
$(srcdir)$(1) -f
$(srcdir)$(1)/Makefile
$(2)
83 @
(cd
$(builddir
)lcr
; echo
==== `pwd` ===; $(call sub_make
,lcr
,all));
84 @
(cd
$(builddir
)lib
; echo
==== `pwd` ===; $(call sub_make
,lib
,all));
85 @
(cd
$(builddir
)exec
; echo
==== `pwd` ===; $(call sub_make
,exec
,all));
86 @
(cd
$(builddir
)test; echo
==== `pwd` ===; $(call sub_make
,test,all));
88 # subdirs are not phony
89 .PHONY
: all clean install doxygen
99 @echo
"Requirements: GCC, LD, and a Linux 2.4/2.6 kernel."
101 @echo
" Debian Sarge(i386), Redhat 9(i386), Fedora Core 2 (i386), Fedora Core"
102 @echo
" 4, 5 (i386,x86_64), SOLARIS, MontaVista Carrier Grade Edition 3.1(i386, x86_64,"
103 @echo
" classic ppc, ppc970, xscale) and buildroot/uclibc(ppc e500/603e)"
106 @echo
" all - build all targets"
107 @echo
" install - install openais onto your system"
108 @echo
" clean - remove generated files"
109 @echo
" doxygen - doxygen html docs"
111 @echo
"Options: (* - default)"
112 @echo
" OPENAIS [DEBUG/RELEASE*] - Enable/Disable debug symbols"
113 @echo
" DESTDIR [directory] - Install prefix."
114 @echo
" O [directory] - Locate all output files in \"dir\"."
115 @echo
" BUILD_DYNAMIC [1*/0] - Enable/disable dynamic loading of service handler modules"
116 @echo
" OPENAIS_PROFILE [1/0*] - Enable profiling"
121 (cd
$(builddir
)lcr
; echo
==== `pwd` ===; $(call sub_make
,lcr
,clean));
122 (cd
$(builddir
)lib
; echo
==== `pwd` ===; $(call sub_make
,lib
,clean));
123 (cd
$(builddir
)exec
; echo
==== `pwd` ===; $(call sub_make
,exec
,clean));
124 (cd
$(builddir
)test; echo
==== `pwd` ===; $(call sub_make
,test,clean));
125 rm -rf
$(builddir
)doc
/api
127 AIS_LIBS
= ais SaAmf SaClm SaCkpt SaEvt SaLck SaMsg evs cpg \
130 AIS_HEADERS
= saAis.h saAmf.h saClm.h saCkpt.h saEvt.h saEvt.h saLck.h \
131 saMsg.h cpg.h cfg.h evs.h ipc_gen.h mar_gen.h swab.h \
134 EXEC_LIBS
= totem_pg logsys
137 mkdir
-p
$(DESTDIR
)$(SBINDIR
)
138 mkdir
-p
$(DESTDIR
)$(INCLUDEDIR
)
139 mkdir
-p
$(DESTDIR
)$(INCLUDEDIR_TOTEM
)
140 mkdir
-p
$(DESTDIR
)$(INCLUDEDIR_LCR
)
141 mkdir
-p
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
142 mkdir
-p
$(DESTDIR
)$(LIBDIR
)
143 mkdir
-p
$(DESTDIR
)$(LCRSODIR
)
144 mkdir
-p
$(DESTDIR
)$(ETCDIR
)/ais
145 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man3
146 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man5
147 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man8
148 mkdir
-p
$(DESTDIR
)$(ETCDIR
)/ld.so.conf.d
151 for eLib in
$(EXEC_LIBS
); do \
153 ln
-sf lib
$$eLib.so
.2.0.0 exec
/lib
$$eLib.so
; \
154 ln
-sf lib
$$eLib.so
.2.0.0 exec
/lib
$$eLib.so
.2; \
155 $(CP
) -a exec
/lib
$$eLib.so
$(DESTDIR
)$(LIBDIR
); \
156 $(CP
) -a exec
/lib
$$eLib.so
.2 $(DESTDIR
)$(LIBDIR
); \
157 install -m
755 exec
/lib
$$eLib.so
.2.
* $(DESTDIR
)$(LIBDIR
); \
158 if
[ "xYES" = "x$(STATICLIBS)" ]; then \
159 install -m
755 exec
/lib
$$eLib.a
$(DESTDIR
)$(LIBDIR
); \
160 if
[ ${OPENAIS_COMPAT} = "DARWIN" ]; then \
161 ranlib
$(DESTDIR
)$(LIBDIR
)/lib
$$eLib.a
; \
167 for aLib in
$(AIS_LIBS
); do \
169 ln
-sf lib
$$aLib.so
.2.0.0 lib
/lib
$$aLib.so
; \
170 ln
-sf lib
$$aLib.so
.2.0.0 lib
/lib
$$aLib.so
.2; \
171 $(CP
) -a lib
/lib
$$aLib.so
$(DESTDIR
)$(LIBDIR
); \
172 $(CP
) -a lib
/lib
$$aLib.so
.2 $(DESTDIR
)$(LIBDIR
); \
173 install -m
755 lib
/lib
$$aLib.so
.2.
* $(DESTDIR
)$(LIBDIR
); \
174 if
[ "xYES" = "x$(STATICLIBS)" ]; then \
175 install -m
755 lib
/lib
$$aLib.a
$(DESTDIR
)$(LIBDIR
); \
176 if
[ ${OPENAIS_COMPAT} = "DARWIN" ]; then \
177 ranlib
$(DESTDIR
)$(LIBDIR
)/lib
$$aLib.a
; \
183 echo
$(LIBDIR
) > "$(DESTDIR)$(ETCDIR)/ld.so.conf.d/openais-$(ARCH).conf"
185 install -m
755 $(builddir
)exec
/*lcrso
$(DESTDIR
)$(LCRSODIR
)
186 install -m
755 $(builddir
)exec
/aisexec
$(DESTDIR
)$(SBINDIR
)
187 install -m
700 $(builddir
)exec
/keygen
$(DESTDIR
)$(SBINDIR
)/ais-keygen
189 if
[ ! -f
$(DESTDIR
)$(ETCDIR
)/ais
/openais.conf
] ; then \
190 install -m
644 $(srcdir)conf
/openais.conf
$(DESTDIR
)$(ETCDIR
)/ais
; \
192 if
[ ! -f
$(DESTDIR
)$(ETCDIR
)/ais
/amf.conf
] ; then \
193 install -m
644 $(srcdir)conf
/amf.conf
$(DESTDIR
)$(ETCDIR
)/ais
; \
196 for aHeader in
$(AIS_HEADERS
); do \
197 install -m
644 $(srcdir)include/$$aHeader $(DESTDIR
)$(INCLUDEDIR
); \
200 install -m
644 $(srcdir)exec
/aispoll.h
$(DESTDIR
)$(INCLUDEDIR_TOTEM
)
201 install -m
644 $(srcdir)exec
/totempg.h
$(DESTDIR
)$(INCLUDEDIR_TOTEM
)
202 install -m
644 $(srcdir)exec
/totem.h
$(DESTDIR
)$(INCLUDEDIR_TOTEM
)
203 install -m
644 $(srcdir)exec
/totemip.h
$(DESTDIR
)$(INCLUDEDIR_TOTEM
)
204 install -m
644 $(srcdir)lcr
/lcr_ckpt.h
$(DESTDIR
)$(INCLUDEDIR_LCR
)
205 install -m
644 $(srcdir)lcr
/lcr_comp.h
$(DESTDIR
)$(INCLUDEDIR_LCR
)
206 install -m
644 $(srcdir)lcr
/lcr_ifact.h
$(DESTDIR
)$(INCLUDEDIR_LCR
)
207 install -m
644 $(srcdir)exec
/service.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
208 install -m
644 $(srcdir)exec
/timer.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
209 install -m
644 $(srcdir)exec
/flow.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
210 install -m
644 $(srcdir)exec
/ipc.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
211 install -m
644 $(srcdir)exec
/objdb.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
212 install -m
644 $(srcdir)exec
/logsys.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
213 install -m
644 $(srcdir)exec
/config.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
214 install -m
644 $(srcdir)include/swab.h
$(DESTDIR
)$(INCLUDEDIR_SERVICE
)
215 install -m
644 $(srcdir)man
/*.3 $(DESTDIR
)$(MANDIR
)/man3
216 install -m
644 $(srcdir)man
/*.5 $(DESTDIR
)$(MANDIR
)/man5
217 install -m
644 $(srcdir)man
/*.8 $(DESTDIR
)$(MANDIR
)/man8
220 mkdir
-p doc
/api
&& doxygen