Good $daytime,
> Date: Thu, 13 Aug 1998 10:14:56 +0300
> From: Ibrahim F Haddad <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: offtopic: makefile
> I have a directory that contains 2 sub directories.
> In each of the subdirectories I have a software
> that uses makefile to compile. So i have 2 makefiles.
> I need to have a makefile in the root directory that
> upon the initation of 'make' would go and
> do 'make' for the makefiles available in the 2
> subdirectories.
> the question is: how??? :)
Well, should be somewhat like
----- 8< -----
ROOT=
SUBDIRS=dir1 dir2
all clean distclean depend install indent lint::
@for dir in $(SUBDIRS); do \
echo Making $@ in $$dir; \
(cd $$dir; $(MAKE) $(MFLAGS) ROOT=../$(ROOT) $@); \
done
endif
all::
...
clean::
...
----- 8< -----
this way $(ROOT) can be used anywhere in depth to refer to initial dir
(and to any file as well, say $(ROOT)include/misc.h)
Don't forget that recursive targets from now on should have `::' , not `:'
Look at `info make' for more.
Regards,
Willy.
--
"No easy hope or lies | Vitaly "Willy the Pooh" Fedrushkov
Shall bring us to our goal, | Information Technology Division
But iron sacrifice | Chelyabinsk State University
Of Body, Will and Soul." | mailto:[EMAIL PROTECTED] +7 3512 156770
R.Kipling | http://www.csu.ac.ru/~willy VVF1-RIPE