Makefile 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. # Copyright (c) 2002-2006 MontaVista Software, Inc.
  2. # Copyright (c) 2006-2008 Red Hat, Inc.
  3. #
  4. # All rights reserved.
  5. #
  6. # This software licensed under BSD license, the text of which follows:
  7. #
  8. # Redistribution and use in source and binary forms, with or without
  9. # modification, are permitted provided that the following conditions are met:
  10. #
  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.
  19. #
  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 ENGINES; 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.
  31. builddir:=$(shell pwd)/
  32. ifneq ($(O),)
  33. # cleanup the path (make it absolute)
  34. $(shell mkdir -p $(O))
  35. builddir:=$(shell cd $(O) && pwd)/
  36. endif
  37. srcdir:=$(shell cd $(dir $(MAKEFILE_LIST)) && pwd)/
  38. include $(srcdir)/Makefile.inc
  39. SBINDIR=$(PREFIX)/sbin
  40. INCLUDEDIR=$(PREFIX)/include/corosync
  41. INCLUDEDIR_TOTEM=$(PREFIX)/include/corosync/totem
  42. INCLUDEDIR_LCR=$(PREFIX)/include/corosync/lcr
  43. INCLUDEDIR_ENGINE=$(PREFIX)/include/corosync/engine
  44. MANDIR=$(PREFIX)/share/man
  45. ETCDIR=/etc
  46. ARCH=$(shell uname -p)
  47. ifeq (,$(findstring 64,$(ARCH)))
  48. LIBDIR=$(PREFIX)/lib/corosync
  49. else
  50. LIBDIR=$(PREFIX)/lib64/corosync
  51. endif
  52. ifeq (s390,$(ARCH))
  53. LIBDIR=$(PREFIX)/lib/corosync
  54. endif
  55. ifeq (s390x,$(ARCH))
  56. LIBDIR=$(PREFIX)/lib64/corosync
  57. endif
  58. ifeq (ia64,$(ARCH))
  59. LIBDIR=$(PREFIX)/lib/corosync
  60. endif
  61. SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services
  62. sub_make = srcdir=$(srcdir) builddir=$(builddir) subdir=$(1)/ $(MAKE) -I$(srcdir)$(1) -f $(srcdir)$(1)/Makefile $(2)
  63. all: $(SUBDIRS)
  64. @(cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,all));
  65. @(cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,all));
  66. @(cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,all));
  67. @(cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,all));
  68. @(cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,all));
  69. @(cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,all));
  70. # subdirs are not phony
  71. .PHONY: all clean install doxygen
  72. $(builddir):
  73. mkdir -p $@
  74. $(SUBDIRS):
  75. mkdir -p $@
  76. help:
  77. @echo
  78. @echo "Requirements: GCC, LD, and a Linux 2.4/2.6 kernel."
  79. @echo "Tested on:"
  80. @echo " Debian Sarge(i386), Redhat 9(i386), Fedora Core 2 (i386), Fedora Core"
  81. @echo " 4, 5 (i386,x86_64), SOLARIS, MontaVista Carrier Grade Edition 3.1(i386, x86_64,"
  82. @echo " classic ppc, ppc970, xscale) and buildroot/uclibc(ppc e500/603e)"
  83. @echo
  84. @echo Targets:
  85. @echo " all - build all targets"
  86. @echo " install - install corosync onto your system"
  87. @echo " clean - remove generated files"
  88. @echo " doxygen - doxygen html docs"
  89. @echo
  90. @echo "Options: (* - default)"
  91. @echo " OPENCOROSYNC [DEBUG/RELEASE*] - Enable/Disable debug symbols"
  92. @echo " DESTDIR [directory] - Install prefix."
  93. @echo " O [directory] - Locate all output files in \"dir\"."
  94. @echo " BUILD_DYNAMIC [1*/0] - Enable/disable dynamic loading of service handler modules"
  95. @echo " OPENCOROSYNC_PROFILE [1/0*] - Enable profiling"
  96. @echo
  97. clean:
  98. (cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,clean));
  99. (cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,clean));
  100. (cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,clean));
  101. (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,clean));
  102. (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,clean));
  103. (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean));
  104. rm -rf $(builddir)doc/api
  105. COROSYNC_LIBS = evs cpg cfg coroutil confdb
  106. COROSYNC_HEADERS = cpg.h cfg.h evs.h ipc_gen.h mar_gen.h swab.h \
  107. ais_util.h confdb.h list.h saAis.h
  108. EXEC_LIBS = totem_pg logsys
  109. install: all
  110. mkdir -p $(DESTDIR)$(SBINDIR)
  111. mkdir -p $(DESTDIR)$(INCLUDEDIR)
  112. mkdir -p $(DESTDIR)$(INCLUDEDIR_TOTEM)
  113. mkdir -p $(DESTDIR)$(INCLUDEDIR_LCR)
  114. mkdir -p $(DESTDIR)$(INCLUDEDIR_ENGINE)
  115. mkdir -p $(DESTDIR)$(LIBDIR)
  116. mkdir -p $(DESTDIR)$(LCRSODIR)
  117. mkdir -p $(DESTDIR)$(MANDIR)/man3
  118. mkdir -p $(DESTDIR)$(MANDIR)/man5
  119. mkdir -p $(DESTDIR)$(MANDIR)/man8
  120. mkdir -p $(DESTDIR)$(ETCDIR)/ld.so.conf.d
  121. for eLib in $(EXEC_LIBS); do \
  122. ( cd $(builddir) ; \
  123. ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so; \
  124. ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so.2; \
  125. $(CP) -a exec/lib$$eLib.so $(DESTDIR)$(LIBDIR); \
  126. $(CP) -a exec/lib$$eLib.so.2 $(DESTDIR)$(LIBDIR); \
  127. install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \
  128. if [ "xYES" = "x$(STATICLIBS)" ]; then \
  129. install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \
  130. if [ ${OPENCOROSYNC_COMPAT} = "DARWIN" ]; then \
  131. ranlib $(DESTDIR)$(LIBDIR)/lib$$eLib.a; \
  132. fi \
  133. fi \
  134. ) \
  135. done
  136. for aLib in $(COROSYNC_LIBS); do \
  137. ( cd $(builddir) ; \
  138. ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so; \
  139. ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so.2; \
  140. $(CP) -a lib/lib$$aLib.so $(DESTDIR)$(LIBDIR); \
  141. $(CP) -a lib/lib$$aLib.so.2 $(DESTDIR)$(LIBDIR); \
  142. install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \
  143. if [ "xYES" = "x$(STATICLIBS)" ]; then \
  144. install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \
  145. if [ ${OPENCOROSYNC_COMPAT} = "DARWIN" ]; then \
  146. ranlib $(DESTDIR)$(LIBDIR)/lib$$aLib.a; \
  147. fi \
  148. fi \
  149. ) \
  150. done
  151. echo $(LIBDIR) > "$(DESTDIR)$(ETCDIR)/ld.so.conf.d/corosync-$(ARCH).conf"
  152. install -m 755 $(builddir)exec/*lcrso $(DESTDIR)$(LCRSODIR)
  153. install -m 755 $(builddir)services/*lcrso $(DESTDIR)$(LCRSODIR)
  154. install -m 755 $(builddir)exec/corosync $(DESTDIR)$(SBINDIR)
  155. install -m 755 $(builddir)tools/corosync-objctl $(DESTDIR)$(SBINDIR)
  156. install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR)
  157. install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR)
  158. if [ ! -f $(DESTDIR)$(ETCDIR)/penais.conf ] ; then \
  159. install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \
  160. fi
  161. for aHeader in $(COROSYNC_HEADERS); do \
  162. install -m 644 $(srcdir)include/corosync/$$aHeader $(DESTDIR)$(INCLUDEDIR); \
  163. done
  164. install -m 644 $(srcdir)include/corosync/hdb.h $(DESTDIR)$(INCLUDEDIR)
  165. install -m 644 $(srcdir)include/corosync/totem/coropoll.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  166. install -m 644 $(srcdir)include/corosync/totem/totempg.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  167. install -m 644 $(srcdir)include/corosync/totem/totem.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  168. install -m 644 $(srcdir)include/corosync/totem/totemip.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  169. install -m 644 $(srcdir)include/corosync/lcr/lcr_ckpt.h $(DESTDIR)$(INCLUDEDIR_LCR)
  170. install -m 644 $(srcdir)include/corosync/lcr/lcr_comp.h $(DESTDIR)$(INCLUDEDIR_LCR)
  171. install -m 644 $(srcdir)include/corosync/lcr/lcr_ifact.h $(DESTDIR)$(INCLUDEDIR_LCR)
  172. install -m 644 $(srcdir)include/corosync/engine/coroapi.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  173. install -m 644 $(srcdir)include/corosync/engine/objdb.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  174. install -m 644 $(srcdir)include/corosync/engine/logsys.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  175. install -m 644 $(srcdir)include/corosync/engine/config.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  176. install -m 644 $(srcdir)man/*.3 $(DESTDIR)$(MANDIR)/man3
  177. install -m 644 $(srcdir)man/*.5 $(DESTDIR)$(MANDIR)/man5
  178. install -m 644 $(srcdir)man/*.8 $(DESTDIR)$(MANDIR)/man8
  179. doxygen:
  180. mkdir -p doc/api && doxygen