Bug 225601 - /usr/share/mk/bsd.lib.mk LIBDIR improper conduct
Summary: /usr/share/mk/bsd.lib.mk LIBDIR improper conduct
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.3-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-01 10:06 UTC by Nikola Kolev
Modified: 2018-02-01 10:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikola Kolev 2018-02-01 10:06:59 UTC
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 in Makefile the library file is installed as '${LIBDIR}' instead 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.

Do I miss something?