From 7ed845c4f258122c9a6702b8efe04960f95b4cb1 Mon Sep 17 00:00:00 2001 From: "psyc://loupsycedyglgamf.onion/~lynX" Date: Wed, 4 Apr 1984 00:44:05 +0000 Subject: [PATCH 1/2] support make install DESTDIR=... --- INSTALL.org | 13 +++++++------ Makefile | 19 ++++++++++++++++--- d/include/psyc/Makefile | 3 +-- include/Makefile | 3 +-- include/psyc/Makefile | 3 +-- lib/Makefile | 3 +-- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/INSTALL.org b/INSTALL.org index 50a8ceb..1898ab5 100644 --- a/INSTALL.org +++ b/INSTALL.org @@ -15,13 +15,14 @@ and you are done. Other possible targets include: -: make install [prefix=/usr] # install into prefix -: make diet # compile with diet libc -: make test # compile and run the tests -: make doc # generate the API documentation (will be put in the doc folder) -: make help # display the possible targets +: make install DESTDIR=/usr # install into DESTDIR +: make diet # compile with diet libc +: make test # compile and run the tests +: make doc # generate the API documentation using doxygen + # (will be put in the doc folder) +: make help # display the possible targets On BSD try this: -: sudo gmake install prefix=/usr/local +: sudo gmake install DESTDIR=/usr/local diff --git a/Makefile b/Makefile index 0217dcf..b8ca0b6 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,28 @@ 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 \ + mkdir "$(DESTDIR)" ;\ + fi + @if [ ! -w "$(DESTDIR)" ]; then \ + echo "libpsyc install: You must provide a writable DESTDIR." ;\ + exit 2 ;\ + else true; fi + install: install-lib install-inc install-d -install-lib: all +install-lib: destdir all ${MAKE} -C lib install -install-inc: all +install-inc: destdir all ${MAKE} -C include install -install-d: all +install-d: destdir all ${MAKE} -C d install debug: diff --git a/d/include/psyc/Makefile b/d/include/psyc/Makefile index 3e8ad21..ab9f8aa 100644 --- a/d/include/psyc/Makefile +++ b/d/include/psyc/Makefile @@ -1,5 +1,4 @@ -prefix = /usr -includedir = ${prefix}/include/d +includedir = ${DESTDIR}/include/d INSTALL = install HEADERS = common.d parse.d diff --git a/include/Makefile b/include/Makefile index 6fe5d21..2143bea 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,5 +1,4 @@ -prefix = /usr -includedir = ${prefix}/include +includedir = ${DESTDIR}/include INSTALL = install HEADERS = psyc.h diff --git a/include/psyc/Makefile b/include/psyc/Makefile index 989f7c7..75c6a3c 100644 --- a/include/psyc/Makefile +++ b/include/psyc/Makefile @@ -1,7 +1,6 @@ # Why do we have a Makefile in the include directory? -prefix = /usr -includedir = ${prefix}/include +includedir = ${DESTDIR}/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 62f7a85..609c6bc 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,5 +1,4 @@ -prefix = /usr -libdir = ${prefix}/lib +libdir = ${DESTDIR}/lib INSTALL = install LIBS = libpsyc.a libpsyc.so 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 2/2] 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