Consistently use "superuser" instead of "super user"
[pgsql.git] / src / port / Makefile
blob52dbf5783f00aec620ba15b66df6b4017e0cfc6e
1 #-------------------------------------------------------------------------
3 # Makefile
4 # Makefile for src/port
6 # These files are used by the Postgres backend, and also by frontend
7 # programs. Primarily, they are meant to provide portability on systems
8 # with broken/missing library files.
10 # This makefile generates three outputs:
12 # libpgport.a - contains object files with FRONTEND defined,
13 # for use by client applications
15 # libpgport_shlib.a - contains object files with FRONTEND defined,
16 # built suitably for use in shared libraries; for use
17 # by frontend libraries
19 # libpgport_srv.a - contains object files without FRONTEND defined,
20 # for use only by the backend
22 # LIBOBJS is set by configure (via Makefile.global) to be the list of object
23 # files that are conditionally needed as determined by configure's probing.
24 # OBJS adds additional object files that are always compiled.
26 # IDENTIFICATION
27 # src/port/Makefile
29 #-------------------------------------------------------------------------
31 subdir = src/port
32 top_builddir = ../..
33 include $(top_builddir)/src/Makefile.global
35 override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
36 LIBS += $(PTHREAD_LIBS)
38 # If you add objects here, see also src/tools/msvc/Mkvcbuild.pm
40 OBJS = \
41 $(LIBOBJS) \
42 $(PG_CRC32C_OBJS) \
43 bsearch_arg.o \
44 chklocale.o \
45 erand48.o \
46 inet_net_ntop.o \
47 noblock.o \
48 path.o \
49 pg_bitutils.o \
50 pg_strong_random.o \
51 pgcheckdir.o \
52 pgmkdirp.o \
53 pgsleep.o \
54 pgstrcasecmp.o \
55 pgstrsignal.o \
56 pqsignal.o \
57 qsort.o \
58 qsort_arg.o \
59 quotes.o \
60 snprintf.o \
61 strerror.o \
62 tar.o \
63 thread.o
65 # libpgport.a, libpgport_shlib.a, and libpgport_srv.a contain the same files
66 # foo.o, foo_shlib.o, and foo_srv.o are all built from foo.c
67 OBJS_SHLIB = $(OBJS:%.o=%_shlib.o)
68 OBJS_SRV = $(OBJS:%.o=%_srv.o)
70 all: libpgport.a libpgport_shlib.a libpgport_srv.a
72 # libpgport is needed by some contrib
73 install: all installdirs
74 $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
75 $(INSTALL_STLIB) libpgport_shlib.a '$(DESTDIR)$(libdir)/libpgport_shlib.a'
77 installdirs:
78 $(MKDIR_P) '$(DESTDIR)$(libdir)'
80 uninstall:
81 rm -f '$(DESTDIR)$(libdir)/libpgport.a'
82 rm -f '$(DESTDIR)$(libdir)/libpgport_shlib.a'
84 libpgport.a: $(OBJS)
85 rm -f $@
86 $(AR) $(AROPT) $@ $^
88 # thread.o and thread_shlib.o need PTHREAD_CFLAGS (but thread_srv.o does not)
89 thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
90 thread_shlib.o: CFLAGS+=$(PTHREAD_CFLAGS)
92 # all versions of pg_crc32c_sse42.o need CFLAGS_SSE42
93 pg_crc32c_sse42.o: CFLAGS+=$(CFLAGS_SSE42)
94 pg_crc32c_sse42_shlib.o: CFLAGS+=$(CFLAGS_SSE42)
95 pg_crc32c_sse42_srv.o: CFLAGS+=$(CFLAGS_SSE42)
97 # all versions of pg_crc32c_armv8.o need CFLAGS_ARMV8_CRC32C
98 pg_crc32c_armv8.o: CFLAGS+=$(CFLAGS_ARMV8_CRC32C)
99 pg_crc32c_armv8_shlib.o: CFLAGS+=$(CFLAGS_ARMV8_CRC32C)
100 pg_crc32c_armv8_srv.o: CFLAGS+=$(CFLAGS_ARMV8_CRC32C)
103 # Shared library versions of object files
106 libpgport_shlib.a: $(OBJS_SHLIB)
107 rm -f $@
108 $(AR) $(AROPT) $@ $^
110 # Because this uses its own compilation rule, it doesn't use the
111 # dependency tracking logic from Makefile.global. To make sure that
112 # dependency tracking works anyway for the *_shlib.o files, depend on
113 # their *.o siblings as well, which do have proper dependencies. It's
114 # a hack that might fail someday if there is a *_shlib.o without a
115 # corresponding *.o, but there seems little reason for that.
116 %_shlib.o: %.c %.o
117 $(CC) $(CFLAGS) $(CFLAGS_SL) $(CPPFLAGS) -c $< -o $@
120 # Server versions of object files
123 libpgport_srv.a: $(OBJS_SRV)
124 rm -f $@
125 $(AR) $(AROPT) $@ $^
127 # Because this uses its own compilation rule, it doesn't use the
128 # dependency tracking logic from Makefile.global. To make sure that
129 # dependency tracking works anyway for the *_srv.o files, depend on
130 # their *.o siblings as well, which do have proper dependencies. It's
131 # a hack that might fail someday if there is a *_srv.o without a
132 # corresponding *.o, but it works for now (and those would probably go
133 # into src/backend/port/ anyway).
134 %_srv.o: %.c %.o
135 $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
137 # Dependency is to ensure that path changes propagate
139 path.o: path.c pg_config_paths.h
141 path_shlib.o: path.c pg_config_paths.h
143 path_srv.o: path.c pg_config_paths.h
145 # We create a separate file rather than put these in pg_config.h
146 # because many of these values come from makefiles and are not
147 # available to configure.
148 pg_config_paths.h: $(top_builddir)/src/Makefile.global
149 echo "#define PGBINDIR \"$(bindir)\"" >$@
150 echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
151 echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
152 echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
153 echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
154 echo "#define INCLUDEDIRSERVER \"$(includedir_server)\"" >>$@
155 echo "#define LIBDIR \"$(libdir)\"" >>$@
156 echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
157 echo "#define LOCALEDIR \"$(localedir)\"" >>$@
158 echo "#define DOCDIR \"$(docdir)\"" >>$@
159 echo "#define HTMLDIR \"$(htmldir)\"" >>$@
160 echo "#define MANDIR \"$(mandir)\"" >>$@
162 clean distclean maintainer-clean:
163 rm -f libpgport.a libpgport_shlib.a libpgport_srv.a
164 rm -f $(OBJS) $(OBJS_SHLIB) $(OBJS_SRV) pg_config_paths.h