Make all commands that link a program look like

$(CC) $(CFLAGS) $(LDFLAGS) <object files> <extra-libraries> $(LIBS) -o $@

This form seemed to be the most portable, readable, and logical, but in any
case it's better than having a dozen different ones in the tree.
This commit is contained in:
Peter Eisentraut 2000-11-30 20:36:13 +00:00
parent 309112267f
commit e5ba2fc5b5
16 changed files with 47 additions and 43 deletions

View File

@ -1,5 +1,5 @@
#
# $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/Makefile,v 1.7 2000/10/20 21:03:25 petere Exp $
# $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/Makefile,v 1.8 2000/11/30 20:36:09 petere Exp $
#
subdir = contrib/pg_dumplo
@ -12,7 +12,7 @@ override CPPFLAGS += -I$(libpq_srcdir)
all: pg_dumplo
pg_dumplo: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) -o $@ $(OBJS) $(libpq) $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(libpq) $(LIBS) -o $@
install: all installdirs
$(INSTALL_PROGRAM) pg_dumplo$(X) $(bindir)

View File

@ -1,5 +1,5 @@
# -*-makefile-*-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.113 2000/11/20 16:52:54 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.114 2000/11/30 20:36:10 petere Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
@ -166,7 +166,7 @@ LIBS = @LIBS@
LD = @LD@
with_gnu_ld = @with_gnu_ld@
ld_R_works = @ld_R_works@
LDFLAGS = @LDFLAGS@ $(LIBS)
LDFLAGS = @LDFLAGS@
LDREL = -r
LDOUT = -o
RANLIB = @RANLIB@

View File

@ -6,7 +6,7 @@
# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.35 2000/11/14 21:11:59 petere Exp $
# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.36 2000/11/30 20:36:10 petere Exp $
#
#-------------------------------------------------------------------------
@ -221,7 +221,7 @@ ifeq ($(PORTNAME), beos)
endif
# Pull in any extra -L options that the user might have specified.
SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
SHLIB_LINK := $(filter -L%, $(LIBS)) $(SHLIB_LINK)
ifeq ($(enable_rpath), yes)
SHLIB_LINK += $(rpath)
@ -262,7 +262,7 @@ ifneq ($(PORTNAME), aix)
# Normal case
$(shlib): $(OBJS)
$(LINK.shared) -o $@ $(OBJS) $(SHLIB_LINK)
$(LINK.shared) $(OBJS) $(SHLIB_LINK) -o $@
# If we're using major and minor versions, then make a symlink to major-version-only.
ifneq ($(shlib), lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION))
rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.67 2000/10/20 21:03:39 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.68 2000/11/30 20:36:10 petere Exp $
#
#-------------------------------------------------------------------------
@ -37,7 +37,7 @@ all: postgres $(POSTGRES_IMP)
ifneq ($(PORTNAME), win)
postgres: $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(export_dynamic)
$(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@
else # win
@ -80,7 +80,7 @@ $(top_builddir)/src/utils/dllinit.o: $(top_srcdir)/src/utils/dllinit.c
# The postgres.o target is needed by the rule in Makefile.global that
# creates the exports file when MAKE_EXPORTS = true.
postgres.o: $(OBJS)
$(CC) $(LDREL) $(LDOUT) $@ $^ $(LDFLAGS)
$(CC) $(LDREL) $(LDFLAGS) $^ $(LIBS) -o $@
# The following targets are specified in make commands that appear in
@ -193,7 +193,7 @@ maintainer-clean: distclean
# are up to date. It saves the time of doing all the submakes.
.PHONY: quick
quick: $(OBJS)
$(CC) -o postgres $(OBJS) $(LDFLAGS) $(export_dynamic)
$(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o postgres
depend dep: $(top_srcdir)/src/include/parser/parse.h $(top_builddir)/src/include/utils/fmgroids.h
for i in $(DIRS); do $(MAKE) -C $$i $@; done

View File

@ -4,7 +4,7 @@
# Makefile for regex
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.15 2000/10/20 21:03:46 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/regex/Makefile,v 1.16 2000/11/30 20:36:10 petere Exp $
#
#-------------------------------------------------------------------------
@ -28,7 +28,7 @@ SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
retest: retest.o SUBSYS.o $(DEBUGOBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend

View File

@ -4,7 +4,7 @@
# Makefile for utils/mb
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.14 2000/10/30 10:40:28 ishii Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.15 2000/11/30 20:36:11 petere Exp $
#
#-------------------------------------------------------------------------
@ -22,13 +22,13 @@ SUBSYS.o: $(OBJS)
utftest.o: utftest.c conv.c wchar.c mbutils.c
sjistest: sjistest.o palloc.o common.o mbutils.o wchar.o wstrcmp.o wstrncmp.o big5.o
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
liketest: liketest.o palloc.o $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
utftest: utftest.o palloc.o common.o wstrcmp.o wstrncmp.o big5.o
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.26 2000/10/20 21:03:56 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.27 2000/11/30 20:36:11 petere Exp $
#
#-------------------------------------------------------------------------
@ -20,10 +20,10 @@ override CPPFLAGS+= -I$(libpq_srcdir)
all: submake pg_dump pg_restore pg_dumpall
pg_dump: pg_dump.o common.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) -o $@ pg_dump.o common.o $(OBJS) $(libpq) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) pg_dump.o common.o $(OBJS) $(libpq) $(LIBS) -o $@
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) -o $@ pg_restore.o $(OBJS) $(libpq) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) pg_restore.o $(OBJS) $(libpq) $(LIBS) -o $@
../../utils/strdup.o:
$(MAKE) -C ../../utils strdup.o

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1998, PostgreSQL Global Development Group
#
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.11 2000/09/17 13:02:37 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_encoding/Attic/Makefile,v 1.12 2000/11/30 20:36:11 petere Exp $
#
#-------------------------------------------------------------------------
@ -14,10 +14,10 @@ include $(top_builddir)/src/Makefile.global
OBJS= pg_encoding.o
all: submake pg_encoding$(X)
all: submake pg_encoding
pg_encoding$(X): $(OBJS)
$(CC) -o $@ $(OBJS) $(libpq) $(LDFLAGS) $(CFLAGS)
pg_encoding: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(libpq) $(LIBS) -o $@
.PHONY: submake

