changeset 11:3d6cfb615d90

add make install hierarchy
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 13 Dec 2023 05:16:12 +0000
parents 05a94b08c8e1
children 1ebc312f4b69
files Makefile include/Makefile libnumdb/Makefile libnumutil/Makefile utils/Makefile
diffstat 5 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Dec 13 03:56:16 2023 +0000
+++ b/Makefile	Wed Dec 13 05:16:12 2023 +0000
@@ -1,4 +1,6 @@
-SUBDIR=	libnumdb libnumutil utils
+SUBDIR=	include libnumdb libnumutil utils
+
+INSTALL_PREFIX=	/opt/themwi
 
 all:	${SUBDIR}
 
@@ -7,6 +9,11 @@
 ${SUBDIR}: FRC
 	cd $@; ${MAKE} ${MFLAGS}
 
+install: FRC
+	mkdir -p ${INSTALL_PREFIX}
+	for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} \
+		INSTALL_PREFIX=${INSTALL_PREFIX} install); done
+
 clean: FRC
 	rm -f a.out core errs
 	for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} clean); done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/Makefile	Wed Dec 13 05:16:12 2023 +0000
@@ -0,0 +1,12 @@
+INSTALL_PREFIX=	/opt/themwi
+
+INSTDIR=${INSTALL_PREFIX}/include/themwi/nanp
+FILES=	number_db_v2.h number_lookup.h number_utils.h
+
+all:
+
+install:
+	mkdir -p ${INSTDIR}
+	install -c -m 644 ${FILES} ${INSTDIR}
+
+clean:
--- a/libnumdb/Makefile	Wed Dec 13 03:56:16 2023 +0000
+++ b/libnumdb/Makefile	Wed Dec 13 05:16:12 2023 +0000
@@ -1,7 +1,10 @@
+INSTALL_PREFIX=	/opt/themwi
+
 CC=	gcc
 CFLAGS=	-O2 -I../build-inc
 OBJS=	check_nanp.o check_short.o readbin.o refresh.o
 LIB=	libnumdb.a
+INSTDIR=${INSTALL_PREFIX}/lib
 
 all:	${LIB}
 
@@ -9,5 +12,9 @@
 	ar rcu $@ ${OBJS}
 	ranlib $@
 
+install:
+	mkdir -p ${INSTDIR}
+	install -c -m 644 ${LIB} ${INSTDIR}
+
 clean:
 	rm -f *.[oa] errs
--- a/libnumutil/Makefile	Wed Dec 13 03:56:16 2023 +0000
+++ b/libnumutil/Makefile	Wed Dec 13 05:16:12 2023 +0000
@@ -1,7 +1,10 @@
+INSTALL_PREFIX=	/opt/themwi
+
 CC=	gcc
 CFLAGS=	-O2 -I../build-inc
 OBJS=	digit_groups.o nanp_valid.o numstring.o
 LIB=	libnumutil.a
+INSTDIR=${INSTALL_PREFIX}/lib
 
 all:	${LIB}
 
@@ -9,5 +12,9 @@
 	ar rcu $@ ${OBJS}
 	ranlib $@
 
+install:
+	mkdir -p ${INSTDIR}
+	install -c -m 644 ${LIB} ${INSTDIR}
+
 clean:
 	rm -f *.[oa] errs
--- a/utils/Makefile	Wed Dec 13 03:56:16 2023 +0000
+++ b/utils/Makefile	Wed Dec 13 05:16:12 2023 +0000
@@ -1,8 +1,11 @@
+INSTALL_PREFIX=	/opt/themwi
+
 CC=	gcc
 CFLAGS=	-O2 -I../build-inc
 PROGS=	themwi-check-own themwi-dump-numdb themwi-short-dial themwi-update-numdb
 LIBNUMDB=../libnumdb/libnumdb.a
 LIBUTIL=../libnumutil/libnumutil.a
+INSTBIN=${INSTALL_PREFIX}/bin
 
 all:	${PROGS}
 
@@ -18,5 +21,9 @@
 themwi-update-numdb:	themwi-update-numdb.o ${LIBUTIL}
 	${CC} -o $@ $@.o ${LIBUTIL}
 
+install:
+	mkdir -p ${INSTBIN}
+	install -c -m 755 ${PROGS} ${INSTBIN}
+
 clean:
 	rm -f *.o ${PROGS} errs