当前位置: 首页 > 工具软件 > go-xmlrpc > 使用案例 >

xmlrpc-c-1.43.08\examples\Makefile

诸龙野
2023-12-01

# Since the programs in this directory are examples for the user, this make
# file should be as ordinary as possible.  It should not rely heavily on
# included make files or configuration parameters.  Also, we don't try to
# build or rebuild the libraries on which these programs depend or even
# recognize that they've changed on their own.


ifeq ($(SRCDIR),)
SRCDIR = $(CURDIR)/..
BLDDIR = $(SRCDIR)
endif
SUBDIR = examples

include $(BLDDIR)/config.mk

default: all

CFLAGS_ALL = $(CFLAGS_PERSONAL) $(CFLAGS) $(CADD)
LDFLAGS_ALL = $(LDFLAGS_PERSONAL) $(LDFLAGS) $(LADD)

# If this were a real application, working from an installed copy of
# Xmlrpc-c, XMLRPC_C_CONFIG would just be 'xmlrpc-c-config'.  It would be
# found in the user's PATH.
XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test

CLIENTPROGS = \
  auth_client \
  compound_value_client \
  synch_client \
  xmlrpc_sample_add_client \
  xmlrpc_asynch_client \

ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
  ifneq ($(MSVCRT),yes)
    CLIENTPROGS += curl_client
    CLIENTPROGS += interrupted_client
  endif
endif

SERVERPROGS_CGI = \
  xmlrpc_sample_add_server.cgi

SERVERPROGS_ABYSS = \
  compound_value_server \
  xmlrpc_inetd_server \
  xmlrpc_socket_server \
  xmlrpc_loop_server \
  xmlrpc_sample_add_server \
  xmlrpc_server_validatee \

ifneq ($(MSVCRT),yes)
  SERVERPROGS_ABYSS += interrupted_server
endif

ifeq ($(MUST_BUILD_ABYSS_OPENSSL),yes)
  SERVERPROGS_ABYSS += ssl_server ssl_secure_server
endif

BASIC_PROGS = \
  json \
  gen_sample_add_xml \

# Build up PROGS:
PROGS = 

PROGS += $(BASIC_PROGS)

ifeq ($(ENABLE_ABYSS_SERVER),yes)
  PROGS += $(SERVERPROGS_ABYSS)
endif

ifeq ($(MUST_BUILD_CLIENT),yes)
  PROGS += $(CLIENTPROGS)
endif

ifeq ($(ENABLE_CGI_SERVER),yes)
  PROGS += $(SERVERPROGS_CGI) 
endif

INCLUDES = -I. $(shell $(XMLRPC_C_CONFIG) client abyss-server --cflags)

LIBS_CLIENT = \
  $(shell $(XMLRPC_C_CONFIG) client --libs)

LIBS_SERVER_ABYSS = \
  $(shell $(XMLRPC_C_CONFIG) abyss-server --libs)

LIBS_SERVER_CGI = \
  $(shell $(XMLRPC_C_CONFIG) cgi-server --libs)

LIBS_BASE = \
  $(shell $(XMLRPC_C_CONFIG) --libs)

all: $(PROGS)

ifeq ($(ENABLE_CPLUSPLUS),yes)
  all: cpp/all
endif

.PHONY: cpp/all
cpp/all: $(BLDDIR)/examples/cpp
    $(MAKE) -C cpp -f $(SRCDIR)/examples/cpp/Makefile all

# When building in separate tree, directory won't exist yet
$(BLDDIR)/examples/cpp:
    mkdir $@

$(CLIENTPROGS):%:%.o
    $(CCLD) -o $@ $^ $(LIBS_CLIENT) $(LDFLAGS_ALL)

$(SERVERPROGS_CGI):%.cgi:%_cgi.o
    $(CCLD) -o $@ $^ $(LIBS_SERVER_CGI) $(LDFLAGS_ALL)

$(SERVERPROGS_ABYSS):%:%.o
    $(CCLD) -o $@ $^ $(LIBS_SERVER_ABYSS) $(LDFLAGS_ALL)

$(BASIC_PROGS):%:%.o
    $(CCLD) -o $@ $^ $(LIBS_BASE) $(LDFLAGS_ALL)


OBJECTS = $(patsubst %,%.o,$(patsubst %.cgi,%_cgi,$(PROGS)))

$(OBJECTS):%.o:%.c
    $(CC) -c $(INCLUDES) $(CFLAGS_ALL) $<

# config.h just describes the build environment.  We use it so that the
# example programs will build in users' various environments.  If you're
# copying these examples, you can just remove this header from the programs
# and hardcode whatever is right for your build environment.

