New makefile nitpick

Dan Nicholson dbn.lists at gmail.com
Fri Sep 15 14:30:22 PDT 2006


On 9/15/06, George Boudreau <georgeb at linuxfromscratch.org> wrote:
> >
>    Rather than have the user play with the sudoers file I will add this
> line to the generated Makefile.
>
> export PATH := ${PATH}:/usr/sbin
>
>    If the user already has /usr/sbin in his/her PATH then this will be
> redundant. YES, I could check for and not add the additional path if it
> already existed but this is a cheap and dirty fix.

First, I like it better to just put the needed paths in the Makefile
than to silently expect them to be there. Here's an alternative that
bombs if /sbin or /usr/sbin aren't in the path. Then the user can put
it where they want.

$ cat Makefile
all: checkpaths
        ls
checkpaths:
ifeq (,$(findstring /sbin,$(subst :, ,$(PATH))))
        $(error You must have /sbin in your PATH!)
endif
ifeq (,$(findstring /usr/sbin,$(subst :, ,$(PATH))))
        $(error You must have /usr/sbin in your PATH!)
endif
$ make
Makefile:6: *** You must have /sbin in your PATH!.  Stop.
$ PATH=/sbin:$PATH
$ make
Makefile:9: *** You must have /usr/sbin in your PATH!.  Stop.
$ PATH=/usr/sbin:$PATH
$ make
ls
afind         dummy.s                   Makefile            test.sh
arg           filelist                  newer               time-check.sh
backup1.snar  foo.sh                    progress            timestamp
backup1.tar   gcc-glibc-corruption.txt  prototype.sh        trace
dbnb          glibc-build-desaster      prototype.tar.bz2   ziptest
dummy.c       glibc-desaster2           ps4.sh
dummy.i       grub_glibc_error.txt      scriptlets.tar.bz2

--
Dan



More information about the alfs-discuss mailing list