Makefile 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. SUBDIRS:=$(builddir)lcr $(builddir)lib $(builddir)tools $(builddir)exec $(builddir)test $(builddir)services $(builddir)pkgconfig
  47. sub_make = srcdir=$(srcdir) builddir=$(builddir) subdir=$(1)/ $(MAKE) -I$(srcdir)$(1) -f $(srcdir)$(1)/Makefile $(2)
  48. all: $(SUBDIRS)
  49. @(cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,all));
  50. @(cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,all));
  51. @(cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,all));
  52. @(cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,all));
  53. @(cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,all));
  54. @(cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,all));
  55. @(cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,all));
  56. # subdirs are not phony
  57. .PHONY: all clean install doxygen
  58. $(builddir):
  59. mkdir -p $@
  60. $(SUBDIRS):
  61. mkdir -p $@
  62. help:
  63. @echo
  64. @echo "Requirements: GCC, LD, and a Linux 2.4/2.6 kernel."
  65. @echo "Tested on:"
  66. @echo " Debian Sarge(i386), Redhat 9(i386), Fedora Core 2 (i386), Fedora Core"
  67. @echo " 4, 5 (i386,x86_64), SOLARIS, MontaVista Carrier Grade Edition 3.1(i386, x86_64,"
  68. @echo " classic ppc, ppc970, xscale) and buildroot/uclibc(ppc e500/603e)"
  69. @echo
  70. @echo Targets:
  71. @echo " all - build all targets"
  72. @echo " install - install corosync onto your system"
  73. @echo " clean - remove generated files"
  74. @echo " doxygen - doxygen html docs"
  75. @echo
  76. @echo "Options: (* - default)"
  77. @echo " COROSYNC_BUILD [DEBUG/RELEASE*] - Enable/Disable debug symbols"
  78. @echo " DESTDIR [directory] - Install prefix."
  79. @echo " O [directory] - Locate all output files in \"dir\"."
  80. @echo " BUILD_DYNAMIC [1*/0] - Enable/disable dynamic loading of service handler modules"
  81. @echo " COROSYNC_PROFILE [1/0*] - Enable profiling"
  82. @echo
  83. clean:
  84. (cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,clean));
  85. (cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,clean));
  86. (cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,clean));
  87. (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,clean));
  88. (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,clean));
  89. (cd $(builddir)test; echo ==== `pwd` ===; $(call sub_make,test,clean));
  90. (cd $(builddir)pkgconfig; echo ==== `pwd` ===; $(call sub_make,pkgconfig,clean));
  91. rm -rf $(builddir)doc/api
  92. lint:
  93. (cd $(builddir)exec; echo ==== `pwd` ===; $(call sub_make,exec,lint));
  94. (cd $(builddir)services; echo ==== `pwd` ===; $(call sub_make,services,lint));
  95. (cd $(builddir)lcr; echo ==== `pwd` ===; $(call sub_make,lcr,lint));
  96. (cd $(builddir)lib; echo ==== `pwd` ===; $(call sub_make,lib,lint));
  97. (cd $(builddir)tools; echo ==== `pwd` ===; $(call sub_make,tools,lint));
  98. COROSYNC_LIBS = evs cpg cfg coroutil confdb quorum votequorum
  99. COROSYNC_HEADERS = cpg.h cfg.h evs.h ipc_gen.h mar_gen.h swab.h \
  100. ais_util.h confdb.h quorum.h list.h corotypes.h votequorum.h
  101. EXEC_LIBS = totem_pg logsys
  102. install: all
  103. mkdir -p $(DESTDIR)$(SBINDIR)
  104. mkdir -p $(DESTDIR)$(INCLUDEDIR)
  105. mkdir -p $(DESTDIR)$(INCLUDEDIR_TOTEM)
  106. mkdir -p $(DESTDIR)$(INCLUDEDIR_LCR)
  107. mkdir -p $(DESTDIR)$(INCLUDEDIR_ENGINE)
  108. mkdir -p $(DESTDIR)$(LIBDIR)
  109. mkdir -p $(DESTDIR)$(LCRSODIR)
  110. mkdir -p $(DESTDIR)$(MANDIR)/man3
  111. mkdir -p $(DESTDIR)$(MANDIR)/man5
  112. mkdir -p $(DESTDIR)$(MANDIR)/man8
  113. mkdir -p $(DESTDIR)$(ETCDIR)/ld.so.conf.d
  114. mkdir -p $(DESTDIR)$(PKGCONFIGDIR)
  115. for eLib in $(EXEC_LIBS); do \
  116. ( cd $(builddir) ; \
  117. ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so; \
  118. ln -sf lib$$eLib.so.2.0.0 exec/lib$$eLib.so.2; \
  119. $(CP) -a exec/lib$$eLib.so $(DESTDIR)$(LIBDIR); \
  120. $(CP) -a exec/lib$$eLib.so.2 $(DESTDIR)$(LIBDIR); \
  121. install -m 755 exec/lib$$eLib.so.2.* $(DESTDIR)$(LIBDIR); \
  122. if [ "xYES" = "x$(STATICLIBS)" ]; then \
  123. install -m 755 exec/lib$$eLib.a $(DESTDIR)$(LIBDIR); \
  124. if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \
  125. ranlib $(DESTDIR)$(LIBDIR)/lib$$eLib.a; \
  126. fi \
  127. fi \
  128. ) \
  129. done
  130. for aLib in $(COROSYNC_LIBS); do \
  131. ( cd $(builddir) ; \
  132. ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so; \
  133. ln -sf lib$$aLib.so.2.0.0 lib/lib$$aLib.so.2; \
  134. $(CP) -a lib/lib$$aLib.so $(DESTDIR)$(LIBDIR); \
  135. $(CP) -a lib/lib$$aLib.so.2 $(DESTDIR)$(LIBDIR); \
  136. install -m 755 lib/lib$$aLib.so.2.* $(DESTDIR)$(LIBDIR); \
  137. if [ "xYES" = "x$(STATICLIBS)" ]; then \
  138. install -m 755 lib/lib$$aLib.a $(DESTDIR)$(LIBDIR); \
  139. if [ ${COROSYNC_COMPAT} = "DARWIN" ]; then \
  140. ranlib $(DESTDIR)$(LIBDIR)/lib$$aLib.a; \
  141. fi \
  142. fi \
  143. ) \
  144. done
  145. echo $(LIBDIR) > "$(DESTDIR)$(ETCDIR)/ld.so.conf.d/corosync-$(ARCH).conf"
  146. install -m 755 $(builddir)exec/*lcrso $(DESTDIR)$(LCRSODIR)
  147. install -m 755 $(builddir)services/*lcrso $(DESTDIR)$(LCRSODIR)
  148. install -m 755 $(builddir)exec/corosync $(DESTDIR)$(SBINDIR)
  149. install -m 755 $(builddir)tools/corosync-objctl $(DESTDIR)$(SBINDIR)
  150. install -m 755 $(builddir)tools/corosync-cfgtool $(DESTDIR)$(SBINDIR)
  151. install -m 755 $(builddir)tools/corosync-keygen $(DESTDIR)$(SBINDIR)
  152. if [ ! -f $(DESTDIR)$(ETCDIR)/corosync.conf ] ; then \
  153. install -m 644 $(srcdir)conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \
  154. fi
  155. for aHeader in $(COROSYNC_HEADERS); do \
  156. install -m 644 $(srcdir)include/corosync/$$aHeader $(DESTDIR)$(INCLUDEDIR); \
  157. done
  158. install -m 644 $(srcdir)include/corosync/hdb.h $(DESTDIR)$(INCLUDEDIR)
  159. install -m 644 $(srcdir)include/corosync/totem/coropoll.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  160. install -m 644 $(srcdir)include/corosync/totem/totempg.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  161. install -m 644 $(srcdir)include/corosync/totem/totem.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  162. install -m 644 $(srcdir)include/corosync/totem/totemip.h $(DESTDIR)$(INCLUDEDIR_TOTEM)
  163. install -m 644 $(srcdir)include/corosync/lcr/lcr_ckpt.h $(DESTDIR)$(INCLUDEDIR_LCR)
  164. install -m 644 $(srcdir)include/corosync/lcr/lcr_comp.h $(DESTDIR)$(INCLUDEDIR_LCR)
  165. install -m 644 $(srcdir)include/corosync/lcr/lcr_ifact.h $(DESTDIR)$(INCLUDEDIR_LCR)
  166. install -m 644 $(srcdir)include/corosync/engine/coroapi.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  167. install -m 644 $(srcdir)include/corosync/engine/objdb.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  168. install -m 644 $(srcdir)include/corosync/engine/logsys.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  169. install -m 644 $(srcdir)include/corosync/engine/quorum.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  170. install -m 644 $(srcdir)include/corosync/engine/config.h $(DESTDIR)$(INCLUDEDIR_ENGINE)
  171. install -m 644 $(srcdir)man/*.3 $(DESTDIR)$(MANDIR)/man3
  172. install -m 644 $(srcdir)man/*.5 $(DESTDIR)$(MANDIR)/man5
  173. install -m 644 $(srcdir)man/*.8 $(DESTDIR)$(MANDIR)/man8
  174. install -m 644 $(builddir)/pkgconfig/*.pc $(DESTDIR)$(PKGCONFIGDIR)
  175. doxygen:
  176. mkdir -p doc/api && doxygen