]> granicus.if.org Git - postgresql/blob - src/port/Makefile
Another change for FRONTEND snprintf.c.
[postgresql] / 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 # IDENTIFICATION
18 #    $PostgreSQL: pgsql/src/port/Makefile,v 1.23 2005/03/20 02:40:28 momjian Exp $
19 #
20 #-------------------------------------------------------------------------
21
22 subdir = src/port
23 top_builddir = ../..
24 include $(top_builddir)/src/Makefile.global
25
26 override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
27 LIBS += $(PTHREAD_LIBS)
28
29 # Replace object files that use FRONTEND define
30 LIBOBJS_SRV := $(LIBOBJS)
31 LIBOBJS_SRV := $(patsubst dirmod.o,dirmod_srv.o, $(LIBOBJS_SRV))
32 LIBOBJS_SRV := $(patsubst exec.o,exec_srv.o, $(LIBOBJS_SRV))
33 LIBOBJS_SRV := $(patsubst getaddrinfo.o,getaddrinfo_srv.o, $(LIBOBJS_SRV))
34 LIBOBJS_SRV := $(patsubst snprintf.o,snpritnf_srv.o, $(LIBOBJS_SRV))
35 LIBOBJS_SRV := $(patsubst thread.o,thread_srv.o, $(LIBOBJS_SRV))
36
37 all: libpgport.a libpgport_srv.a
38
39 # libpgport is needed by some contrib
40 install: all
41         $(INSTALL_STLIB) libpgport.a $(DESTDIR)$(libdir)
42
43 uninstall:
44         $(RM) $(DESTDIR)$(libdir)/libpgport.a
45
46 libpgport.a: $(LIBOBJS)
47         $(AR) $(AROPT) $@ $^
48
49 thread.o: thread.c
50         $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
51
52 path.o: path.c pg_config_paths.h
53
54 #
55 # Server versions of object files
56 #
57
58 libpgport_srv.a: $(LIBOBJS_SRV)
59         $(AR) $(AROPT) $@ $^
60
61 dirmod_srv.o: dirmod.c
62         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
63
64 exec_srv.o: exec.c
65         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
66
67 getaddrinfo_srv.o: getaddrinfo.c
68         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
69
70 snprintf_srv.o: snprintf.c
71         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
72
73 # No thread flags for server version
74 thread_srv.o: thread.c
75         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
76
77 # Dependency is to ensure that path changes propagate
78 pg_config_paths.h: $(top_builddir)/src/Makefile.global
79         echo "#define PGBINDIR \"$(bindir)\"" >$@
80         echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
81         echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
82         echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
83         echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
84         echo "#define INCLUDEDIRSERVER \"$(includedir_server)\"" >>$@
85         echo "#define LIBDIR \"$(libdir)\"" >>$@
86         echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
87         echo "#define LOCALEDIR \"$(localedir)\"" >>$@
88
89 clean distclean maintainer-clean:
90         rm -f libpgport.a libpgport_srv.a $(LIBOBJS) $(LIBOBJS_SRV) pg_config_paths.h