diff options
| author | Tom Lane | 2004-05-21 20:56:50 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-05-21 20:56:50 +0000 |
| commit | 13f96c4b6bc59f25ce430ad987cd0881284b6e76 (patch) | |
| tree | ac3c6779e95afe538db77c552942e1f7c6651231 /src/port | |
| parent | 748a15a8ea98fc80fc7cebf523246910109c1eae (diff) | |
Put path configuration information into a .h file instead of cluttering
several different module Makefiles with it. Also, do any adjustment
of installation paths during configure, rather than every time Makefile.global
is read.
Diffstat (limited to 'src/port')
| -rw-r--r-- | src/port/Makefile | 22 | ||||
| -rw-r--r-- | src/port/path.c | 11 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/port/Makefile b/src/port/Makefile index fc84d57260a..a7eafdf8eeb 100644 --- a/src/port/Makefile +++ b/src/port/Makefile @@ -7,7 +7,7 @@ # with broken/missing library files. # IDENTIFICATION -# $PostgreSQL: pgsql/src/port/Makefile,v 1.11 2004/05/17 14:35:34 momjian Exp $ +# $PostgreSQL: pgsql/src/port/Makefile,v 1.12 2004/05/21 20:56:50 tgl Exp $ # #------------------------------------------------------------------------- @@ -15,13 +15,6 @@ subdir = src/port top_builddir = ../.. include $(top_builddir)/src/Makefile.global -override CPPFLAGS += -DPGBINDIR=\"$(bindir)\" \ - -DPGDATADIR=\"$(datadir)\" \ - -DSYSCONFDIR='"$(sysconfdir)"' \ - -DINCLUDEDIR=\"$(includedir)\" \ - -DPKGINCLUDEDIR=\"$(pkgincludedir)\" \ - -DPKGLIBDIR=\"$(pkglibdir)\" - ifdef LIBOBJS all: libpgport.a endif @@ -32,5 +25,16 @@ libpgport.a: $(LIBOBJS) thread.o: thread.c $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $< +path.o: path.c pg_config_paths.h + +# Dependency is to ensure that path changes propagate +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)\"" >>$@ + echo "#define PKGLIBDIR \"$(pkglibdir)\"" >>$@ + clean distclean maintainer-clean: - rm -f libpgport.a $(LIBOBJS) + rm -f libpgport.a $(LIBOBJS) pg_config_paths.h diff --git a/src/port/path.c b/src/port/path.c index a8f53bd8950..616be999b10 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,14 +8,18 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.10 2004/05/19 04:21:49 momjian Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.11 2004/05/21 20:56:50 tgl Exp $ * *------------------------------------------------------------------------- */ #include "c.h" + #include <ctype.h> +#include "pg_config_paths.h" + + #ifndef WIN32 #define ISSEP(ch) ((ch) == '/') #else @@ -109,16 +113,15 @@ get_progname(const char *argv0) void get_share_path(const char *my_exec_path, char *ret_path) { - if (relative_path(PGBINDIR, PGDATADIR)) + if (relative_path(PGBINDIR, PGSHAREDIR)) { - /* Autoconf calls our /share 'datadir' */ StrNCpy(ret_path, my_exec_path, MAXPGPATH); trim_directory(ret_path); /* trim off binary */ trim_directory(ret_path); /* trim off /bin */ strcat(ret_path, "/share"); /* add /share */ } else - StrNCpy(ret_path, PGDATADIR, MAXPGPATH); + StrNCpy(ret_path, PGSHAREDIR, MAXPGPATH); } |
