Re: Dynamic make target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Wed, Dec 2, 2009 at 11:19 PM, Toan Pham <tpham3783@xxxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

Add to Google Powered by Linux