2002-07-18 06:13:59 +02:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2004-10-04 15:43:59 +02:00
|
|
|
# Makefile
|
2002-07-18 06:13:59 +02:00
|
|
|
# Makefile for the port-specific subsystem of the backend
|
|
|
|
#
|
|
|
|
# These files are used in other directories for portability on systems
|
2004-10-04 15:43:59 +02:00
|
|
|
# with broken/missing library files, and for common code sharing.
|
|
|
|
#
|
|
|
|
# This makefile generates two outputs:
|
|
|
|
#
|
|
|
|
# libpgport.a - contains object files with FRONTEND defined,
|
|
|
|
# for use by client application and libraries
|
|
|
|
#
|
|
|
|
# libpgport_srv.a - contains object files without FRONTEND defined,
|
|
|
|
# for use only by the backend binaries
|
|
|
|
#
|
2010-12-11 01:42:44 +01:00
|
|
|
# LIBOBJS is set by configure (via Makefile.global) to be the list of object
|
|
|
|
# files that are conditionally needed as determined by configure's probing.
|
2007-09-29 00:25:49 +02:00
|
|
|
# OBJS adds additional object files that are always compiled.
|
|
|
|
#
|
2002-07-18 06:13:59 +02:00
|
|
|
# IDENTIFICATION
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/port/Makefile
|
2002-07-18 06:13:59 +02:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
subdir = src/port
|
|
|
|
top_builddir = ../..
|
|
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
|
2004-10-04 15:43:59 +02:00
|
|
|
override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
|
2004-05-30 16:07:47 +02:00
|
|
|
LIBS += $(PTHREAD_LIBS)
|
2004-05-22 04:15:08 +02:00
|
|
|
|
2013-10-18 03:52:54 +02:00
|
|
|
OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o fls.o inet_net_ntop.o \
|
2015-02-09 10:17:56 +01:00
|
|
|
noblock.o path.o pgcheckdir.o pgmkdirp.o pgsleep.o \
|
2013-03-17 17:06:42 +01:00
|
|
|
pgstrcasecmp.o pqsignal.o \
|
2014-01-11 00:03:28 +01:00
|
|
|
qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o
|
2010-12-11 01:42:44 +01:00
|
|
|
|
2007-09-29 00:25:49 +02:00
|
|
|
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
|
|
|
|
OBJS_SRV = $(OBJS:%.o=%_srv.o)
|
2004-10-04 15:43:59 +02:00
|
|
|
|
|
|
|
all: libpgport.a libpgport_srv.a
|
2002-07-18 06:13:59 +02:00
|
|
|
|
2004-08-20 22:13:10 +02:00
|
|
|
# libpgport is needed by some contrib
|
2005-12-09 22:19:36 +01:00
|
|
|
install: all installdirs
|
|
|
|
$(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
|
|
|
|
|
|
|
|
installdirs:
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(libdir)'
|
2004-08-20 22:13:10 +02:00
|
|
|
|
|
|
|
uninstall:
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f '$(DESTDIR)$(libdir)/libpgport.a'
|
2004-08-20 22:13:10 +02:00
|
|
|
|
2007-09-29 00:25:49 +02:00
|
|
|
libpgport.a: $(OBJS)
|
2003-10-24 22:31:43 +02:00
|
|
|
$(AR) $(AROPT) $@ $^
|
2002-07-27 22:10:05 +02:00
|
|
|
|
2007-09-29 00:25:49 +02:00
|
|
|
# thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
|
2012-04-29 19:59:12 +02:00
|
|
|
thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
|
2003-06-14 16:35:42 +02:00
|
|
|
|
2004-10-04 15:43:59 +02:00
|
|
|
#
|
|
|
|
# Server versions of object files
|
|
|
|
#
|
|
|
|
|
2007-09-29 00:25:49 +02:00
|
|
|
libpgport_srv.a: $(OBJS_SRV)
|
2004-10-04 15:43:59 +02:00
|
|
|
$(AR) $(AROPT) $@ $^
|
|
|
|
|
2012-05-08 19:08:53 +02:00
|
|
|
# Because this uses its own compilation rule, it doesn't use the
|
|
|
|
# dependency tracking logic from Makefile.global. To make sure that
|
|
|
|
# dependency tracking works anyway for the *_srv.o files, depend on
|
|
|
|
# their *.o siblings as well, which do have proper dependencies. It's
|
|
|
|
# a hack that might fail someday if there is a *_srv.o without a
|
|
|
|
# corresponding *.o, but it works for now (and those would probably go
|
|
|
|
# into src/backend/port/ anyway).
|
|
|
|
%_srv.o: %.c %.o
|
2004-10-04 15:43:59 +02:00
|
|
|
$(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
|
|
|
|
|
2011-02-04 15:28:06 +01:00
|
|
|
$(OBJS_SRV): | submake-errcodes
|
|
|
|
|
|
|
|
.PHONY: submake-errcodes
|
|
|
|
|
|
|
|
submake-errcodes:
|
2011-02-04 15:48:32 +01:00
|
|
|
$(MAKE) -C ../backend submake-errcodes
|
2011-02-04 15:28:06 +01:00
|
|
|
|
2004-05-21 22:56:50 +02:00
|
|
|
# Dependency is to ensure that path changes propagate
|
2007-09-29 00:25:49 +02:00
|
|
|
|
|
|
|
path.o: path.c pg_config_paths.h
|
|
|
|
|
|
|
|
path_srv.o: path.c pg_config_paths.h
|
|
|
|
|
2006-06-26 20:40:50 +02:00
|
|
|
# We create a separate file rather than put these in pg_config.h
|
|
|
|
# because many of these values come from makefiles and are not
|
|
|
|
# available to configure.
|
2004-05-21 22:56:50 +02:00
|
|
|
pg_config_paths.h: $(top_builddir)/src/Makefile.global
|
|
|
|
echo "#define PGBINDIR \"$(bindir)\"" >$@
|
|
|
|
echo "#define PGSHAREDIR \"$(datadir)\"" >>$@
|
|
|
|
echo "#define SYSCONFDIR \"$(sysconfdir)\"" >>$@
|
|
|
|
echo "#define INCLUDEDIR \"$(includedir)\"" >>$@
|
|
|
|
echo "#define PKGINCLUDEDIR \"$(pkgincludedir)\"" >>$@
|
2004-08-01 08:56:39 +02:00
|
|
|
echo "#define INCLUDEDIRSERVER \"$(includedir_server)\"" >>$@
|
|
|
|
echo "#define LIBDIR \"$(libdir)\"" >>$@
|
2004-05-21 22:56:50 +02:00
|
|
|
echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
|
2004-05-25 03:00:30 +02:00
|
|
|
echo "#define LOCALEDIR \"$(localedir)\"" >>$@
|
2005-09-27 19:39:35 +02:00
|
|
|
echo "#define DOCDIR \"$(docdir)\"" >>$@
|
2008-02-18 15:51:48 +01:00
|
|
|
echo "#define HTMLDIR \"$(htmldir)\"" >>$@
|
2005-09-27 19:39:35 +02:00
|
|
|
echo "#define MANDIR \"$(mandir)\"" >>$@
|
2004-05-21 22:56:50 +02:00
|
|
|
|
2002-07-27 22:10:05 +02:00
|
|
|
clean distclean maintainer-clean:
|
2007-09-29 00:25:49 +02:00
|
|
|
rm -f libpgport.a libpgport_srv.a $(OBJS) $(OBJS_SRV) pg_config_paths.h
|