Makefile 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. # Include configuration
  31. #
  32. include ../Makefile.inc
  33. CFLAGS += -I../include
  34. LDFLAGS += -L./
  35. ifeq (${BUILD_DYNAMIC}, 1)
  36. LDFLAGS += ${DYFLAGS}
  37. endif
  38. ifeq (${OPENAIS_COMPAT}, LINUX)
  39. LDFLAGS += -ldl
  40. endif
  41. # OPENAIS_USER, OPENAIS_GROUP, OPENAIS_CONFDIR
  42. #
  43. CFLAGS += -DOPENAIS_USER=\"${OPENAIS_USER}\" -DOPENAIS_GROUP=\"${OPENAIS_GROUP}\" -DOPENAIS_CONFDIR=\"${OPENAIS_CONFDIR}\"
  44. # Totem objects
  45. TOTEM_SRC = aispoll.c totemip.c totemnet.c totemrrp.c totemsrp.c totemmrp.c totempg.c totemconfig.c tlist.c crypto.c wthread.c
  46. TOTEM_OBJS = aispoll.o totemip.o totemnet.o totemrrp.o totemsrp.o totemmrp.o totempg.o totemconfig.o tlist.o crypto.o wthread.o
  47. EXEC_LIBS = libtotem_pg.a
  48. # service handler objects
  49. SERV_SRC = evs.c clm.c amf.c ckpt.c evt.c lck.c msg.c cfg.c cpg.c
  50. SERV_OBJS = evs.o clm.o amf.o ckpt.o evt.o lck.o msg.o cfg.o cpg.o
  51. # main executive objects
  52. MAIN_SRC = main.c print.c mempool.c \
  53. util.c sync.c ykd.c mainconfig.c amfconfig.c service.c
  54. MAIN_OBJS = main.o print.o mempool.o \
  55. util.o sync.o ykd.o mainconfig.o amfconfig.o service.o ../lcr/lcr_ifact.o
  56. OTHER_OBJS = objdb.o
  57. ifeq (${BUILD_DYNAMIC}, 1)
  58. EXEC_OBJS = $(TOTEM_OBJS) $(MAIN_OBJS)
  59. CFLAGS += -fPIC
  60. all:libtotem_pg.a libtotem_pg.so.1.0 ../lcr/lcr_ifact.o \
  61. aisexec \
  62. service_evs.lcrso service_clm.lcrso service_amf.lcrso \
  63. service_ckpt.lcrso service_evt.lcrso service_lck.lcrso \
  64. service_msg.lcrso service_cfg.lcrso service_cpg.lcrso \
  65. objdb.lcrso keygen openais-instantiate
  66. else
  67. EXEC_OBJS = $(TOTEM_OBJS) $(MAIN_OBJS) $(OTHER_OBJS) $(SERV_OBJS)
  68. all: libtotem_pg.a aisexec keygen openais-instantiate
  69. endif
  70. ifeq (${OPENAIS_COMPAT}, DARWIN)
  71. service_evs.lcrso: evs.o
  72. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load evs.o -o $@
  73. service_clm.lcrso: clm.o
  74. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load clm.o -o $@
  75. service_amf.lcrso: amf.o
  76. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load amf.o -o $@
  77. service_ckpt.lcrso: ckpt.o
  78. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load ckpt.o -o $@
  79. service_evt.lcrso: evt.o
  80. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load evt.o -o $@
  81. service_lck.lcrso: lck.o
  82. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load lck.o -o $@
  83. service_msg.lcrso: msg.o
  84. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load msg.o -o $@
  85. service_cfg.lcrso: cfg.o
  86. $(CC) $(LDFLAGS) -bundle $(LDFLAGS) -bundle_loader ./aisexec -bind_at_load cfg.o -o $@
  87. service_cpg.lcrso: cpg.o
  88. $(CC) -bundle -bundle_loader ./aisexec -bind_at_load cpg.o -o $@
  89. objdb.lcrso: objdb.o
  90. $(CC) -bundle -bundle_loader ./aisexec -bind_at_looad objdb.o -o $@
  91. else
  92. service_evs.lcrso: evs.o
  93. $(CC) -shared -Wl,-soname,service_evs.lcrso evs.o -o $@
  94. service_clm.lcrso: clm.o
  95. $(CC) -shared -Wl,-soname,service_clm.lcrso clm.o -o $@
  96. service_amf.lcrso: amf.o
  97. $(CC) -shared -Wl,-soname,service_amf.lcrso amf.o -o $@
  98. service_ckpt.lcrso: ckpt.o
  99. $(CC) -shared -Wl,-soname,service_ckpt.lcrso ckpt.o -o $@
  100. service_evt.lcrso: evt.o
  101. $(CC) -shared -Wl,-soname,service_evt.lcrso evt.o -o $@
  102. service_lck.lcrso: lck.o
  103. $(CC) -shared -Wl,-soname,service_lck.lcrso lck.o -o $@
  104. service_msg.lcrso: msg.o
  105. $(CC) -shared -Wl,-soname,service_msg.lcrso msg.o -o $@
  106. service_cfg.lcrso: cfg.o
  107. $(CC) -shared -Wl,-soname,service_cfg.lcrso cfg.o -o $@
  108. service_cpg.lcrso: cpg.o
  109. $(CC) -shared -Wl,-soname,service_cpg.lcrso cpg.o -o $@
  110. objdb.lcrso: objdb.o
  111. $(CC) -shared -Wl,-soname,objdb.lcrso objdb.o -o $@
  112. aisexec: $(EXEC_OBJS) libtotem_pg.a
  113. endif
  114. $(CC) $(LDFLAGS) $(EXEC_OBJS) $(EXEC_LIBS) -o aisexec
  115. libtotem_pg.a: $(TOTEM_OBJS)
  116. $(AR) -rc libtotem_pg.a $(TOTEM_OBJS)
  117. ifeq (${OPENAIS_COMPAT}, DARWIN)
  118. libtotem_pg.so.1.0: $(TOTEM_OBJS)
  119. $(CC) $(LDFLAGS) -bundle -bind_at_load $(TOTEM_OBJS) -o $@
  120. rm -f libtotem_pg.so.1 libtotem_pg.so
  121. ln -s libtotem_pg.so.1.0 libtotem_pg.so.1
  122. ln -s libtotem_pg.so.1.0 libtotem_pg.so
  123. else
  124. libtotem_pg.so.1.0: $(TOTEM_OBJS)
  125. $(CC) $(LDFLAGS) -shared -Wl,-soname,libtotem_pg.so.1 $(TOTEM_OBJS) -o $@
  126. rm -f libtotem_pg.so.1 libtotem_pg.so
  127. ln -s libtotem_pg.so.1.0 libtotem_pg.so.1
  128. ln -s libtotem_pg.so.1.0 libtotem_pg.so
  129. endif
  130. keygen: keygen.o
  131. $(CC) $(LDFLAGS) keygen.o -o keygen
  132. openais-instantiate: openais-instantiate.o
  133. $(CC) $(LDFLAGS) openais-instantiate.o -o openais-instantiate
  134. clean:
  135. 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
  136. depend:
  137. makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(EXEC_SRC) $(TOTEM_SRC) > /dev/null 2>&1
  138. # - fPIC rules required for service handler shared objects
  139. ../lcr/lcr_ifact.o: ../lcr/lcr_ifact.c
  140. $(CC) $(CFLAGS) $(CPPFLAGS) -I../lcr -c -o $@ ../lcr/lcr_ifact.c
  141. evs.o: evs.c
  142. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  143. clm.o: clm.c
  144. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  145. amf.o: amf.c
  146. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  147. ckpt.o: ckpt.c
  148. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  149. evt.o: evt.c
  150. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  151. lck.o: lck.c
  152. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  153. msg.o: msg.c
  154. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  155. cfg.o: cfg.c
  156. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  157. cpg.o: cpg.c
  158. $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c
  159. objdb.o: objdb.c
  160. $(CC) $(CFLAGS) -c -o $@ $(*F).c
  161. # -fPIC rules required for lib totem
  162. aispoll.o: aispoll.c
  163. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  164. totempg.o: totempg.c
  165. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  166. totemsrp.o: totemsrp.c
  167. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  168. totemrrp.o: totemrrp.c
  169. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  170. totemip.o: totemip.c
  171. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  172. totemnet.o: totemnet.c
  173. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  174. wthread.o: wthread.c
  175. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  176. tlist.o: tlist.c
  177. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  178. crypto.o: crypto.c
  179. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  180. totemmrp.o: totemmrp.c
  181. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  182. totemconfig.o: totemconfig.c
  183. $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c
  184. # DO NOT DELETE
  185. main.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  186. main.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  187. main.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h amfconfig.h
  188. main.o: main.h ../include/saClm.h service.h
  189. main.o: ../include/saEvt.h swab.h print.h
  190. clm.o: ../include/saAis.h ../include/saClm.h ../include/saAis.h
  191. clm.o: ../include/ipc_evs.h ../include/saClm.h ../include/ipc_gen.h
  192. clm.o: ../include/ipc_clm.h ../include/list.h ../include/queue.h aispoll.h
  193. clm.o: totempg.h totemsrp.h amfconfig.h main.h service.h
  194. clm.o: ../include/saEvt.h mempool.h print.h
  195. amf.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  196. amf.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  197. amf.o: ../include/queue.h totempg.h aispoll.h totemsrp.h mempool.h util.h
  198. amf.o: amfconfig.h main.h ../include/saClm.h service.h
  199. amf.o: ../include/saEvt.h print.h
  200. ckpt.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  201. ckpt.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  202. ckpt.o: ../include/queue.h aispoll.h mempool.h util.h amfconfig.h totempg.h
  203. ckpt.o: totemsrp.h main.h ../include/saClm.h service.h
  204. ckpt.o: ../include/saEvt.h print.h
  205. evt.o: ../include/ipc_evt.h ../include/saAis.h ../include/saEvt.h
  206. evt.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  207. evt.o: ../include/queue.h util.h ../include/saAis.h aispoll.h mempool.h
  208. evt.o: amfconfig.h totempg.h totemsrp.h main.h ../include/saClm.h
  209. evt.o: ../include/ipc_evs.h service.h
  210. evt.o: ../include/saEvt.h swab.h print.h
  211. evs.o: ../include/saAis.h ../include/ipc_evs.h ../include/saAis.h
  212. evs.o: ../include/saClm.h ../include/ipc_gen.h ../include/list.h
  213. evs.o: ../include/queue.h aispoll.h totempg.h totemsrp.h amfconfig.h main.h
  214. evs.o: ../include/saClm.h service.h
  215. evs.o: ../include/saEvt.h mempool.h print.h
  216. amfconfig.o: ../include/saAis.h ../include/list.h util.h amfconfig.h aispoll.h
  217. amfconfig.o: totempg.h totemsrp.h mempool.h print.h ../include/saClm.h
  218. amfconfig.o: ../include/saAis.h
  219. print.o: print.h ../include/saAis.h ../include/saClm.h
  220. print.o: ../include/saAis.h amfconfig.h ../include/list.h aispoll.h totempg.h
  221. print.o: totemsrp.h
  222. mempool.o: ../include/list.h mempool.h
  223. util.o: ../include/saAis.h ../include/list.h util.h
  224. aispoll.o: aispoll.h ../include/list.h ../include/saAis.h tlist.h
  225. totemsrp.o: aispoll.h totemsrp.h ../include/queue.h ../include/sq.h
  226. totemsrp.o: ../include/list.h ../include/saAis.h swab.h crypto.h
  227. totempg.o: totempg.h aispoll.h totemsrp.h swab.h
  228. tlist.o: ../include/list.h tlist.h
  229. hdb.o: ../include/saAis.h
  230. crypto.o: crypto.h