Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b4d6890

Browse files
author
Bryan Henderson
committed
Use -W options only if compiler is gcc.
1 parent 200d4a4 commit b4d6890

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

src/Makefile.global

+44-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.67 1996/11/14 00:26:23 momjian Exp $
10+
# $Header: /cvsroot/pgsql/src/Attic/Makefile.global,v 1.68 1996/11/14 07:19:26 bryanh Exp $
1111
#
1212
# NOTES
1313
# Essentially all Postgres make files include this file and use the
@@ -133,12 +133,8 @@ OIDNAMELEN= 36
133133
# Compile libpq++
134134
#HAVE_Cplusplus= true
135135

136-
# Set COPT to -O for optimization, or -g for debuggable binaries
137-
# Many people prefer -O2, and -m486 if you are using a i486 or better
138-
# Use -Werror to stop the compile when any warnings occur
139-
COPT= -O #-Werror
140136

141-
# Commenting out CASSERT will make things go about 10% faster, but you will
137+
# Commenting out CASSERT will make things go a LOT faster, but you will
142138
# also loose a lot of useful error-checking.
143139
CASSERT= true
144140

@@ -554,8 +550,6 @@ endif
554550
ifeq ($(PORTNAME), irix5)
555551
MK_PORT= irix5
556552

557-
CC= cc
558-
559553
CFLAGS_BE+= -DUSE_POSIX_SIGNALS
560554

561555
# RANLIB is not used on IRIX 5
@@ -596,6 +590,8 @@ LDFLAGS+= -rdynamic
596590
endif
597591
MK_NO_LORDER= true
598592

593+
CC= gcc
594+
599595
# use the regex library
600596
USE_REGEX= 1
601597

@@ -740,10 +736,48 @@ endif
740736
# This goes here so that customization in Makefile.custom is effective
741737
##############################################################################
742738
#
743-
# Flags for CC and LD. (depend on COPT and PROFILE)
744-
#
739+
# Flags for CC and LD.
740+
741+
##############################################################################
742+
# COPT
743+
#
744+
# COPT is for options that the sophisticated builder might want to vary
745+
# from one build to the next, like options to build Postgres with debugging
746+
# information included. COPT is meant to be set on the make command line,
747+
# for example with the command "make COPT=-g". The value you see set here
748+
# is the default that gets used if the builder does not give a value for
749+
# COPT on his make command.
750+
#
751+
# There is a nonobvious relationship between -O (optimization) and
752+
# -Werror (consider all warnings fatal). On some systems, if you don't
753+
# optimize, you will always get some warnings because the system header
754+
# files will include some unreferenced functions in the code. These are
755+
# functions that are supposed to be inline, so there wouldn't ordinarily
756+
# be an "unreferenced" problem, but if you don't enable optimization, no
757+
# inlining can happen, and hence the problem. Therefore, we include
758+
# if you override -O, you override -Werror as well.
759+
#
760+
# CUSTOM_COPT is something the user may set in Makefile.custom
761+
762+
# Common values for COPT are: -g for debuggable binaries, -m486 if you are
763+
# using a i486 or better.
764+
765+
ifneq ($(CUSTOM_COPT),)
766+
COPT= $(CUSTOM_COPT)
767+
else
768+
ifeq ($(CC), gcc)
769+
COPT= -O2 -Werror
770+
else
771+
COPT= -O
772+
endif
773+
endif
774+
775+
776+
ifeq ($(CC), gcc)
777+
# Some flags only gcc recognizes...
745778
# PostgreSQL should *always* compile with these enabled
746779
CFLAGS+= -Wall -Wmissing-prototypes
780+
endif
747781

748782
# Globally pass debugging/optimization/profiling flags based
749783
# on the options selected above.

0 commit comments

Comments
 (0)