Subject: Makefile style?
To: None <tech-pkg@netbsd.org>
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
List: tech-pkg
Date: 09/27/2000 09:01:51
While I attempted to add something like:

	.if ${OPSYS} == "SunOS"
	PORT_NAME=      gso
	.else
	PORT_NAME=      neb
	.endif

into mail/imap-uw/Makefile, I noticed that some Makefiles have such
code after including bsd.pkg.mk (such as mail/pine/Makefile), while
others have them after including bsd.prefs.mk and before including
bsd.pkg.mk (such as audio/mpg123/Makefile).

I think the latter style is the canonical one and Makefiles in the
former style should be fixed.  I think this is why bsd.prefs.mk is
for.

Is my understanding correct?  I'm not very sure as there are many
Makefiles in the former style.

Here is a list of Makefiles which have if-statements after including
bsd.pkg.mk.  Some of them depends on valiables defined in bsd.pkg.mk
(NEED_NCURSES, e.g.) and they cannot be easily converted.
But most of them doesn't seem to need ifs after inclusion of bsd.pkg.mk.

kiku:/usr/pkgsrc$ for f in */*/Makefile; do
> if sed '1,/bsd.pkg.mk/d' < $f | grep -q '^\.if' ; then echo $f; fi; done
audio/gogo/Makefile
audio/timidity/Makefile
biology/rasmol/Makefile
cross/binutils/Makefile
databases/db/Makefile
devel/cscope/Makefile
editors/vim-gtk/Makefile
editors/vim-xaw/Makefile
editors/vim/Makefile
emulators/darcnes/Makefile
emulators/fmsx/Makefile
games/gnome-games/Makefile
games/xskat/Makefile
graphics/Ngraph/Makefile
graphics/clanlib/Makefile
graphics/xanim/Makefile
lang/guavac/Makefile
mail/mutt/Makefile
mail/pine/Makefile
math/octave/Makefile
misc/dialog/Makefile
net/eggdrop/Makefile
shells/bash2/Makefile
sysutils/fileutils/Makefile
sysutils/mc/Makefile
textproc/textutils/Makefile
www/ap-perl/Makefile
www/apache6/Makefile
www/lynx-current/Makefile
www/lynx/Makefile
www/ns-plugger-common/Makefile
www/w3c-httpd/Makefile
x11/gnome-libs/Makefile

--
IWAMOTO Toshihiro