Bug 191056 - bsd.progs.mk: bsd.prog.mk incompatibilities with variables being set and not set
Summary: bsd.progs.mk: bsd.prog.mk incompatibilities with variables being set and not set
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Enji Cooper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-15 08:51 UTC by Enji Cooper
Modified: 2014-10-23 00:56 UTC (History)
2 users (show)

See Also:


Attachments
Proposed fix (703 bytes, patch)
2014-06-15 08:55 UTC, Enji Cooper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2014-06-15 08:51:48 UTC
There are some values where, if unset in bsd.prog.mk, would default to the <PROG>.<appropriate.extension>. For instance if I had a Makefile that defined a program a, like so...

% cat *
# Makefile
PROG= a

.include <bsd.prog.mk>
/* a.c */
#include <stdio.h>

int
main(void) {

    printf("hello world\n");
    return (0);
}
% make all
Warning: Object directory not changed from original /root/make_tests/prog_mk
cc -O2 -pipe   -std=gnu99 -fstack-protector   -Qunused-arguments -c a.c
cc -O2 -pipe   -std=gnu99 -fstack-protector   -Qunused-arguments  -o a a.o 
make: don't know how to make a.1. Stop

make: stopped in /root/make_tests/prog_mk
%

As shown above, bsd.prog.mk automatically assumes that there was a corresponding source file for ;a' called 'a.c', and there's a manpage a.1.

bsd.progs.mk doesn't maintain this compatibility because it passes through several variables with empty values instead of not passing them through in the first place. Example:

% cat *
# Makefile
PROGS=	a

.include <bsd.progs.mk>
/* a.c */
#include <stdio.h>

int
main(void)
{

	printf("hello world!\n");
	return (0);
}
% make all
(cd /root/make_tests/progs_mk && make -f Makefile _RECURSING_PROGS=  SUBDIR= PROG=a )
Warning: Object directory not changed from original /root/make_tests/progs_mk
make[1]: don't know how to make .o. Stop

make[1]: stopped in /root/make_tests/progs_mk
*** Error code 2

Stop.
make: stopped in /root/make_tests/progs_mk

Expected result:

- The following variables should not be passed through if they aren't set:
-- BINDIR
-- MAN
-- SRCS

There might be more, but these are definite issues that I've found when testing out bsd.progs.mk over the past couple months.

My diff against bsd.progs.mk is attached as a reference for how I "fixed" the problem.
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2014-06-15 08:55:07 UTC
Created attachment 143799 [details]
Proposed fix
Comment 2 Enji Cooper freebsd_committer freebsd_triage 2014-09-24 04:47:52 UTC
Fixed in r272055. Awaiting MFC timeout.