Makefile 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. # Copyright (c) 2002-2006 MontaVista Software, Inc.
  2. #
  3. # All rights reserved.
  4. #
  5. # This software licensed under BSD license, the text of which follows:
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions are met:
  9. #
  10. # - Redistributions of source code must retain the above copyright notice,
  11. # this list of conditions and the following disclaimer.
  12. # - Redistributions in binary form must reproduce the above copyright notice,
  13. # this list of conditions and the following disclaimer in the documentation
  14. # and/or other materials provided with the distribution.
  15. # - Neither the name of the MontaVista Software, Inc. nor the names of its
  16. # contributors may be used to endorse or promote products derived from this
  17. # software without specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  29. # THE POSSIBILITY OF SUCH DAMAGE.
  30. # BUILD_DYNAMIC can be defined to 1 to build for dynamic loading of service
  31. # handler modules. If the developer intends to debug, building without
  32. # dynamic modules should provide an easier route.
  33. # Production mode flags
  34. #CFLAGS = -O3 -Wall -fomit-frame-pointer
  35. #LDFLAGS = -lpthread
  36. #BUILD_DYNAMIC=1
  37. # Debug mode flags
  38. CFLAGS = -g -Wall
  39. #-DDEBUG
  40. LDFLAGS = -g -lpthread
  41. BUILD_DYNAMIC=1
  42. # Profile mode flags
  43. #CFLAGS = -O3 -pg
  44. #LDFLAGS = -pg -lpthread
  45. # Code Coverage with lcov flgs
  46. #CFLAGS = -ftest-coverage -fprofile-arcs
  47. #LDFLAGS = -g
  48. # Totem objects
  49. TOTEM_SRC = aispoll.c totemip.c totemnet.c totemrrp.c totemsrp.c totemmrp.c totempg.c totemconfig.c tlist.c crypto.c wthread.c
  50. TOTEM_OBJS = aispoll.o totemip.o totemnet.o totemrrp.o totemsrp.o totemmrp.o totempg.o totemconfig.o tlist.o crypto.o wthread.o
  51. EXEC_LIBS = libtotem_pg.a
  52. # service handler objects
  53. SERV_SRC = evs.c clm.c amf.c ckpt.c evt.c lck.c msg.c cfg.c
  54. SERV_OBJS = evs.o clm.o amf.o ckpt.o evt.o lck.o msg.o cfg.o
  55. # main executive objects
  56. MAIN_SRC = main.c print.c mempool.c \
  57. util.c sync.c ykd.c mainconfig.c amfconfig.o
  58. MAIN_OBJS = main.o print.o mempool.o \
  59. util.o sync.o ykd.o mainconfig.o amfconfig.o
  60. ifeq (${BUILD_DYNAMIC}, 1)
  61. EXEC_OBJS = $(TOTEM_OBJS) $(MAIN_OBJS)
  62. CFLAGS += -DBUILD_DYNAMIC=1 -fPIC
  63. LDFLAGS += -ldl -rdynamic
  64. EXEC_LIBS += ../lcr/lcr_ifact.o
  65. all:libtotem_pg.a libtotem_pg.so.1.0 \
  66. service_evs.lcrso service_clm.lcrso service_amf.lcrso \
  67. service_ckpt.lcrso service_evt.lcrso service_lck.lcrso \
  68. service_msg.lcrso service_cfg.lcrso \
  69. aisexec keygen openais-instantiate
  70. else
  71. EXEC_OBJS = $(TOTEM_OBJS) $(MAIN_OBJS) $(SERV_OBJS)
  72. all: libtotem_pg.a aisexec keygen openais-instantiate
  73. endif
  74. service_evs.lcrso: evs.o
  75. $(CC) -shared -Wl,-soname,service_evs.lcrso evs.o -o $@
  76. service_clm.lcrso: clm.o
  77. $(CC) -shared -Wl,-soname,service_clm.lcrso clm.o -o $@
  78. service_amf.lcrso: amf.o
  79. $(CC) -shared -Wl,-soname,service_amf.lcrso amf.o -o $@
  80. service_ckpt.lcrso: ckpt.o
  81. $(CC) -shared -Wl,-soname,service_ckpt.lcrso ckpt.o -o $@
  82. service_evt.lcrso: evt.o
  83. $(CC) -shared -Wl,-soname,service_evt.lcrso evt.o -o $@
  84. service_lck.lcrso: lck.o
  85. $(CC) -shared -Wl,-soname,service_lck.lcrso lck.o -o $@
  86. service_msg.lcrso: msg.o
  87. $(CC) -shared -Wl,-soname,service_msg.lcrso msg.o -o $@
  88. service_cfg.lcrso: cfg.o
  89. $(CC) -shared -Wl,-soname,service_cfg.lcrso cfg.o -o $@
  90. aisexec: $(EXEC_OBJS) libtotem_pg.a
  91. $(CC) $(LDFLAGS) $(EXEC_OBJS) $(EXEC_LIBS) -o aisexec
  92. libtotem_pg.a: $(TOTEM_OBJS)
  93. $(AR) -rc libtotem_pg.a $(TOTEM_OBJS)
  94. libtotem_pg.so.1.0: $(TOTEM_OBJS)
  95. $(CC) -shared -Wl,-soname,libtotem_pg.so.1 $(TOTEM_OBJS) -o $@
  96. rm -f libtotem_pg.so.1 libtotem_pg.so
  97. ln -s libtotem_pg.so.1.0 libtotem_pg.so.1
  98. ln -s libtotem_pg.so.1.0 libtotem_pg.so
  99. keygen: keygen.o
  100. $(CC) $(LDFLAGS) keygen.o -o keygen
  101. openais-instantiate: openais-instantiate.o
  102. $(CC) $(LDFLAGS) openais-instantiate.o -o openais-instantiate
  103. clean:
  104. rm -f aisexec $(OBJS) *.o *.lcrso libtotem_pg.so.1.0 libtotem_pg.so.1 libtotem_pg.so libtotem_pg.a gmon.out keygen keygen.o openais-instantiate *.da *.bb *.bbg
  105. depend:
  106. makedepend -Y -- $(CFLAGS) $(EXEC_SRC) $(TOTEM_SRC) > /dev/null 2>&1
  107. # - fPIC rules required for service handler shared objects
  108. evs.o: evs.c
  109. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  110. clm.o: clm.c
  111. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  112. amf.o: amf.c
  113. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  114. ckpt.o: ckpt.c
  115. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  116. evt.o: evt.c
  117. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  118. lck.o: lck.c
  119. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  120. msg.o: msg.c
  121. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  122. cfg.o: cfg.c
  123. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  124. # -fPIC rules required for lib totem
  125. aispoll.o: aispoll.c
  126. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  127. totempg.o: totempg.c
  128. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  129. totemsrp.o: totemsrp.c
  130. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  131. totemrrp.o: totemrrp.c
  132. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  133. totemip.o: totemip.c
  134. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  135. totemnet.o: totemnet.c
  136. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  137. wthread.o: wthread.c
  138. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  139. tlist.o: tlist.c
  140. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  141. crypto.o: crypto.c
  142. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  143. totemmrp.o: totemmrp.c
  144. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  145. totemconfig.o: totemconfig.c
  146. $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
  147. # DO NOT DELETE
  148. main.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  149. main.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  150. main.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h amfconfig.h
  151. main.o: main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h evt.h
  152. main.o: ../include/saEvt.h swab.h print.h
  153. clm.o: ../include/saAis.h ../include/saClm.h ../include/saAis.h
  154. clm.o: ../include/ipc_evs.h ../include/saClm.h ../include/ipc_gen.h
  155. clm.o: ../include/ipc_clm.h ../include/list.h ../include/queue.h aispoll.h
  156. clm.o: totempg.h totemsrp.h amfconfig.h main.h clm.h amf.h handlers.h ckpt.h
  157. clm.o: evt.h ../include/saEvt.h mempool.h print.h
  158. amf.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  159. amf.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  160. amf.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h util.h
  161. amf.o: amfconfig.h main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h evt.h
  162. amf.o: ../include/saEvt.h print.h
  163. ckpt.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  164. ckpt.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  165. ckpt.o: ../include/queue.h aispoll.h mempool.h util.h amfconfig.h totempg.h
  166. ckpt.o: totemsrp.h main.h clm.h ../include/saClm.h amf.h handlers.h ckpt.h
  167. ckpt.o: evt.h ../include/saEvt.h print.h
  168. evt.o: ../include/ipc_evt.h ../include/saAis.h ../include/saEvt.h
  169. evt.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  170. evt.o: ../include/queue.h util.h ../include/saAis.h aispoll.h mempool.h
  171. evt.o: amfconfig.h totempg.h totemsrp.h main.h clm.h ../include/saClm.h
  172. evt.o: amf.h ../include/ipc_evs.h handlers.h ckpt.h evt.h
  173. evt.o: ../include/saEvt.h swab.h print.h
  174. evs.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  175. evs.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  176. evs.o: ../include/queue.h aispoll.h totempg.h totemsrp.h amfconfig.h main.h clm.h
  177. evs.o: ../include/saClm.h amf.h handlers.h ckpt.h evt.h
  178. evs.o: ../include/saEvt.h mempool.h print.h
  179. amfconfig.o: ../include/saAis.h ../include/list.h util.h amfconfig.h aispoll.h
  180. amfconfig.o: totempg.h totemsrp.h mempool.h print.h ../include/saClm.h
  181. amfconfig.o: ../include/saAis.h
  182. print.o: print.h ../include/saAis.h ../include/saClm.h
  183. print.o: ../include/saAis.h amfconfig.h ../include/list.h aispoll.h totempg.h
  184. print.o: totemsrp.h
  185. mempool.o: ../include/list.h mempool.h
  186. util.o: ../include/saAis.h ../include/list.h util.h
  187. aispoll.o: aispoll.h ../include/list.h ../include/saAis.h tlist.h
  188. totemsrp.o: aispoll.h totemsrp.h ../include/queue.h ../include/sq.h
  189. totemsrp.o: ../include/list.h ../include/saAis.h swab.h crypto.h
  190. totempg.o: totempg.h aispoll.h totemsrp.h swab.h
  191. tlist.o: ../include/list.h tlist.h
  192. hdb.o: ../include/saAis.h
  193. crypto.o: crypto.h