]> granicus.if.org Git - postgresql/blobdiff - src/port/Makefile
Remove redundant code for getnameinfo() replacement
[postgresql] / src / port / Makefile
index 1742eb859864ea8fb05def82061cae94256a85de..bace576d80356da0a1077b5c82303ff36cc530b1 100644 (file)
 #      libpgport_srv.a - contains object files without FRONTEND defined,
 #              for use only by the backend binaries
 #
+# 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.
+# OBJS adds additional object files that are always compiled.
+#
 # IDENTIFICATION
-#    $PostgreSQL: pgsql/src/port/Makefile,v 1.33 2006/07/14 16:45:43 tgl Exp $
+#    src/port/Makefile
 #
 #-------------------------------------------------------------------------
 
@@ -26,8 +30,12 @@ include $(top_builddir)/src/Makefile.global
 override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
 LIBS += $(PTHREAD_LIBS)
 
-# Replace all object files so they use FRONTEND define
-LIBOBJS_SRV := $(LIBOBJS:%.o=%_srv.o)
+OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o exec.o fls.o inet_net_ntop.o \
+       noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
+       pgstrcasecmp.o qsort.o qsort_arg.o sprompt.o thread.o
+
+# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
+OBJS_SRV = $(OBJS:%.o=%_srv.o)
 
 all: libpgport.a libpgport_srv.a
 
@@ -36,37 +44,47 @@ install: all installdirs
        $(INSTALL_STLIB) libpgport.a '$(DESTDIR)$(libdir)/libpgport.a'
 
 installdirs:
-       $(mkinstalldirs) '$(DESTDIR)$(libdir)'
+       $(MKDIR_P) '$(DESTDIR)$(libdir)'
 
 uninstall:
        rm -f '$(DESTDIR)$(libdir)/libpgport.a'
 
-libpgport.a: $(LIBOBJS)
+libpgport.a: $(OBJS)
        $(AR) $(AROPT) $@ $^
 
-thread.o: thread.c
-       $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
-
-path.o: path.c pg_config_paths.h
-
-path_srv.o: path.c pg_config_paths.h
+# thread.o needs PTHREAD_CFLAGS (but thread_srv.o does not)
+thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
 
 #
 # Server versions of object files
 #
 
-libpgport_srv.a: $(LIBOBJS_SRV)
+libpgport_srv.a: $(OBJS_SRV)
        $(AR) $(AROPT) $@ $^
 
-%_srv.o: %.c
+# 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
        $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
 
-# No thread flags for server version
-thread_srv.o: thread.c
-       $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
+$(OBJS_SRV): | submake-errcodes
+
+.PHONY: submake-errcodes
+
+submake-errcodes:
+       $(MAKE) -C ../backend submake-errcodes
 
 # Dependency is to ensure that path changes propagate
-#
+
+path.o: path.c pg_config_paths.h
+
+path_srv.o: path.c pg_config_paths.h
+
 # 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.
@@ -81,7 +99,8 @@ pg_config_paths.h: $(top_builddir)/src/Makefile.global
        echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@
        echo "#define LOCALEDIR \"$(localedir)\"" >>$@
        echo "#define DOCDIR \"$(docdir)\"" >>$@
+       echo "#define HTMLDIR \"$(htmldir)\"" >>$@
        echo "#define MANDIR \"$(mandir)\"" >>$@
 
 clean distclean maintainer-clean:
-       rm -f libpgport.a libpgport_srv.a $(LIBOBJS) $(LIBOBJS_SRV) pg_config_paths.h
+       rm -f libpgport.a libpgport_srv.a $(OBJS) $(OBJS_SRV) pg_config_paths.h