Make file with objects in one directory
"Kiran" <[email protected]>
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hi, I am new to unix make and so, this question may sound little silly. But please help. I need to compile a list of .c and .cpp source files that are in a big directory structure. Ex: /code_root /design/tools/test1.c /design/tools/test2.c /design/src/tcpstack.cpp /design/src/tcpsrlze.c /design/src/util/charconv.cpp /arch/src/frmwrk/frmroot.cpp like wise there are about 700 files in the directory structure. I need to write a unix make file that can compile all these files and then create the objects in one directory namely /code_root/obj Can some please help on how to write? I have the following, but it compiles into the source itself. $OBJECTS= \ /code_root/design/tools/test1.o \ /code_root/design/tools/test2.o \ /code_root/design/src/tcpstack.opp \ /code_root/design/src/tcpsrlze.o \ /code_root/design/src/util/charconv.opp \ /code_root/arch/src/frmwrk/frmroot.opp \ all: $(OBJECTS) %.o:%.c $(CC) -c $< -o $@ %.opp:%.cpp $(CC) -c $< -o $@ Well, I downloaded this code from some where and I kind of understood what it is doing. But couldn't change it to get what I want. Thanks in advance for your help.