LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Shell commands in GNU make? (https://www.linuxquestions.org/questions/linux-software-2/shell-commands-in-gnu-make-147281/)

MadCactus 02-17-2004 03:11 PM

Shell commands in GNU make?
 
Hi,

Was wondering, how can you put say a for loop into a makefile so it works?

Something like:

sub: $(HEADERS)
for dir in $(SUBDIRS) do cd $dir && make

I've seen $() used to contain shell commands e.g. $(shell pwd), and other times without "shell". The GNU make manual seems to suggest that its valid just to write the command without the $()...

Also i'm not sure about using shell variables - if I write a for loop like above - is it valid to refer to $dir, or should I write $(dir)?

Cheers,

M


All times are GMT -5. The time now is 12:38 PM.