questions for the C programmer

Kunal Jain kuj3+@pitt.edu
Thu Jun 21 08:36:00 GMT 2001


Hi!

My problem is:-
I have a directory structure as follows ( I have simplified things by
reducing the number of directories and .c files).


			main directory
				|
		   ------------------------------------------------
		   |				|				   |
	 	dir1			    dir2          		dir3
	   (Makefile)			|                          |
					---------------             -------------
					|              |	          |            |
				    A.c              B.c          A.h         B.h


I need to compile the code such that all the object files are created in
dir1 and the final execuatble is also created in dir1. I cannot use an
implicit declaration in my Makefile like

.o.c :
	$(CC) $(CFLAGS) -c $*.c

because the .c files are in different directories. There could be an
alternative if I can declare something like a search path. Essentially, my
problem is "Is there such an implicit declaration possible?"
and if yes How do you set the search path for the .c files in a Makefile ?
thanks
Kunal




More information about the Gcc-help mailing list