View File

@ -4,7 +4,7 @@
#
# Copyright (C) 2000 by PostgreSQL Global Development Team
#
# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.19 2000/09/17 13:02:39 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.20 2000/11/30 20:36:11 petere Exp $
#
#-------------------------------------------------------------------------
@ -12,10 +12,10 @@ subdir = src/bin/pg_id
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
all: pg_id$(X)
all: pg_id
pg_id$(X): pg_id.o
$(CC) -o $@ $^ $(LDFLAGS)
pg_id: pg_id.o
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
install: all installdirs
$(INSTALL_PROGRAM) pg_id$(X) $(DESTDIR)$(bindir)/pg_id$(X)

View File

@ -1,4 +1,4 @@
# $Header: /cvsroot/pgsql/src/bin/pg_passwd/Attic/Makefile,v 1.12 2000/11/18 19:00:23 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pg_passwd/Attic/Makefile,v 1.13 2000/11/30 20:36:12 petere Exp $
subdir = src/bin/pg_passwd
top_builddir = ../../..
@ -6,6 +6,9 @@ include $(top_builddir)/src/Makefile.global
all: pg_passwd
pg_passwd: pg_passwd.o
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
install: all installdirs
$(INSTALL_PROGRAM) pg_passwd$(X) $(DESTDIR)$(bindir)/pg_passwd$(X)

View File

