[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Make file with objects in one directory
From: |
Kiran |
Subject: |
Make file with objects in one directory |
Date: |
20 Aug 2006 19:58:23 -0700 |
User-agent: |
G2/0.2 |
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.
- Make file with objects in one directory,
Kiran <=