[PATCH] Don't hardcode target dependencies

Dan Nicholson dbn.lists at gmail.com
Thu Mar 15 14:30:47 PDT 2007


On 3/15/07, Dan Nicholson <dbn.lists at gmail.com> wrote:
>
> More generally, the targets can just be passed through for make. So,
> with my previous patch, you'd do
>
> @(sudo $(SU_LUSER) "... && make LUSER_TARGETS="$(LUSER_TARGETS)" LUSER)
>
> That should achieve the affect I'm after without really adding anything new.

An example.

$ cat Makefile
foo = bar baz
luser = dan
su_luser = su - $(luser) -c

target1:
        sudo make target2
        sudo $(su_luser) "make foo='$(foo)' target2"
target2:
        echo $(foo)

$ make
sudo make target2
make[1]: Entering directory `/home/dan'
echo bar baz
bar baz
make[1]: Leaving directory `/home/dan'
sudo su - dan -c "make foo='bar baz' target2"
echo bar baz
bar baz

$ make foo=bif
sudo make target2
make[1]: Entering directory `/home/dan'
echo bif
bif
make[1]: Leaving directory `/home/dan'
sudo su - dan -c "make foo='bif' target2"
echo bif
bif

I think this is the preferred way to pass variables to sub-makes anyway.

--
Dan



More information about the alfs-discuss mailing list