Re: Dynamic make target

Manish Katiyar <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
On Wed, Dec 2, 2009 at 11:19 PM, Toan Pham <[email protected]> wrote:
> hi all,
>
> I do not know where to ask this question perhaps this mailing list is
> best because it had to do with c complilation.
>
> I would like to set up a make target dynamicly.  for example
>
> when one issue command:  make sda1
> it auto compile and install to a mount point @ /mnt/sda1
>
> similiarly: make sda2 would compile and install to /mnt/sda2
>
>
> i know that in a makefile one can accomplish this by setting up two targets, ie.
>
> sda1:
>       make all
>       mount /dev/sda1 /mnt/sda1
>       cp releases/* /mnt/sda1
>       umount /mnt/sda1
>
> sda2:
>       make all
>       mount /dev/sda1 /mnt/sda2
>       cp releases/* /mnt/sda2
>       umount /mnt/sda2
>
>
> i am curious if we can simplify everything by having a make target
> like this when no matches found


Will something like this help ?

/tmp/test> make
echo "Making defaults"
Making defaults

/tmp/test> make TARGET=manish
echo manish is target;
manish is target

/tmp/test> cat Makefile
ifeq ("$(origin TARGET)", "command line")
$(TARGET):
	echo $@ is target;
else
all:
	echo "Making defaults"
endif



>
> $param1:
>       make all
>       mount /dev/sda1 /mnt/$param1
>       cp releases/* /mnt/$param1
>       umount /mnt/$param1
>
> thank you,
>
> Toan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Thanks -
Manish
==================================
[$\*.^ -- I miss being one of them
==================================
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.