2
0

Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Since the programs in this directories are examples for the user, this
  2. # make file should be as ordinary as possible. It should not rely heavily
  3. # on included make files or configuration parameters. It should not use
  4. # libtool. Also, we don't try to build or rebuild the libraries on which
  5. # these programs depend.
  6. ifeq ($(SRCDIR),)
  7. SRCDIR = $(CURDIR)/../..
  8. BLDDIR = $(SRCDIR)
  9. endif
  10. SUBDIR=examples/cpp
  11. include $(BLDDIR)/config.mk
  12. default: all
  13. CXXFLAGS = $(CFLAGS_PERSONAL) $(CADD)
  14. LDFLAGS += $(LADD)
  15. # If this were a real application, working from an installed copy of
  16. # Xmlrpc-c, XMLRPC_C_CONFIG would just be 'xmlrpc-c-config'. It would be
  17. # found in the user's PATH.
  18. XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test
  19. SERVERPROGS_CGI = \
  20. xmlrpc_sample_add_server.cgi
  21. SERVERPROGS_ABYSS = \
  22. xmlrpc_inetd_server \
  23. xmlrpc_loop_server \
  24. xmlrpc_sample_add_server \
  25. callinfo_abyss_server \
  26. CLIENTPROGS = \
  27. xmlrpc_sample_add_client \
  28. sample_add_client_complex \
  29. asynch_client \
  30. # Build up PROGS:
  31. PROGS =
  32. ifeq ($(ENABLE_ABYSS_SERVER),yes)
  33. PROGS += $(SERVERPROGS_ABYSS)
  34. endif
  35. ifeq ($(MUST_BUILD_CLIENT),yes)
  36. PROGS += $(CLIENTPROGS)
  37. endif
  38. ifeq ($(ENABLE_CGI_SERVER),yes)
  39. PROGS += $(SERVERPROGS_CGI)
  40. endif
  41. PROGS += pstream_inetd_server pstream_serial_server
  42. ifeq ($(MUST_BUILD_CLIENT),yes)
  43. PROGS += pstream_client
  44. endif
  45. INCLUDES = -I. $(shell $(XMLRPC_C_CONFIG) c++2 client abyss-server --cflags)
  46. LIBS_SERVER_ABYSS = \
  47. $(shell $(XMLRPC_C_CONFIG) c++2 abyss-server --libs)
  48. LIBS_SERVER_CGI = \
  49. $(shell $(XMLRPC_C_CONFIG) c++2 cgi-server --libs)
  50. LIBS_CLIENT = \
  51. $(shell $(XMLRPC_C_CONFIG) c++2 client --libs)
  52. LIBS_BASE = \
  53. $(shell $(XMLRPC_C_CONFIG) c++2 --libs)
  54. all: $(PROGS)
  55. $(SERVERPROGS_CGI):%.cgi:%_cgi.o
  56. $(CXXLD) -o $@ $^ $(LIBS_SERVER_CGI) $(LDFLAGS)
  57. $(SERVERPROGS_ABYSS):%:%.o
  58. $(CXXLD) -o $@ $^ $(LIBS_SERVER_ABYSS) $(LDFLAGS)
  59. $(CLIENTPROGS):%:%.o
  60. $(CXXLD) -o $@ $^ $(LIBS_CLIENT) $(LDFLAGS)
  61. LIBS_PSTREAM_CLIENT = \
  62. $(shell $(XMLRPC_C_CONFIG) c++2 client --libs)
  63. pstream_client:%:%.o
  64. $(CXXLD) -o $@ $^ $(LIBS_PSTREAM_CLIENT) $(LDFLAGS)
  65. LIBS_PSTREAM_SERVER = \
  66. $(shell $(XMLRPC_C_CONFIG) c++2 pstream-server --libs)
  67. pstream_inetd_server pstream_serial_server:%:%.o
  68. $(CXXLD) -o $@ $^ $(LIBS_PSTREAM_SERVER) $(LDFLAGS)
  69. OBJECTS = $(patsubst %,%.o,$(patsubst %.cgi,%_cgi,$(PROGS)))
  70. $(OBJECTS):%.o:%.cpp
  71. $(CXX) -c $(INCLUDES) $(CXXFLAGS) $<
  72. # See example/Makefile for an explanation of config.h and xmlrpc_amconfig.h
  73. $(OBJECTS): config.h xmlrpc_amconfig.h
  74. config.h:
  75. $(LN_S) $(BLDDIR)/xmlrpc_config.h $@
  76. xmlrpc_amconfig.h:
  77. $(LN_S) $(BLDDIR)/$@ .
  78. .PHONY: clean
  79. clean:
  80. rm -f $(PROGS) *.o config.h xmlrpc_amconfig.h
  81. .PHONY: distclean
  82. distclean: clean
  83. .PHONY: dep depend
  84. dep depend:
  85. # We don't do dependencies in this directory, because it's supposed to be
  86. # an example of what a program outside this package would do, so we can't
  87. # go weaving it into the rest of the package. Ergo, a developer must
  88. # carefully clean and remake examples as he updates other parts of the tree.