1593c21031
mostly for fun ... and to see if I'm missing any foundational bits.
50 lines
1.3 KiB
Makefile
50 lines
1.3 KiB
Makefile
HERE := $(PWD)
|
|
DOWNLOAD_ROOT := http://ftp.postgresql.org/pub/source/
|
|
PG_PORT := 25432
|
|
PG_VERSION := 9.1.4
|
|
PYTHON3 := $(shell which python3)
|
|
TARBALL_BASENAME := postgresql-$(PG_VERSION)
|
|
TARBALL_URL := $(DOWNLOAD_ROOT)/v$(PG_VERSION)/$(TARBALL_BASENAME).tar.bz2
|
|
|
|
all: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log $(HERE)/data/postgresql.conf
|
|
|
|
start: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log
|
|
$(HERE)/bin/pg_ctl start -D $(HERE)/data -l $(HERE)/log/postgres.log
|
|
|
|
stop: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log
|
|
$(HERE)/bin/pg_ctl stop -D $(HERE)/data
|
|
|
|
# pg_ctl restart isn't quite what I want...
|
|
restart: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log
|
|
$(MAKE) stop && $(MAKE) start
|
|
|
|
$(TARBALL_BASENAME).tar.bz2:
|
|
curl -L -O $(TARBALL_URL)
|
|
|
|
$(TARBALL_BASENAME)/configure: $(TARBALL_BASENAME).tar.bz2
|
|
tar xjvf $< && touch $@
|
|
|
|
$(HERE)/bin/pg_ctl: $(TARBALL_BASENAME)/configure
|
|
cd $(TARBALL_BASENAME) && \
|
|
PYTHON=$(PYTHON3) ./configure \
|
|
--prefix=$(HERE) \
|
|
--with-python \
|
|
--with-perl \
|
|
--with-tcl \
|
|
--with-tclconfig=/usr/lib/tcl8.5 \
|
|
--with-openssl \
|
|
--with-libxml \
|
|
--with-libxslt \
|
|
--with-pgport=$(PG_PORT) && \
|
|
make && \
|
|
make install
|
|
|
|
$(HERE)/data:
|
|
mkdir -p $@
|
|
|
|
$(HERE)/log:
|
|
mkdir -p $@
|
|
|
|
$(HERE)/data/postgresql.conf: $(HERE)/postgresql.conf $(HERE)/data
|
|
cp -v $< $@
|