OSDN Git Service

Update a number of broken links in comments.
[pg-rex/syncrep.git] / src / port / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile
4 #    Makefile for the port-specific subsystem of the backend
5 #
6 # These files are used in other directories for portability on systems
7 # with broken/missing library files, and for common code sharing.
8 #
9 # This makefile generates two outputs:
10 #
11 #       libpgport.a - contains object files with FRONTEND defined,
12 #               for use by client application and libraries
13 #
14 #       libpgport_srv.a - contains object files without FRONTEND defined,
15 #               for use only by the backend binaries
16 #
17 # LIBOBJS is set by configure (via Makefile.global) to be the list of
18 # object files that are conditionally needed as determined by configure's probing.
19 # OBJS adds additional object files that are always compiled.
20 #
21 # IDENTIFICATION
22 #    $PostgreSQL: pgsql/src/port/Makefile,v 1.38 2009/08/26 22:24:43 petere Exp $
23 #
24 #-------------------------------------------------------------------------
25
26 subdir = src/port
27 top_builddir = ../..
28 include $(top_builddir)/src/Makefile.global
29
30 override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
31 LIBS += $(PTHREAD_LIBS)
32
33 OBJS = $(LIBOBJS) chklocale.o copydir.o dirmod.o exec.o noblock.o path.o \
34         pgsleep.o pgstrcasecmp.o qsort.o qsort_arg.o sprompt.o thread.o
35 ifneq (,$(filter $(PORTNAME),cygwin win32))
36 OBJS += pipe.o
37 endif
38
39 # foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
40 OBJS_SRV = $(OBJS:%.o=%_srv.o)
41
42 all: libpgport.a libpgport_srv.a
43
44 # libpgport is needed by some contrib
45 install: all installdirs
46         $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
47
48 installdirs:
49         $(MKDIR_P) '$(DESTDIR)$(libdir)'
50
51 uninstall:
52         rm -f '$(DESTDIR)$(libdir)/libpgport.a'
53
54 libpgport.a: $(OBJS)
55         $(AR) $(AROPT) $@ $^
56
57 # thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
58 thread.o: thread.c
59         $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
60
61 #
62 # Server versions of object files
63 #
64
65 libpgport_srv.a: $(OBJS_SRV)
66         $(AR) $(AROPT) $@ $^
67
68 %_srv.o: %.c
69         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
70
71 # Dependency is to ensure that path changes propagate
72
73 path.o: path.c pg_config_paths.h
74
75 path_srv.o: path.c pg_config_paths.h
76
77 # We create a separate file rather than put these in pg_config.h
78 # because many of these values come from makefiles and are not
79 # available to configure.
80 pg_config_paths.h: $(top_builddir)/src/Makefile.global
81         echo "#define PGBINDIR \"$(bindir)\"" >$@
82         echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
83         echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
84         echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
85         echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
86         echo "#define INCLUDEDIRSERVER \"$(includedir_server)\"" >>$@
87         echo "#define LIBDIR \"$(libdir)\"" >>$@
88         echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
89         echo "#define LOCALEDIR \"$(localedir)\"" >>$@
90         echo "#define DOCDIR \"$(docdir)\"" >>$@
91         echo "#define HTMLDIR \"$(htmldir)\"" >>$@
92         echo "#define MANDIR \"$(mandir)\"" >>$@
93
94 clean distclean maintainer-clean:
95         rm -f libpgport.a libpgport_srv.a $(OBJS) $(OBJS_SRV) pg_config_paths.h