]> granicus.if.org Git - postgresql/blob - src/port/Makefile
Department of second thoughts. Remove FRONTEND from snprintf.c because
[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.25 2005/03/20 03:53:39 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 thread.o,thread_srv.o, $(LIBOBJS_SRV))
35
36 all: libpgport.a libpgport_srv.a
37
38 # libpgport is needed by some contrib
39 install: all
40         $(INSTALL_STLIB) libpgport.a $(DESTDIR)$(libdir)
41
42 uninstall:
43         $(RM) $(DESTDIR)$(libdir)/libpgport.a
44
45 libpgport.a: $(LIBOBJS)
46         $(AR) $(AROPT) $@ $^
47
48 thread.o: thread.c
49         $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
50
51 path.o: path.c pg_config_paths.h
52
53 #
54 # Server versions of object files
55 #
56
57 libpgport_srv.a: $(LIBOBJS_SRV)
58         $(AR) $(AROPT) $@ $^
59
60 dirmod_srv.o: dirmod.c
61         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
62
63 exec_srv.o: exec.c
64         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
65
66 getaddrinfo_srv.o: getaddrinfo.c
67         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
68
69 snprintf_srv.o: snprintf.c
70         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
71
72 # No thread flags for server version
73 thread_srv.o: thread.c
74         $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
75
76 # Dependency is to ensure that path changes propagate
77 pg_config_paths.h: $(top_builddir)/src/Makefile.global
78         echo "#define PGBINDIR \"$(bindir)\"" >$@
79         echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
80         echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
81         echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
82         echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
83         echo "#define INCLUDEDIRSERVER \"$(includedir_server)\"" >>$@
84         echo "#define LIBDIR \"$(libdir)\"" >>$@
85         echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
86         echo "#define LOCALEDIR \"$(localedir)\"" >>$@
87
88 clean distclean maintainer-clean:
89         rm -f libpgport.a libpgport_srv.a $(LIBOBJS) $(LIBOBJS_SRV) pg_config_paths.h