I have some directories which have source code. the source code in that directory are independent of each other. All are dependent on one single common/main directory.
In each directory there is one Makefile which will generate .so (dynamic lib file).
There is one main Makefile which will initiate or call make command in subdirectories.
Since it calls sequentially the time taken is more.
i want to call them simultaneously so the job (or compilation completes faster)
for example: current Makefile [Note : not exact makefile , just an example]
DIR1/make
DIR2/make
gcc *.c DIR1/xx.so DIR2/yy.so
if fork the make command like this.....
DIR1/make &
DIR2/make &
#i want to wait here for them to complete but dont know how
gcc *.c DIR1/xx.so DIR2/yy.so
..........
my question :
can any one tell me how can i wait for the process to complete when it is run in the background.
Or rather
How to know if the background process is finished