From: Bryan Henderson Date: Mon, 11 Nov 1996 13:41:36 +0000 (+0000) Subject: Makefile simplification: the "bin" chapter X-Git-Tag: REL2_0~158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f708e42d1f80d4905ee75358dbd47cd9753251f;p=postgresql Makefile simplification: the "bin" chapter --- diff --git a/src/bin/Makefile b/src/bin/Makefile index 1079d5cd2b..aee2307c50 100644 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -7,12 +7,12 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.4 1996/08/13 07:48:15 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.5 1996/11/11 13:39:09 bryanh Exp $ # #------------------------------------------------------------------------- -MKDIR=../mk --include $(MKDIR)/../Makefile.global +SRCDIR=.. +include $(SRCDIR)/Makefile.global .DEFAULT all: # diff --git a/src/bin/Makefile.global b/src/bin/Makefile.global index ddc57941b6..01a27de902 100644 --- a/src/bin/Makefile.global +++ b/src/bin/Makefile.global @@ -7,23 +7,16 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/Attic/Makefile.global,v 1.9 1996/11/09 06:24:23 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/Attic/Makefile.global,v 1.10 1996/11/11 13:39:10 bryanh Exp $ # #------------------------------------------------------------------------- -CFLAGS+= -I$(srcdir)/backend \ - -I$(srcdir)/include \ - -I$(srcdir)/libpq +LIBPQDIR:= $(SRCDIR)/libpq -# -# link with libpq, so we put it here. -# -LIBPQ:= -L$(srcdir)/libpq -lpq - -LD_ADD+= $(LIBPQ) -DPADD+= $(LIBPQ) +LD_ADD+= -L$(srcdir)/libpq -lpq +DPADD+= -L$(srcdir)/libpq -lpq # LIB_DEP is the list of dependencies on libraries for the link. -LIB_DEP+= $(srcdir)/libpq/libpq.a +LIB_DEP+= $(LIBPQDIR)/libpq.a # # And where libpq goes, so goes the authentication stuff... @@ -33,3 +26,11 @@ LD_ADD+= $(KRBLIBS) CFLAGS+= $(KRBFLAGS) endif + +INCLUDE_OPT := \ + -I$(LIBPQDIR) \ + -I$(SRCDIR)/include \ + -I$(SRCDIR)/src/backend/port/$(PORTNAME) + +CFLAGS += $(INCLUDE_OPT) + diff --git a/src/bin/cleardbdir/Makefile b/src/bin/cleardbdir/Makefile index 43d78487c4..03424dde4c 100644 --- a/src/bin/cleardbdir/Makefile +++ b/src/bin/cleardbdir/Makefile @@ -7,15 +7,18 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/cleardbdir/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:11 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/cleardbdir/Attic/Makefile,v 1.2 1996/11/11 13:39:31 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= cleardbdir +all: cleardbdir -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +cleardbdir: + cp cleardbdir.sh cleardbdir -include $(MKDIR)/postgres.shell.mk +install: cleardbdir + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f cleardbdir diff --git a/src/bin/createdb/Makefile b/src/bin/createdb/Makefile index db5a63484f..8ec1429d10 100644 --- a/src/bin/createdb/Makefile +++ b/src/bin/createdb/Makefile @@ -7,15 +7,24 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.2 1996/11/11 13:39:34 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= createdb +SRCDIR= ../.. +include ../../Makefile.global -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +SEDSCRIPT= \ + -e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \ + -e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" -include $(MKDIR)/postgres.shell.mk +all: createdb +createdb: + sed $(SEDSCRIPT) createdb + +install: createdb + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f createdb diff --git a/src/bin/createuser/Makefile b/src/bin/createuser/Makefile index 7c0c3e13ee..7828758b59 100644 --- a/src/bin/createuser/Makefile +++ b/src/bin/createuser/Makefile @@ -7,15 +7,26 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.2 1996/11/11 13:39:40 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= createuser +SRCDIR= ../.. +include ../../Makefile.global -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +SEDSCRIPT= \ + -e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \ + -e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \ + -e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \ + -e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g" -include $(MKDIR)/postgres.shell.mk +all: createuser +createuser: + sed $(SEDSCRIPT) createuser + +install: createuser + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f createuser diff --git a/src/bin/destroydb/Makefile b/src/bin/destroydb/Makefile index 4dadef6eb8..10b839d899 100644 --- a/src/bin/destroydb/Makefile +++ b/src/bin/destroydb/Makefile @@ -7,15 +7,24 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.2 1996/11/11 13:39:47 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= destroydb +SRCDIR= ../.. +include ../../Makefile.global -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +SEDSCRIPT= \ + -e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \ + -e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" -include $(MKDIR)/postgres.shell.mk +all: destroydb +destroydb: + sed $(SEDSCRIPT) destroydb + +install: destroydb + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f destroydb diff --git a/src/bin/destroyuser/Makefile b/src/bin/destroyuser/Makefile index 7e5d5014f7..5db5796c75 100644 --- a/src/bin/destroyuser/Makefile +++ b/src/bin/destroyuser/Makefile @@ -7,15 +7,26 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:12 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/Makefile,v 1.2 1996/11/11 13:40:04 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= destroyuser +SRCDIR= ../.. +include ../../Makefile.global -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +SEDSCRIPT= \ + -e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \ + -e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \ + -e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \ + -e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g" -include $(MKDIR)/postgres.shell.mk +all: destroyuser +destroyuser: + sed $(SEDSCRIPT) destroyuser + +install: destroyuser + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f destroyuser diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile index a63236aaff..0d9d066e9d 100644 --- a/src/bin/initdb/Makefile +++ b/src/bin/initdb/Makefile @@ -7,15 +7,28 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.1.1.1 1996/07/09 06:22:13 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.2 1996/11/11 13:40:25 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= initdb +SRCDIR= ../.. +include ../../Makefile.global -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +SEDSCRIPT= \ + -e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \ + -e "s^_fUnKy_LIBDIR_sTuFf_^$(LIBDIR)^g" \ + -e "s^_fUnKy_DATADIR_sTuFf_^$(DATADIR)^g" \ + -e "s^_fUnKy_NAMEDATALEN_sTuFf_^$(NAMEDATALEN)^g" \ + -e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g" \ + -e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" -include $(MKDIR)/postgres.shell.mk +all: initdb +initdb: + sed $(SEDSCRIPT) initdb + +install: initdb + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f initdb diff --git a/src/bin/ipcclean/Makefile b/src/bin/ipcclean/Makefile index 5f7993b9ba..ebdc1ff1f4 100644 --- a/src/bin/ipcclean/Makefile +++ b/src/bin/ipcclean/Makefile @@ -7,15 +7,23 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:13 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/ipcclean/Attic/Makefile,v 1.2 1996/11/11 13:40:39 bryanh Exp $ # #------------------------------------------------------------------------- -SHPROG= ipcclean +SRCDIR= ../.. +include ../../Makefile.global -MKDIR= ../../mk -include $(MKDIR)/postgres.mk -include ../Makefile.global +SEDSCRIPT= \ + -e "s^_fUnKy_IPCCLEANPATH_sTuFf_^$(IPCSDIR)^g" -include $(MKDIR)/postgres.shell.mk +all: ipcclean +ipcclean: + sed $(SEDSCRIPT) ipcclean + +install: ipcclean + $(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$< + +clean: + rm -f ipcclean diff --git a/src/bin/pg_dump/Makefile b/src/bin/pg_dump/Makefile index b4847d4274..723920997a 100644 --- a/src/bin/pg_dump/Makefile +++ b/src/bin/pg_dump/Makefile @@ -7,19 +7,34 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.6 1996/10/31 05:56:01 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v 1.7 1996/11/11 13:40:46 bryanh Exp $ # #------------------------------------------------------------------------- -PROG= pg_dump - -MKDIR= ../../mk -include $(MKDIR)/postgres.mk +SRCDIR= ../.. include ../Makefile.global +include ../../Makefile.global + +OBJS= pg_dump.o common.o + +all: submake pg_dump + +pg_dump: $(OBJS) $(LIBPQDIR)/libpq.a + $(CC) $(LDFLAGS) -o pg_dump -L$(LIBPQDIR) $(OBJS) -lpq $(LD_ADD) + +.PHONY: submake +submake: + $(MAKE) -C $(LIBPQDIR) libpq.a -CFLAGS+= -I../../backend/port/$(PORTNAME) +install: + $(INSTALL) $(INSTL_EXE_OPTS) pg_dump $(DESTDIR)$(BINDIR)/pg_dump -SRCS= pg_dump.c common.c +depend dep: + $(CC) -MM $(INCLUDE_OPT) *.c >depend -include $(MKDIR)/postgres.prog.mk +clean: + rm -f pg_dump $(OBJS) +ifeq (depend,$(wildcard depend)) +include depend +endif diff --git a/src/bin/pg_id/Makefile b/src/bin/pg_id/Makefile index db056f89f2..a65b7455e6 100644 --- a/src/bin/pg_id/Makefile +++ b/src/bin/pg_id/Makefile @@ -7,17 +7,33 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:14 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.2 1996/11/11 13:41:08 bryanh Exp $ # #------------------------------------------------------------------------- -PROG= pg_id - -MKDIR= ../../mk -include $(MKDIR)/postgres.mk +SRCDIR= ../.. include ../Makefile.global +include ../../Makefile.global + +OBJS= pg_id.o + +all: pg_id + +pg_id: $(OBJS) $(LIBPQDIR)/libpq.a + $(CC) $(LDFLAGS) -o pg_id -L$(LIBPQDIR) $(OBJS) -lpq $(LD_ADD) + +$(LIBPQDIR)/libpq.a: + $(MAKE) -C $(LIBPQDIR) libpq.a + +install: + $(INSTALL) $(INSTL_EXE_OPTS) pg_id $(DESTDIR)$(BINDIR)/pg_id -SRCS= pg_id.c +depend dep: + $(CC) -MM $(INCLUDE_OPT) *.c >depend -include $(MKDIR)/postgres.prog.mk +clean: + rm -f pg_id $(OBJS) +ifeq (depend,$(wildcard depend)) +include depend +endif diff --git a/src/bin/pgtclsh/Makefile b/src/bin/pgtclsh/Makefile index e0e4f8c301..26cccf5b8c 100644 --- a/src/bin/pgtclsh/Makefile +++ b/src/bin/pgtclsh/Makefile @@ -7,40 +7,33 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.3 1996/11/04 05:14:34 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/pgtclsh/Attic/Makefile,v 1.4 1996/11/11 13:41:25 bryanh Exp $ # #------------------------------------------------------------------------- -MKDIR= ../../mk -include $(MKDIR)/postgres.mk +SRCDIR= ../.. +include ../../Makefile.global include ../Makefile.global -CFLAGS+= -I$(TCL_INCDIR) -I$(TK_INCDIR) -I$(X11_INCDIR) -I$(srcdir)/libpgtcl +CFLAGS+= -I$(TCL_INCDIR) -I$(TK_INCDIR) -I$(X11_INCDIR) -I$(SRCDIR)/libpgtcl # try to find libpgtcl.a in either directory -LIBPGTCL= -L$(srcdir)/libpgtcl/$(objdir) -L$(LIBDIR) -lpgtcl +LIBPGTCL= -L$(SRCDIR)/libpgtcl -L$(LIBDIR) -lpgtcl -pgtclsh: $(objdir)/pgtclAppInit.o - $(CC) $(CFLAGS) -o $(objdir)/$(@F) $(objdir)/pgtclAppInit.o\ - $(LIBPGTCL) $(LIBPQ) -L$(TCL_LIBDIR) $(TCL_LIB) -lm $(LD_ADD) +all: pgtclsh pgtksh -pgtksh: $(objdir)/pgtkAppInit.o - $(CC) $(CFLAGS) -o $(objdir)/$(@F) $(objdir)/pgtkAppInit.o \ - $(LIBPGTCL) $(LIBPQ) -L$(TCL_LIBDIR) -L$(TK_LIBDIR) -L$(X11_LIBDIR) \ - $(TK_LIB) $(TCL_LIB) -lX11 -lm $(LD_ADD) +pgtclsh: pgtclAppInit.o + $(CC) $(CFLAGS) -o $@ pgtclAppInit.o \ + $(LIBPGTCL) $(LIBPQ) -L$(TCL_LIBDIR) $(TCL_LIB) -lm $(LD_ADD) -install:: localobj pgtclsh pgtksh - $(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/pgtclsh $(DESTDIR)$(BINDIR)/pgtclsh - $(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/pgtksh $(DESTDIR)$(BINDIR)/pgtksh - -CLEANFILES = pgtclAppInit.o pgtkAppInit.o pgtclsh pgtksh - -PROG=pgtclsh - -all:: pgtclsh pgtksh - -# don't use the default template for generating executables since we have -# two executable targets -# include $(MKDIR)/postgres.prog.mk +pgtksh: pgtkAppInit.o + $(CC) $(CFLAGS) -o $@ pgtkAppInit.o \ + $(LIBPGTCL) $(LIBPQ) -L$(TCL_LIBDIR) -L$(TK_LIBDIR) -L$(X11_LIBDIR) \ + $(TK_LIB) $(TCL_LIB) -lX11 -lm $(LD_ADD) +install: pgtclsh pgtksh + $(INSTALL) $(INSTL_EXE_OPTS) pgtclsh $(DESTDIR)$(BINDIR)/pgtclsh + $(INSTALL) $(INSTL_EXE_OPTS) pgtksh $(DESTDIR)$(BINDIR)/pgtksh +clean: + rm -f pgtclAppInit.o pgtkAppInit.o pgtclsh pgtksh diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile index 55133cd36c..e70d27a167 100644 --- a/src/bin/psql/Makefile +++ b/src/bin/psql/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.10 1996/11/09 06:24:39 momjian Exp $ +# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.11 1996/11/11 13:41:36 bryanh Exp $ # #------------------------------------------------------------------------- @@ -63,12 +63,13 @@ ifneq ($(USE_READLINE), true) OBJS+= rlstubs.o endif -all: psql +all: submake psql psql: $(OBJS) $(LIBPQDIR)/libpq.a $(CC) $(LDFLAGS) -o psql -L$(LIBPQDIR) $(OBJS) -lpq $(LD_ADD) -$(srcdir)/libpq/libpq.a: +.PHONY: submake +submake: $(MAKE) -C $(LIBPQDIR) libpq.a install: