Commit 91139e89553ea5a0b51d2a9bab87aae35dda67d5

Thomas de Grivel 2023-01-24T10:27:29

install in ${prefix}

diff --git a/c3s/Makefile b/c3s/Makefile
index 0747643..9ff39fe 100644
--- a/c3s/Makefile
+++ b/c3s/Makefile
@@ -48,8 +48,8 @@ gdb_c3s: debug
 	if [ -f c3s_debug.core ]; then gdb c3s_debug c3s_debug.core; else gdb c3s_debug; fi
 
 install:
-	mkdir -p ${PREFIX}/bin
-	install -m 755 c3s ${PREFIX}/bin/c3s
+	mkdir -p ${prefix}/bin
+	install -m 755 c3s ${prefix}/bin/c3s
 
 .PHONY: all asan cov debug clean clean_cov distclean
 
diff --git a/config.subr b/config.subr
index 5ff4699..c25331e 100644
--- a/config.subr
+++ b/config.subr
@@ -171,6 +171,8 @@ echo "LIBTOOL = $LIBTOOL" >> ${CONFIG_MK}
 
 PREFIX="${PREFIX:-/usr/local}"
 echo "PREFIX = $PREFIX" >> ${CONFIG_MK}
+echo "DESTDIR ?=" >> ${CONFIG_MK}
+echo "prefix ?= ${DESTDIR}/${PREFIX}" >> ${CONFIG_MK}
 
 if [ "x$OWNER" = "x" ]; then
     OWNER="$(ls -ld "$PREFIX" | tr -s ' ' | cut -d ' ' -f 3)"
diff --git a/ic3/Makefile b/ic3/Makefile
index af123ff..4e1db2a 100644
--- a/ic3/Makefile
+++ b/ic3/Makefile
@@ -48,8 +48,8 @@ gdb_ic3: debug
 	if [ -f ic3_debug.core ]; then gdb ic3_debug ic3_debug.core; else gdb ic3_debug; fi
 
 install:
-	mkdir -p ${PREFIX}/bin
-	install -m 755 ic3 ${PREFIX}/bin/ic3
+	mkdir -p ${prefix}/bin
+	install -m 755 ic3 ${prefix}/bin/ic3
 
 .PHONY: all asan cov debug clean clean_cov distclean
 
diff --git a/libc3/Makefile b/libc3/Makefile
index 77b3f6a..d00a62c 100644
--- a/libc3/Makefile
+++ b/libc3/Makefile
@@ -45,35 +45,35 @@ gcovr:
 	gcovr --gcov-executable ${GCOV} --html-details libc3.html
 
 install:
-	mkdir -p ${PREFIX}/include/c3
-	install -m 644 arg.h ${PREFIX}/include/c3/
-	install -m 644 bool.h ${PREFIX}/include/c3/
-	install -m 644 buf.h ${PREFIX}/include/c3/
-	install -m 644 buf_file.h ${PREFIX}/include/c3/
-	install -m 644 buf_inspect.h ${PREFIX}/include/c3/
-	install -m 644 buf_parse.h ${PREFIX}/include/c3/
-	install -m 644 buf_save.h ${PREFIX}/include/c3/
-	install -m 644 c3.h ${PREFIX}/include/c3/
-	install -m 644 call.h ${PREFIX}/include/c3/
-	install -m 644 character.h ${PREFIX}/include/c3/
-	install -m 644 compare.h ${PREFIX}/include/c3/
-	install -m 644 debug.h ${PREFIX}/include/c3/
-	install -m 644 env.h ${PREFIX}/include/c3/
-	install -m 644 eval.h ${PREFIX}/include/c3/
-	install -m 644 fact.h ${PREFIX}/include/c3/
-	install -m 644 facts.h ${PREFIX}/include/c3/
-	install -m 644 fn.h ${PREFIX}/include/c3/
-	install -m 644 hash.h ${PREFIX}/include/c3/
-	install -m 644 ident.h ${PREFIX}/include/c3/
-	install -m 644 integer.h ${PREFIX}/include/c3/
-	install -m 644 list.h ${PREFIX}/include/c3/
-	install -m 644 quote.h ${PREFIX}/include/c3/
-	install -m 644 str.h ${PREFIX}/include/c3/
-	install -m 644 tag.h ${PREFIX}/include/c3/
-	install -m 644 tuple.h ${PREFIX}/include/c3/
-	install -m 644 ucd.h ${PREFIX}/include/c3/
-	mkdir -p ${PREFIX}/lib
-	libtool install libc3.la ${PREFIX}/lib
+	mkdir -p ${prefix}/include/c3
+	install -m 644 arg.h ${prefix}/include/c3/
+	install -m 644 bool.h ${prefix}/include/c3/
+	install -m 644 buf.h ${prefix}/include/c3/
+	install -m 644 buf_file.h ${prefix}/include/c3/
+	install -m 644 buf_inspect.h ${prefix}/include/c3/
+	install -m 644 buf_parse.h ${prefix}/include/c3/
+	install -m 644 buf_save.h ${prefix}/include/c3/
+	install -m 644 c3.h ${prefix}/include/c3/
+	install -m 644 call.h ${prefix}/include/c3/
+	install -m 644 character.h ${prefix}/include/c3/
+	install -m 644 compare.h ${prefix}/include/c3/
+	install -m 644 debug.h ${prefix}/include/c3/
+	install -m 644 env.h ${prefix}/include/c3/
+	install -m 644 eval.h ${prefix}/include/c3/
+	install -m 644 fact.h ${prefix}/include/c3/
+	install -m 644 facts.h ${prefix}/include/c3/
+	install -m 644 fn.h ${prefix}/include/c3/
+	install -m 644 hash.h ${prefix}/include/c3/
+	install -m 644 ident.h ${prefix}/include/c3/
+	install -m 644 integer.h ${prefix}/include/c3/
+	install -m 644 list.h ${prefix}/include/c3/
+	install -m 644 quote.h ${prefix}/include/c3/
+	install -m 644 str.h ${prefix}/include/c3/
+	install -m 644 tag.h ${prefix}/include/c3/
+	install -m 644 tuple.h ${prefix}/include/c3/
+	install -m 644 ucd.h ${prefix}/include/c3/
+	mkdir -p ${prefix}/lib
+	libtool install libc3.la ${prefix}/lib
 
 libc3.a: libc3.la
 	cp .libs/libc3.a ./
diff --git a/libc3/configure b/libc3/configure
index b3e3c6b..5e7c70a 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -103,8 +103,8 @@ echo "	${LIBTOOL} --tag=CC --mode=link \${CC} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG}
 
 echo >> ${CONFIG_MK}
 echo "install: ${LIB}" >> ${CONFIG_MK}
-echo "	\${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 -d \${LIBDIR}" >> ${CONFIG_MK}
-echo "	\${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 ${LIB} \${LIBDIR}" >> ${CONFIG_MK}
+echo "	\${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 -d \${prefix}/lib" >> ${CONFIG_MK}
+echo "	\${LIBTOOL} --tag=CC --mode=install \${INSTALL} -o \${OWNER} -g \${GROUP} -m 0755 ${LIB} \${prefix}/lib" >> ${CONFIG_MK}
 
 for SRC in $SOURCES; do
     echo >> ${CONFIG_MK}