$(OBJECTS): config.h

config.h:
    $(LN_S) $(BLDDIR)/xmlrpc_config.h $@

.PHONY: clean
clean:
    rm -f $(PROGS) *.o config.h
    $(MAKE) -C cpp clean

.PHONY: distclean
distclean: clean

.PHONY: install
install:

.PHONY: uninstall
uninstall:

.PHONY: check
check:

.PHONY: dep depend
dep depend:
# We don't do dependencies in this directory, because it's supposed to be
# an example of what a program outside this package would do, so we can't
# go weaving it into the rest of the package.  Ergo, a developer must
# carefully clean and remake examples as he updates other parts of the tree.
 

xmlrpc-c-1.43.08/examples$ cat config.h 
/* xmlrpc_config.h is generated from xmlrpc_config.h.in by 'configure'.

   The purpose of this file is to define stuff particular to the build
   environment being used to build Xmlrpc-c.  Xmlrpc-c source files can
   #include this file and have build-environment-independent source code.

   A major goal of this file is to reduce conditional compilation in
   the other source files as much as possible.  Even more, we want to avoid
   having to generate source code particular to a build environment
   except in this file.   

   This file is NOT meant to be used by any code outside of the
   Xmlrpc-c source tree.  There is a similar file that gets installed
   as <xmlrpc-c/config.h> that performs the same function for Xmlrpc-c
   interface header files that get compiled as part of a user's program.

   This file just uses plain AC_SUBST substitution, the same as
   config.mk.  Wherever you see @XXX@, that gets replaced by the
   value of 'configure' variable XXX.

   Logical macros are 0 or 1 instead of the more traditional defined and
   undefined.  That's so we can distinguish when compiling code between
   "false" and some problem with the code.
*/

#ifndef XMLRPC_CONFIG_H_INCLUDED
#define XMLRPC_CONFIG_H_INCLUDED

#define HAVE_WCHAR_H 1
#define HAVE_SYS_FILIO_H 0
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_SELECT_H 1

#define HAVE_WCSNCMP 1
#define HAVE_SETGROUPS 1
#define HAVE_ASPRINTF 1
#define HAVE_SETENV 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOQ 1
#define HAVE_STRTOUQ 1
#define HAVE___STRTOLL 0
#define HAVE___STRTOULL 0
#define HAVE__STRTOUI64 0
#define HAVE_PSELECT 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_LOCALTIME_R 1
#define HAVE_GMTIME_R 1
#define HAVE_STRCASECMP 1
#define HAVE_STRICMP 0
#define HAVE__STRICMP 0

#define VA_LIST_IS_ARRAY 1

#define HAVE_LIBWWW_SSL 0

/* Used to mark an unused function parameter */
#define ATTR_UNUSED __attribute__((__unused__))

#define DIRECTORY_SEPARATOR "/"

#define HAVE_UNICODE_WCHAR HAVE_WCHAR_H

/*  Xmlrpc-c code uses __inline__ to declare functions that should
    be compiled as inline code.  GNU C recognizes the __inline__ keyword.
    Others recognize 'inline' or '__inline' or nothing at all to say
    a function should be inlined.

    We could make 'configure' simply do a trial compile to figure out
    which one, but for now, this approximation is easier:
*/
#if (!defined(__GNUC__))
  #if (!defined(__inline__))
    #if (defined(__sgi) || defined(_AIX) || defined(_MSC_VER))
      #define __inline__ __inline
    #else   
      #define __inline__
    #endif
  #endif
#endif

/* MSVCRT means we're using the Microsoft Visual C++ runtime library,
   msvcrt.dll.  Note that there are other DLLs in the suite, but only the
   basic msvcrt.dll comes with Windows.

   _WIN32, defined by the compiler, means we're using some Microsoft C runtime
   library - it could be either the Microsoft Visual C++ runtime library or an
   older one.  Note that Xmlrpc-c is not supposed to be buildable with an
   older one, so we have no use for _WIN32.

   WIN32 is a macro that some older compilers predefine (compilers aren't
   supposed to because it doesn't start with an underscore, hence the change).
   Many build systems (project files, etc.) set WIN32 explicitly for backward
   compatibility.  Xmlrpc-c has some vestigial uses of it, but we should
   remove those.
*/

#if defined(_MSC_VER)
  /* The compiler is Microsoft Visual C++ */
  #define MSVCRT _MSC_VER
#elif defined(__MINGW32__)
  /* The compiler is Mingw, which is the Windows version of the GNU
     compiler. Programs built with this normally use the Microsoft Visual
     C++ runtime library, in addition to a small library with some of the
     things a program would expect to find on a GNU system: libmingwex.a.
  */
  #define MSVCRT 1