@ -5,7 +5,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.34 2000/10/20 21:04:00 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.35 2000/11/30 20:36:12 petere Exp $
#
#-------------------------------------------------------------------------
@ -39,10 +39,10 @@ endif
all: submake $(PROGRAMS)
pgtclsh: pgtclAppInit.o
$(CC) $(CFLAGS) -o $@ $< $(libpgtcl) $(libpq) $(TCL_LIB_SPEC) $(TCL_LIBS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(libpgtcl) $(libpq) $(TCL_LIB_SPEC) $(TCL_LIBS) $(LIBS) -o $@
pgtksh: pgtkAppInit.o
$(CC) $(CFLAGS) -o $@ $< $(libpgtcl) $(libpq) $(TK_LIB_SPEC) $(TK_LIBS) $(TCL_LIB_SPEC) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(libpgtcl) $(libpq) $(TK_LIB_SPEC) $(TK_LIBS) $(TCL_LIB_SPEC) $(LIBS) -o $@
.PHONY: submake
submake:

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.26 2000/10/20 21:04:01 petere Exp $
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.27 2000/11/30 20:36:12 petere Exp $
#
#-------------------------------------------------------------------------
@ -20,7 +20,7 @@ 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 \
tab-complete.o
all: submake psql$(X)
all: submake psql
ifdef STRDUP
OBJS+=$(top_builddir)/src/utils/strdup.o
@ -47,8 +47,8 @@ endif
# End of hacks for picking up backend 'port' modules
psql$(X): $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) -o $@ $(OBJS) $(libpq) $(LDFLAGS)
psql: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(libpq) $(LIBS) -o $@
help.o: $(srcdir)/sql_help.h

View File

@ -1,3 +1,5 @@
# $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.72 2000/11/30 20:36:13 petere Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
@ -9,7 +11,6 @@ PATCHLEVEL=0
override CPPFLAGS+=-I$(srcdir)/../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
-DINCLUDE_PATH=\"$(includedir)\"
# -DYYDEBUG -g
OBJS=preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o\
keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o
@ -25,7 +26,7 @@ endif
ecpg: $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
$(srcdir)/preproc.c $(srcdir)/preproc.h: preproc.y
$(YACC) -d $(YFLAGS) $<

View File

@ -35,11 +35,11 @@ else
$(MKLDEXPORT) postgres . > $@
endif
endif
$(CC) -Wl,-bE:$(top_builddir)/src/backend/$@ -o postgres $(OBJS) $(LDFLAGS)
$(CC) -Wl,-bE:$(top_builddir)/src/backend/$@ -o postgres $(OBJS) $(LDFLAGS) $(LIBS)
%$(EXPSUFF): %.o
$(MKLDEXPORT) $*.o > $*$(EXPSUFF)
%$(DLSUFFIX): %.o %$(EXPSUFF)
@echo Making shared library $@ from $*.o, $*$(EXPSUFF) and postgres.imp
$(CC) -Wl,-H512 -Wl,-bM:SRE -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP) -Wl,-bE:$*$(EXPSUFF) -o $@ $*.o $(LDFLAGS) $(LDFLAGS_SL)
$(CC) -Wl,-H512 -Wl,-bM:SRE -Wl,-bI:$(top_builddir)/src/backend/$(POSTGRES_IMP) -Wl,-bE:$*$(EXPSUFF) -o $@ $*.o $(LDFLAGS) $(LIBS) $(LDFLAGS_SL)

View File

@ -1,12 +1,11 @@
MK_NO_LORDER= true
CXXFLAGS+= -I/usr/local/lib/gcc-lib/i386-pc-qnx4/egcs-2.91.60/include/g++
AR= ar
AROPT = cr
LD= $(AR)
LDREL= $(AROPT)
LDOUT=
LIBS= -lunix
LDFLAGS= $(LIBS)
LDFLAGS=
enable_shared = no
DLSUFFIX = .so

View File

@ -2,7 +2,8 @@
# symbol names to tell them what to export/import.
#MAKE_EXPORTS= true
LDFLAGS+= -lc /usr/ucblib/libucb.a -LD-Blargedynsym
LIBS += -lc /usr/ucblib/libucb.a
LDFLAGS += -LD-Blargedynsym
DLSUFFIX = .so
CFLAGS_SL =