From 12080f60712b6d533b1f4b45788de8b4bcd2a3d9 Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Wed, 4 Apr 1984 00:44:06 +0000 Subject: [PATCH] got to support both DESTDIR and PREFIX --- INSTALL.org | 5 +++-- Makefile | 19 ++++++++++++------- d/include/psyc/Makefile | 2 +- include/Makefile | 2 +- include/psyc/Makefile | 4 +--- lib/Makefile | 2 +- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/INSTALL.org b/INSTALL.org index 1898ab5..62f0676 100644 --- a/INSTALL.org +++ b/INSTALL.org @@ -15,7 +15,8 @@ and you are done. Other possible targets include: -: make install DESTDIR=/usr # install into DESTDIR +: make install PREFIX=/usr # install into PREFIX +: make install DESTDIR=/tmp/t # install into DESTDIR : make diet # compile with diet libc : make test # compile and run the tests : make doc # generate the API documentation using doxygen @@ -24,5 +25,5 @@ Other possible targets include: On BSD try this: -: sudo gmake install DESTDIR=/usr/local +: sudo gmake install PREFIX=/usr/local diff --git a/Makefile b/Makefile index b8ca0b6..7e67f3d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ .PHONY: doc test bench .NOTPARALLEL: clean +export PREFIX="$(DESTDIR)/usr" + indent_args = -nbad -bap -bbo -nbc -br -brs -ncdb -cdw -ce -ci4 -cli0 -cs -d0 -di1 \ -nfc1 -nfca -hnl -i4 -ip0 -l80 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss @@ -10,15 +12,18 @@ all: it: all destdir: - @if test "foo$(DESTDIR)" = "foo" ; then \ - echo "libpsyc install: You must provide a DESTDIR=/usr or such." ;\ - exit 2 ;\ - else true; fi - -@if [ ! -w "$(DESTDIR)" ]; then \ + -@if test "foo$(DESTDIR)" != "foo" ; then \ mkdir "$(DESTDIR)" ;\ fi - @if [ ! -w "$(DESTDIR)" ]; then \ - echo "libpsyc install: You must provide a writable DESTDIR." ;\ + @if test "foo$(PREFIX)" = "foo" ; then \ + echo "libpsyc install: You must provide a PREFIX=/usr or such." ;\ + exit 2 ;\ + else true; fi + -@if [ ! -w "$(PREFIX)" ]; then \ + mkdir "$(PREFIX)" ;\ + fi + @if [ ! -w "$(PREFIX)" ]; then \ + echo "libpsyc install: You must provide a writable PREFIX." ;\ exit 2 ;\ else true; fi diff --git a/d/include/psyc/Makefile b/d/include/psyc/Makefile index ab9f8aa..1e66b21 100644 --- a/d/include/psyc/Makefile +++ b/d/include/psyc/Makefile @@ -1,4 +1,4 @@ -includedir = ${DESTDIR}/include/d +includedir = ${PREFIX}/include/d INSTALL = install HEADERS = common.d parse.d diff --git a/include/Makefile b/include/Makefile index 2143bea..59c3871 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,4 +1,4 @@ -includedir = ${DESTDIR}/include +includedir = ${PREFIX}/include INSTALL = install HEADERS = psyc.h diff --git a/include/psyc/Makefile b/include/psyc/Makefile index 75c6a3c..b0ad40d 100644 --- a/include/psyc/Makefile +++ b/include/psyc/Makefile @@ -1,6 +1,4 @@ -# Why do we have a Makefile in the include directory? - -includedir = ${DESTDIR}/include +includedir = ${PREFIX}/include INSTALL = install HEADERS = match.h method.h packet.h parse.h render.h text.h uniform.h variable.h diff --git a/lib/Makefile b/lib/Makefile index 609c6bc..54c5c38 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,4 +1,4 @@ -libdir = ${DESTDIR}/lib +libdir = ${PREFIX}/lib INSTALL = install LIBS = libpsyc.a libpsyc.so