Subject: Re: Makefile style?
To: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
From: Alistair Crooks <AlistairCrooks@excite.com>
List: tech-pkg
Date: 09/27/2000 01:07:34
On Wed, 27 Sep 2000 09:01:51 +0900, IWAMOTO Toshihiro wrote:
> 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.
Your understanding is quite correct - bsd.prefs.mk is intended to pull in
any user-defined configuration definitions, and also has the side-effect of
setting OPSYS and other system definitions - make(1) evaluates any .if
statements when it reads them, not when it evaluates any targets or
definitions, and so it's necessary to have the bsd.prefs.mk vehicle.
> 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
We should look at fixing at least some of these.
Thanks for your research,
Alistair
--
Alistair Crooks (agc@pkgsrc.org)
_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html