1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +03:00

Reorganize code to allow path-relative installs.

Create new get_* functions to access compiled-in paths and adjust if
relative installs are to be used.

Clean up substitute_libpath_macro() code.
This commit is contained in:
Bruce Momjian
2004-05-17 14:35:34 +00:00
parent 85383214ea
commit 3febb477e6
19 changed files with 374 additions and 170 deletions

View File

@@ -1,4 +1,4 @@
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.103 2004/04/30 04:14:06 momjian Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.104 2004/05/17 14:35:34 momjian Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
@@ -11,8 +11,6 @@ PATCHLEVEL=0
override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
-DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
-DINCLUDEDIR=\"$(includedir)\" \
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
-DFRONTEND
ifeq ($(GCC), yes)
@@ -20,15 +18,18 @@ override CFLAGS += -Wno-error
endif
override CFLAGS += $(PTHREAD_CFLAGS)
OBJS=preproc.o type.o ecpg.o ecpg_keywords.o output.o\
keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o
OBJS= preproc.o type.o ecpg.o ecpg_keywords.o output.o\
keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
$(filter exec.o, $(LIBOBJS))
all: submake-libpgport ecpg
ecpg: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
exec.c: % : $(top_srcdir)/src/port/%
rm -f $@ && $(LN_S) $< .
# pgc is compiled as part of preproc
preproc.o: $(srcdir)/pgc.c
@@ -65,7 +66,7 @@ uninstall:
rm -f $(DESTDIR)$(bindir)/ecpg$(X)
clean distclean:
rm -f *.o ecpg$(X)
rm -f *.o ecpg$(X) exec.c
# garbage from partial builds
@rm -f y.tab.c y.tab.h
# garbage from development

View File

@@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.86 2004/05/12 13:38:48 momjian Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.87 2004/05/17 14:35:34 momjian Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -120,7 +120,9 @@ main(int argc, char *const argv[])
out_option = 0;
struct _include_path *ip;
const char *progname;
char my_exec_path[MAXPGPATH];
char include_path[MAXPGPATH];
progname = get_progname(argv[0]);
if (argc > 1)
@@ -138,6 +140,8 @@ main(int argc, char *const argv[])
}
}
find_my_exec(argv[0], my_exec_path);
while ((c = getopt(argc, argv, "vcio:I:tD:dC:r:h")) != -1)
{
switch (c)
@@ -175,12 +179,18 @@ main(int argc, char *const argv[])
case 'C':
if (strncmp(optarg, "INFORMIX", strlen("INFORMIX")) == 0)
{
char pkginclude_path[MAXPGPATH];
char informix_path[MAXPGPATH];
compat = (strcmp(optarg, "INFORMIX") == 0) ? ECPG_COMPAT_INFORMIX : ECPG_COMPAT_INFORMIX_SE;
/* system_includes = true; */
add_preprocessor_define("dec_t=decimal");
add_preprocessor_define("intrvl_t=interval");
add_preprocessor_define("dtime_t=timestamp");
add_include_path(PKGINCLUDEDIR "/informix/esql");
get_pkginclude_path(my_exec_path, pkginclude_path);
snprintf(informix_path, MAXPGPATH, "%s/informix/esql", pkginclude_path);
add_include_path(informix_path);
}
else
{
@@ -216,7 +226,8 @@ main(int argc, char *const argv[])
add_include_path(".");
add_include_path("/usr/local/include");
add_include_path(INCLUDEDIR);
get_include_path(my_exec_path, include_path);
add_include_path(include_path);
add_include_path("/usr/include");
if (verbose)

View File

@@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.105 2004/05/10 23:09:04 momjian Exp $
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.106 2004/05/17 14:35:34 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -19,7 +19,13 @@ SO_MAJOR_VERSION= 3
SO_MINOR_VERSION= 2
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS) $(PTHREAD_CFLAGS) -DFRONTEND -DSYSCONFDIR='"$(sysconfdir)"'
override CFLAGS += $(PTHREAD_CFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS) \
-DPGBINDIR=\"$(bindir)\" \
-DPGDATADIR=\"$(datadir)\" \
-DSYSCONFDIR='"$(sysconfdir)"' \
-DINCLUDEDIR=\"$(includedir)\" \
-DPKGINCLUDEDIR=\"$(pkgincludedir)\" \
-DPKGLIBDIR=\"$(pkglibdir)\"
OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \