Define the FRONTEND symbol in postgres_fe.h, which allows us to eliminate

duplicative -DFRONTEND flags from many Makefiles.  We still need Makefile
control of the symbol in a few places that compile frontend-or-backend
src/port/ files, but it's a lot cleaner than before.

Hiroshi Saito
This commit is contained in:
Tom Lane 2007-09-27 19:53:44 +00:00
parent 77c166ba6c
commit 314ed5de6d
15 changed files with 28 additions and 34 deletions

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.52 2007/01/05 22:19:47 momjian Exp $ # $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.53 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -14,7 +14,7 @@ subdir = src/bin/initdb
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= initdb.o $(WIN32RES) OBJS= initdb.o $(WIN32RES)

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 1998-2007, PostgreSQL Global Development Group # Copyright (c) 1998-2007, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/bin/pg_config/Makefile,v 1.18 2007/01/05 22:19:48 momjian Exp $ # $PostgreSQL: pgsql/src/bin/pg_config/Makefile,v 1.19 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -19,7 +19,6 @@ OBJS= pg_config.o $(WIN32RES)
STD_CPPFLAGS := $(filter-out -I$(top_srcdir)/src/include -I$(top_builddir)/src/include,$(CPPFLAGS)) STD_CPPFLAGS := $(filter-out -I$(top_srcdir)/src/include -I$(top_builddir)/src/include,$(CPPFLAGS))
STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/port,$(LDFLAGS)) STD_LDFLAGS := $(filter-out -L$(top_builddir)/src/port,$(LDFLAGS))
override CPPFLAGS += -DFRONTEND
override CPPFLAGS += -DVAL_CONFIGURE="\"$(configure_args)\"" override CPPFLAGS += -DVAL_CONFIGURE="\"$(configure_args)\""
override CPPFLAGS += -DVAL_CC="\"$(CC)\"" override CPPFLAGS += -DVAL_CC="\"$(CC)\""
override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\"" override CPPFLAGS += -DVAL_CPPFLAGS="\"$(STD_CPPFLAGS)\""

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 1998-2007, PostgreSQL Global Development Group # Copyright (c) 1998-2007, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.15 2007/01/05 22:19:48 momjian Exp $ # $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.16 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -13,8 +13,6 @@ subdir = src/bin/pg_controldata
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS += -DFRONTEND
OBJS= pg_controldata.o pg_crc.o $(WIN32RES) OBJS= pg_controldata.o pg_crc.o $(WIN32RES)
all: submake-libpgport pg_controldata all: submake-libpgport pg_controldata

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.23 2007/01/05 22:19:48 momjian Exp $ # $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.24 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -14,7 +14,7 @@ subdir = src/bin/pg_ctl
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND -DDEF_PGPORT=$(DEF_PGPORT) -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -DDEF_PGPORT=$(DEF_PGPORT) -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= pg_ctl.o $(WIN32RES) OBJS= pg_ctl.o $(WIN32RES)

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.63 2007/01/05 22:19:48 momjian Exp $ # $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.64 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -14,7 +14,7 @@ subdir = src/bin/pg_dump
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \ OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
pg_backup_files.o pg_backup_null.o pg_backup_tar.o \ pg_backup_files.o pg_backup_null.o pg_backup_tar.o \

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 1998-2007, PostgreSQL Global Development Group # Copyright (c) 1998-2007, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.17 2007/01/05 22:19:48 momjian Exp $ # $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.18 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -13,8 +13,6 @@ subdir = src/bin/pg_resetxlog
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS += -DFRONTEND
OBJS= pg_resetxlog.o pg_crc.o $(WIN32RES) OBJS= pg_resetxlog.o pg_crc.o $(WIN32RES)
all: submake-libpgport pg_resetxlog all: submake-libpgport pg_resetxlog

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.58 2007/01/05 22:19:48 momjian Exp $ # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.59 2007/09/27 19:53:43 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -17,7 +17,7 @@ include $(top_builddir)/src/Makefile.global
REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
override CPPFLAGS := -DFRONTEND -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_dump $(CPPFLAGS) override CPPFLAGS := -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_dump $(CPPFLAGS)
OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \ OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
startup.o prompt.o variables.o large_obj.o print.o describe.o \ startup.o prompt.o variables.o large_obj.o print.o describe.o \

View File

@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group # Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California # Portions Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.37 2007/01/05 22:19:50 momjian Exp $ # $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.38 2007/09/27 19:53:44 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -16,7 +16,7 @@ include $(top_builddir)/src/Makefile.global
PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb reindexdb PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb reindexdb
override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS)
all: submake-libpq submake-backend $(PROGRAMS) all: submake-libpq submake-backend $(PROGRAMS)

View File

@ -11,13 +11,17 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1995, Regents of the University of California * Portions Copyright (c) 1995, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/postgres_fe.h,v 1.12 2007/01/05 22:19:50 momjian Exp $ * $PostgreSQL: pgsql/src/include/postgres_fe.h,v 1.13 2007/09/27 19:53:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#ifndef POSTGRES_FE_H #ifndef POSTGRES_FE_H
#define POSTGRES_FE_H #define POSTGRES_FE_H
#ifndef FRONTEND
#define FRONTEND 1
#endif
#include "c.h" #include "c.h"
#endif /* POSTGRES_FE_H */ #endif /* POSTGRES_FE_H */

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.47 2007/08/14 10:01:52 meskes Exp $ # $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.48 2007/09/27 19:53:44 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -17,8 +17,7 @@ SO_MAJOR_VERSION= 6
SO_MINOR_VERSION= 0 SO_MINOR_VERSION= 0
DLTYPE= library DLTYPE= library
override CPPFLAGS := -DFRONTEND \ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS) -I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS) override CFLAGS += $(PTHREAD_CFLAGS)

View File

@ -2,8 +2,7 @@ subdir = src/interfaces/ecpg/include
top_builddir = ../../../.. top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND \ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS) -I$(libpq_srcdir) -I$(top_builddir)/src/port $(CPPFLAGS)
informix_esql_dir = $(pkgincludedir)/informix/esql informix_esql_dir = $(pkgincludedir)/informix/esql

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 1994, Regents of the University of California # Copyright (c) 1994, Regents of the University of California
# #
# $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.32 2007/01/20 17:16:17 petere Exp $ # $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/Makefile,v 1.33 2007/09/27 19:53:44 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -17,8 +17,7 @@ SO_MAJOR_VERSION= 2
SO_MINOR_VERSION= 3 SO_MINOR_VERSION= 3
DLTYPE= library DLTYPE= library
override CPPFLAGS := -DFRONTEND \ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
-I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS) -I$(top_srcdir)/src/include/utils -I$(libpq_srcdir) $(CPPFLAGS)
override CFLAGS += $(PTHREAD_CFLAGS) override CFLAGS += $(PTHREAD_CFLAGS)

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 2003-2007, PostgreSQL Global Development Group # Copyright (c) 2003-2007, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/tools/findoidjoins/Makefile,v 1.3 2007/01/05 22:20:04 momjian Exp $ # $PostgreSQL: pgsql/src/tools/findoidjoins/Makefile,v 1.4 2007/09/27 19:53:44 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -12,7 +12,7 @@ subdir = src/tools/findoidjoins
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= findoidjoins.o OBJS= findoidjoins.o

View File

@ -4,7 +4,7 @@
# #
# Copyright (c) 2003-2007, PostgreSQL Global Development Group # Copyright (c) 2003-2007, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/tools/fsync/Makefile,v 1.4 2007/01/05 22:20:05 momjian Exp $ # $PostgreSQL: pgsql/src/tools/fsync/Makefile,v 1.5 2007/09/27 19:53:44 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -12,7 +12,7 @@ subdir = src/tools/fsync
top_builddir = ../../.. top_builddir = ../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS) override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS= test_fsync.o OBJS= test_fsync.o

View File

@ -3,7 +3,7 @@ package Mkvcbuild;
# #
# Package that generates build files for msvc build # Package that generates build files for msvc build
# #
# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.16 2007/08/21 15:10:41 mha Exp $ # $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.17 2007/09/27 19:53:44 tgl Exp $
# #
use Carp; use Carp;
use Win32; use Win32;
@ -341,7 +341,6 @@ sub mkvcbuild
$pgregress->AddFile('src\test\regress\pg_regress_main.c'); $pgregress->AddFile('src\test\regress\pg_regress_main.c');
$pgregress->AddIncludeDir('src\port'); $pgregress->AddIncludeDir('src\port');
$pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"'); $pgregress->AddDefine('HOST_TUPLE="i686-pc-win32vc"');
$pgregress->AddDefine('FRONTEND');
$pgregress->AddReference($libpgport); $pgregress->AddReference($libpgport);
$solution->Save(); $solution->Save();
@ -359,7 +358,6 @@ sub AddSimpleFrontend
my $p = $solution->AddProject($n,'exe','bin'); my $p = $solution->AddProject($n,'exe','bin');
$p->AddDir('src\bin\\' . $n); $p->AddDir('src\bin\\' . $n);
$p->AddDefine('FRONTEND');
$p->AddReference($libpgport); $p->AddReference($libpgport);
if ($uselibpq) if ($uselibpq)
{ {