#else
  #define MSVCRT 0
#endif

#if MSVCRT
  /* The MSVC runtime library _does_ have a 'struct timeval', but it is
     part of the Winsock interface (along with select(), which is probably
     its intended use), so isn't intended for use for general timekeeping.
  */
  #define HAVE_TIMEVAL 0
  #define HAVE_TIMESPEC 0
#else
  #define HAVE_TIMEVAL 1
  /* timespec is Posix.1b.  If we need to work on a non-Posix.1b non-Windows
     system, we'll have to figure out how to make Configure determine this.
  */
  #define HAVE_TIMESPEC 1
#endif

#if MSVCRT
  #define HAVE_WINDOWS_THREAD 1
#else
  #define HAVE_WINDOWS_THREAD 0
#endif

#define HAVE_PTHREAD 1

/* Note that the return value of XMLRPC_[V]SNPRINTF is int on Windows,
   ssize_t on POSIX.  On Windows, it is a return code; on POSIX, the size
   of the complete string (regardless of how much of it got returned).
*/
#if MSVCRT
  #define XMLRPC_SNPRINTF _snprintf
  #define XMLRPC_VSNPRINTF _vsnprintf
#else
  #define XMLRPC_SNPRINTF snprintf
  #define XMLRPC_VSNPRINTF vsnprintf
#endif

#if MSVCRT
  #define HAVE_REGEX 0
#else
  #define HAVE_REGEX 1
#endif

#if MSVCRT
  #define XMLRPC_SOCKETPAIR xmlrpc_win32_socketpair
  #define XMLRPC_CLOSESOCKET closesocket
#else
  #define XMLRPC_SOCKETPAIR socketpair
  #define XMLRPC_CLOSESOCKET close
#endif

#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* Starting with MSVC 8, the runtime library defines various POSIX functions
   such as strdup() whose names violate the ISO C standard (the standard
   says the strXXX names are reserved for the standard), but warns you of
   the standards violation.  That warning is 4996, along with other warnings
   that tell you you're using a function that Microsoft thinks you
   shouldn't.

   Well, POSIX is more important than that element of ISO C, so we disable
   that warning.

   FYI, msvcrt also defines _strdup(), etc, which doesn't violate the
   naming standard.  But since other environments don't define _strdup(),
   we can't use it in portable code.
*/
#pragma warning(disable:4996)
#endif

#if HAVE_STRTOLL
  # define XMLRPC_STRTOLL strtoll
#elif HAVE_STRTOQ
  # define XMLRPC_STRTOLL strtoq /* Interix */
#elif HAVE___STRTOLL
  # define XMLRPC_STRTOLL __strtoll /* HP-UX <= 11.11 */
#elif HAVE__STRTOUI64
  #define XMLRPC_STRTOLL _strtoui64  /* Windows MSVC */
#endif

#if HAVE_STRTOULL
  # define XMLRPC_STRTOULL strtoull
#elif HAVE_STRTOUQ
  # define XMLRPC_STRTOULL strtouq /* Interix */
#elif HAVE___STRTOULL
  # define XMLRPC_STRTOULL __strtoull /* HP-UX <= 11.11 */
#elif HAVE__STRTOUI64
  #define XMLRPC_STRTOULL _strtoui64  /* Windows MSVC */
#endif

#if MSVCRT
  #define popen _popen
#endif

/* S_IRUSR is POSIX, defined in <sys/stat.h> Some old BSD systems and Windows
   systems have S_IREAD instead.  Most Unix today (2011) has both.  In 2011,
   Android has S_IRUSR and not S_IREAD.

   Some Windows has _S_IREAD.

   We're ignoring S_IREAD now to see if anyone misses it.  If there are still
   users that need it, we can handle it here.
*/
#if MSVCRT
  #define XMLRPC_S_IWUSR _S_IWRITE
  #define XMLRPC_S_IRUSR _S_IREAD
#else
  #define XMLRPC_S_IWUSR S_IWUSR
  #define XMLRPC_S_IRUSR S_IRUSR
#endif

#if MSVCRT
  #define XMLRPC_CHDIR _chdir
#else
  #define XMLRPC_CHDIR chdir
#endif

#if MSVCRT
  #define XMLRPC_GETPID _getpid
#else
  #define XMLRPC_GETPID getpid
#endif

#define HAVE_ABYSS_OPENSSL 0

#if MSVCRT
  #define XMLRPC_FINITE _finite
#else
  #define XMLRPC_FINITE finite
#endif



#endif

 

 类似资料: