From d204cf63a346701431139eab97c8374a998eca56 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Sat, 4 Feb 2023 00:59:52 +0100 Subject: Separate libs declarations from targets --- Makefile | 4 +++- libs.config.mk | 11 +++++++++++ libs.mk | 23 ----------------------- libs.target.mk | 13 +++++++++++++ 4 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 libs.config.mk delete mode 100644 libs.mk create mode 100644 libs.target.mk diff --git a/Makefile b/Makefile index 6e02b4d..a3cd0cf 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # See LICENSE file for copyright and license details. -include libs.mk +include libs.config.mk CC = cc SRC != find src -name "*.c" @@ -40,3 +40,5 @@ clean: tests: all cd test && make clean tests + +include libs.target.mk diff --git a/libs.config.mk b/libs.config.mk new file mode 100644 index 0000000..606718f --- /dev/null +++ b/libs.config.mk @@ -0,0 +1,11 @@ +# See LICENSE file for copyright and license details. + +LIBDIR = lib + +LIBSTR_VER = 0.0.0-a1 +LIBSTR = cstr-${LIBSTR_VER} +LIBSTR_INC = -I${LIBDIR}/${LIBSTR}/src +LIBSTR_LIB = -L${LIBDIR}/${LIBSTR} -l:libstr.a + +LIBINC = ${LIBSTR_INC} +LIBS = ${LIBSTR_LIB} diff --git a/libs.mk b/libs.mk deleted file mode 100644 index fc59935..0000000 --- a/libs.mk +++ /dev/null @@ -1,23 +0,0 @@ -# See LICENSE file for copyright and license details. - -LIBDIR = lib - -LIBSTR_VER = 0.0.0-a1 -LIBSTR = cstr-${LIBSTR_VER} -LIBSTR_INC = -I${LIB_DIR}/${LIBSTR}/src -LIBSTR_LIB = -L${LIB_DIR}/${LIBSTR} -l:libstr.a - -LIBINC = ${LIBSTR_INC} -LIBS = ${LIBSTR_LIB} - -clean-libs: - rm -rf ${LIBDIR} - -libs: ${LIBDIR} ${LIBDIR}/${LIBSTR} - -${LIBDIR}: - @mkdir -p $@ - -${LIBDIR}/${LIBSTR}: - fetch -o - https://git.alessandroiezzi.it/libs/c/cstr.git/snapshot/${LIBSTR}.tar.gz | tar xzf - -C ${LIBDIR} - cd $@ && make diff --git a/libs.target.mk b/libs.target.mk new file mode 100644 index 0000000..fa300e3 --- /dev/null +++ b/libs.target.mk @@ -0,0 +1,13 @@ +# See LICENSE file for copyright and license details. + +clean-libs: + rm -rf ${LIBDIR} + +libs: ${LIBDIR} ${LIBDIR}/${LIBSTR} + +${LIBDIR}: + @mkdir -p $@ + +${LIBDIR}/${LIBSTR}: + fetch -o - https://git.alessandroiezzi.it/libs/c/cstr.git/snapshot/${LIBSTR}.tar.gz | tar xzf - -C ${LIBDIR} + cd $@ && make -- cgit v1.2.3