HERE := $(PWD) DOWNLOAD_ROOT := http://ftp.postgresql.org/pub/source/ PG_VERSION := 9.1.4 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 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 restart: $(HERE)/bin/pg_ctl $(HERE)/data $(HERE)/log $(HERE)/bin/pg_ctl restart -D $(HERE)/data $(TARBALL_BASENAME).tar.bz2: curl -L -O $(TARBALL_URL) $(TARBALL_BASENAME): $(TARBALL_BASENAME).tar.bz2 tar xjvf $< $(TARBALL_BASENAME)/Makefile: $(TARBALL_BASENAME) cd $< && ./configure --prefix=$(HERE) $(HERE)/bin/postgres: $(TARBALL_BASENAME)/Makefile cd $(TARBALL_BASENAME) && \ make && \ make install $(HERE)/data: mkdir -p $@ $(HERE)/log: mkdir -p $@