mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-30 23:21:14 +02:00
Eliminate mk/ directory. The tyranny of the included make file templates is
ended!
This commit is contained in:
parent
be421b9b9a
commit
b8eb6400de
@ -1,51 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# postgres.lib.mk--
|
||||
# rules for building libraries. To use the rules, set the following
|
||||
# variables:
|
||||
# LIBSRCS - source files for objects to be built in the library
|
||||
# LIB - name of the library (eg. LIB=pq for libpq.a)
|
||||
# postgres.mk should be included before this file.
|
||||
#
|
||||
# Copyright (c) 1994-5, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.lib.mk,v 1.2 1996/08/13 07:48:29 scrappy Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
LIBOBJS:= $(addsuffix .o, $(basename $(LIBSRCS)))
|
||||
#LIBSOBJS:= $(addsuffix .so, $(basename $(LIBSRCS)))
|
||||
lib:= lib$(LIB).a
|
||||
shlib:= lib$(LIB).so.1
|
||||
|
||||
ifndef LINUX_ELF
|
||||
$(lib): $(addprefix $(objdir)/,$(LIBOBJS))
|
||||
else
|
||||
$(lib): $(addprefix $(objdir)/,$(LIBOBJS))
|
||||
endif
|
||||
@rm -f $(objdir)/$(lib)
|
||||
ifdef MK_NO_LORDER
|
||||
cd $(objdir); $(AR) $(AROPT) $(lib) $(LIBOBJS); $(RANLIB) $(lib)
|
||||
else
|
||||
cd $(objdir); $(AR) $(AROPT) $(lib) `lorder $(LIBOBJS) | tsort`; $(RANLIB) $(lib)
|
||||
endif
|
||||
|
||||
$(shlib): $(addprefix $(objdir)/,$(LIBOBJS))
|
||||
@rm -f $(objdir)/$(shlib)
|
||||
cd $(objdir); $(CC) $(LDFLAGS) -shared $(LIBOBJS) -o $(shlib)
|
||||
|
||||
CLEANFILES+= $(LIBOBJS) $(lib) $(shlib)
|
||||
|
||||
ifdef LINUX_ELF
|
||||
install:: localobj $(lib) $(shlib)
|
||||
$(INSTALL) $(INSTL_LIB_OPTS) $(objdir)/$(lib) $(DESTDIR)$(LIBDIR)/$(lib)
|
||||
$(INSTALL) $(INSTL_LIB_OPTS) $(objdir)/$(shlib) $(DESTDIR)$(LIBDIR)/$(shlib)
|
||||
else
|
||||
install:: localobj $(lib)
|
||||
$(INSTALL) $(INSTL_LIB_OPTS) $(objdir)/$(lib) $(DESTDIR)$(LIBDIR)/$(lib)
|
||||
endif
|
||||
# @cd $(DESTDIR)$(LIBDIR); $(RANLIB) $(lib)
|
||||
|
||||
|
@ -1,148 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# postgres.mk--
|
||||
# The master postgres makefile for implicit rules, definitions and
|
||||
# variables. Every postgres makefile (except those that include
|
||||
# postgres.subdir.mk only) should include this file.
|
||||
#
|
||||
# Copyright (c) 1994-5, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.mk,v 1.5 1996/10/04 20:20:51 scrappy Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Default first rule (all):
|
||||
# This is here so that people doing "gmake" without arguments will
|
||||
# build the program (PROG), shell script (SHPROG) or library (LIB). To
|
||||
# override this, you could define a rule before including postgres.mk.
|
||||
# (See .dosomething: for an explanation of its presence.)
|
||||
#
|
||||
|
||||
ifdef PROG
|
||||
all: localobj $(PROG) .dosomething
|
||||
else
|
||||
ifdef SHPROG
|
||||
all: localobj $(SHPROG) .dosomething
|
||||
else
|
||||
ifdef LIB
|
||||
#all: localobj lib$(LIB).a install-headers .dosomething
|
||||
all: localobj lib$(LIB).a
|
||||
else
|
||||
# if you don't define PROG, SHPROG or LIB before including this, use :: for
|
||||
# your all. (this is here so that clean is not the first rule)
|
||||
all:: localobj
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Flags for programs (ar, yacc, etc.)
|
||||
#
|
||||
|
||||
YFLAGS= -d
|
||||
RANLIB= touch
|
||||
AROPT= crs
|
||||
#AROPT= cq
|
||||
LINTFLAGS =
|
||||
|
||||
|
||||
#
|
||||
# Installation.
|
||||
#
|
||||
# This is the default for all platforms. If your platform uses a different
|
||||
# BSD-style install program, change it in src/mk/port/postgres.mk.$PORTNAME
|
||||
INSTALL= installbsd
|
||||
|
||||
INSTLOPTS= -c -m 444
|
||||
INSTL_EXE_OPTS= -c -m 555
|
||||
INSTL_LIB_OPTS= -c -m 664
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Canned command sequences
|
||||
#
|
||||
|
||||
# making partial objects (if BIGOBJS is defined)
|
||||
define make_partial
|
||||
$(LD) -r -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(notdir $^))
|
||||
endef
|
||||
|
||||
# compiling a .c which is generated (and is in $objdir)
|
||||
define cc_inobjdir
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(objdir)/$(<F) -o $(objdir)/$(@F)
|
||||
endef
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Variables
|
||||
#
|
||||
|
||||
# Makefile.global is where the user configurations are. (objdir is defined
|
||||
# there)
|
||||
include $(MKDIR)/../Makefile.global
|
||||
-include $(MKDIR)/port/postgres.mk.$(PORTNAME)
|
||||
|
||||
CURDIR:= $(shell pwd)
|
||||
|
||||
# This is where we put all the .o's and the generated files.
|
||||
VPATH:= $(CURDIR)/$(objdir)
|
||||
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# General rules
|
||||
#
|
||||
|
||||
.PHONY: clean .dosomething localobj beforeinstall
|
||||
|
||||
# clean up the objects and generated files
|
||||
clean:
|
||||
@if test -d $(objdir); then cd $(objdir); rm -f $(CLEANFILES) ;else true; fi;
|
||||
|
||||
# just a matter of personal taste; make sure we do something and don't
|
||||
# get this message: "gmake[1]: Nothing to be done for 'all'."
|
||||
.dosomething:
|
||||
@cat /dev/null
|
||||
|
||||
localobj:
|
||||
@if test ! -d $(objdir); then mkdir $(objdir); else true; fi;
|
||||
|
||||
#
|
||||
# create the directories before doing install
|
||||
#
|
||||
ifndef NO_BEFOREINSTL
|
||||
beforeinstall: localobj
|
||||
@-if test ! -d $(DESTDIR)$(LIBDIR); \
|
||||
then mkdir $(DESTDIR)$(LIBDIR); fi
|
||||
@-if test ! -d $(DESTDIR)$(BINDIR); \
|
||||
then mkdir $(DESTDIR)$(BINDIR); fi
|
||||
@-if test ! -d $(HEADERDIR); \
|
||||
then mkdir $(HEADERDIR); fi
|
||||
else
|
||||
beforeinstall: localobj
|
||||
endif
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Implicit rules
|
||||
#
|
||||
|
||||
# building .o from C++ sources
|
||||
$(objdir)/%.o: %.cc
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# building .o from .c (in $objdir):
|
||||
$(objdir)/%.o: %.c
|
||||
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $(objdir)/$(@F)
|
||||
|
||||
# building .o from .s (in $objdir):
|
||||
$(objdir)/%.o: %.s
|
||||
$(AS) $(ASFLAGS) $< -o $(objdir)/$(@F)
|
||||
|
@ -1,26 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# postgres.prog.mk--
|
||||
# rules for building binaries. To use the rules, set the following
|
||||
# variables:
|
||||
# PROG - name of the program (eg. PROG=monitor for monitor)
|
||||
# postgres.mk should be included before this file.
|
||||
#
|
||||
# Copyright (c) 1994-5, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.prog.mk,v 1.3 1996/08/14 04:54:45 scrappy Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
PROGOBJS:= $(SRCS:%.c=%.o)
|
||||
|
||||
$(PROG): $(addprefix $(objdir)/,$(PROGOBJS)) $(LIB_DEP)
|
||||
$(CC) $(LDFLAGS) -o $(objdir)/$(@F) $(addprefix $(objdir)/,$(PROGOBJS)) $(LD_ADD)
|
||||
|
||||
CLEANFILES+= $(PROGOBJS) $(PROG)
|
||||
|
||||
install:: localobj $(PROG)
|
||||
$(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/$(PROG) $(DESTDIR)$(BINDIR)/$(PROG)
|
||||
|
@ -1,69 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# postgres.shell.mk--
|
||||
# rules for building shell scripts. To use the rules, set the following
|
||||
# variables:
|
||||
# SRCS - source for the shell script
|
||||
# SHPROG - name of the executable
|
||||
# postgres.mk should be included before this file.
|
||||
#
|
||||
# Copyright (c) 1994-5, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.shell.mk,v 1.3 1996/09/24 01:57:01 scrappy Exp $
|
||||
#
|
||||
# NOTES
|
||||
# the shell script you write might include the following strings which
|
||||
# will be turned into the values listed below:
|
||||
#
|
||||
# _fUnKy_BINDIR_sTuFf_ - location of installed binaries
|
||||
# _fUnKy_LIBDIR_sTuFf_ - location of installed library stuff
|
||||
# _fUnKy_DATADIR_sTuFf_ - location of the default data directory
|
||||
# _fUnKy_POSTGRESDIR_sTuFf_ - location of the postgres "home" directory
|
||||
# _fUnKy_POSTPORT_sTuFf_ - port to run the postmaster on
|
||||
# _fUnKy_NAMEDATALEN_sTuFf_ - length of a datum of type "name"
|
||||
# _fUnKy_OIDNAMELEN_sTuFf_ - ?
|
||||
# _fUnKy_IPCCLEANPATH_sTuFf_ - location of the ipcs and ipcrm programs
|
||||
# _fUnKy_DASH_N_sTuFf_ - -n flag used in echo
|
||||
# _fUnKy_BACKSLASH_C_sTuFf_ - continuation (echo)
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Insert installation-dependent filepaths into the shell script
|
||||
#
|
||||
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_IPCCLEANPATH_sTuFf_^$(IPCSDIR)^g" \
|
||||
-e "s^_fUnKy_NAMEDATALEN_sTuFf_^$(NAMEDATALEN)^g" \
|
||||
-e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g" \
|
||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
||||
|
||||
#
|
||||
# We also need to fix up the scripts to deal with the lack of installed
|
||||
# 'echo' commands that accept the -n option.
|
||||
#
|
||||
ifndef DASH_N
|
||||
DASH_N=-n
|
||||
endif
|
||||
ifndef BACKSLASH_C
|
||||
BACKSLASH_C=
|
||||
endif
|
||||
|
||||
SEDSCRIPT+= -e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
||||
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
||||
|
||||
|
||||
OBJS:= $(SRCS:%.c=%.o)
|
||||
|
||||
$(SHPROG): $(SHPROG).sh
|
||||
sed $(SEDSCRIPT) < $< > $(objdir)/$(SHPROG)
|
||||
|
||||
CLEANFILES+= $(SHPROG)
|
||||
|
||||
install: localobj $(SHPROG)
|
||||
$(INSTALL) $(INSTL_EXE_OPTS) $(objdir)/$(SHPROG) $(DESTDIR)$(BINDIR)/$(SHPROG)
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# postgres.lib.mk--
|
||||
# include this to do recursive make on the subdirectories specified in
|
||||
# SUBDIR.
|
||||
#
|
||||
# Copyright (c) 1994-5, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.subdir.mk,v 1.1.1.1 1996/07/09 06:22:19 scrappy Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
.PHONY: all
|
||||
|
||||
.DEFAULT all:
|
||||
@for dir in $(SUBDIR); do \
|
||||
echo "===> $$dir"; \
|
||||
$(MAKE) -C $$dir --no-print-directory $@; \
|
||||
done
|
@ -1,78 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# postgres.user.mk--
|
||||
# rules for building object/shared libraries used in dynamic loading.
|
||||
# To use the rules, set the following variables:
|
||||
# DLOBJS - objects to be linked in dynamically
|
||||
# This makefile adds the files you need to build to CREATEFILES.
|
||||
#
|
||||
# For building user modules (user functions to be loaded in dynamically).
|
||||
# Make sure the following variables are set properly (You can either
|
||||
# define them manually or include postgres.mk which defines them.):
|
||||
# MKDIR - where postgres makefiles are
|
||||
# includedir - where header files are installed
|
||||
# PORTNAME - your platform (alpha, sparc, sparc_solaris, etc.)
|
||||
# objdir - where to put the generated files
|
||||
#
|
||||
# An SQL script foo.sql or a shell script foo.sh generated from foo.source.
|
||||
# Occurrence of the following strings will be replaced with the respective
|
||||
# values. This is a feeble attempt to provide "portable" scripts.
|
||||
# _CWD_ - current working directory
|
||||
# _OBJWD_ - where the generated files (eg. object files) are
|
||||
# _DLSUFFIX_ - suffix of the dynamic loading
|
||||
# _USER_ - the login of the user
|
||||
#
|
||||
# Copyright (c) 1994-5, Regents of the University of California
|
||||
#
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/mk/Attic/postgres.user.mk,v 1.2 1996/11/18 06:07:23 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
-include $(MKDIR)/port/postgres.mk.$(PORTNAME)
|
||||
CFLAGS+= -I$(includedir) $(CFLAGS_SL)
|
||||
|
||||
%.sql: %.source
|
||||
if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \
|
||||
if [ -z "$$USER" ]; then USER=`whoami`; fi; \
|
||||
if [ -z "$$USER" ]; then echo 'Cannot deduce $$USER.'; exit 1; fi; \
|
||||
rm -f $(objdir)/$*.sql; \
|
||||
C=`pwd`; \
|
||||
sed -e "s:_CWD_:$$C:g" \
|
||||
-e "s:_OBJWD_:$$C/$(objdir):g" \
|
||||
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
|
||||
-e "s/_USER_/$$USER/g" < $*.source > $(objdir)/$*.sql
|
||||
|
||||
#How to create a dynamic lib
|
||||
%.so.1: %.so
|
||||
@rm -f $(objdir)/$(@F)
|
||||
$(CC) -shared $< -o $(objdir)/$(@F)
|
||||
|
||||
%.sh: %.source
|
||||
if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \
|
||||
if [ -z "$$USER" ]; then USER=`whoami`; fi; \
|
||||
if [ -z "$$USER" ]; then echo 'Cannot deduce $USER.'; exit 1; fi; \
|
||||
rm -f $(objdir)/$*.sh; \
|
||||
C="`pwd`/"; \
|
||||
sed -e "s:_CWD_:$$C:g" \
|
||||
-e "s:_OBJWD_:$$C/$(objdir):g" \
|
||||
-e "s:_DLSUFFIX_:$(DLSUFFIX):g" \
|
||||
-e "s/_USER_/$$USER/g" < $*.source > $(objdir)/$*.sh
|
||||
|
||||
#
|
||||
# plus exports files
|
||||
#
|
||||
ifdef EXPSUFF
|
||||
CREATEFILES+= $(DLOBJS:.o=$(EXPSUFF))
|
||||
endif
|
||||
|
||||
#
|
||||
# plus shared libraries
|
||||
#
|
||||
ifdef DLSUFFIX
|
||||
ifneq ($(DLSUFFIX), '.o')
|
||||
CREATEFILES+= $(DLOBJS:.so=$(DLSUFFIX))
|
||||
endif
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user