Skip site navigation (1)Skip section navigation (2)
Date:      31 Jan 2018 18:39:40 +0100
From:      Nikola Kolev <koue@chaosophia.net>
To:        freebsd-questions@freebsd.org
Subject:   bsd.lib.mk LIBDIR
Message-ID:  <Prayer.1.3.5.1801311839400.72721@chaosophia.net>

next in thread | raw e-mail | index | archive | help
Howdy,

I'm dealing with bsd.lib.mk and if 'LIBDIR' is defined in the Makefile file 
it's not handled properly.

# cat Makefile
LIB=            test
CFLAGS+=        -Wall -Wstrict-prototypes
SRCS=           test.c
NO_OBJ=         yes

.include <bsd.lib.mk>

# make cc -O2 -pipe -Wall -Wstrict-prototypes -DNDEBUG -std=gnu99 
-Qunused-arguments -c test.c -o test.o building static test library ranlib 
-D libtest.a

# make install
install -C -o root -g wheel -m 444   libtest.a /usr/lib

# ls -la /usr/lib/libtest.a 
-r--r--r--  1 root  wheel  1398 Jan 31 18:23 /usr/lib/libtest.a

If 'LIBDIR' is defined the library file is installed as '${LIBDIR}' not in 
'${LIBDIR}'

# cat Makefile 
LIB=            test
CFLAGS+=        -Wall -Wstrict-prototypes
SRCS=           test.c
NO_OBJ=         yes
LIBDIR=         /usr/lib/mylibz

.include <bsd.lib.mk>

# make cc -O2 -pipe -Wall -Wstrict-prototypes -DNDEBUG -std=gnu99 
-Qunused-arguments -c test.c -o test.o building static test library ranlib 
-D libtest.a

# make install
install -C -o root -g wheel -m 444   libtest.a /usr/lib/mylibz

# ls -la /usr/lib/mylibz 
-r--r--r--  1 root  wheel  1398 Jan 31 18:24 /usr/lib/mylibz

According to /usr/share/mk/bsd.README:
LIBDIR          Target directory for libraries.

Instead of install the library file as '${LIBDIR}' 'make' should complain 
if the directory is missing or try to create it and then install the 
library file in it.

Did I miss something?

Thanks,
Nikola
-- 
Nikola Kolev
koue@chaosophia.net
https://github.com/koue/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Prayer.1.3.5.1801311839400.72721>