[ECOS] Re: about makefile
Nick Garnett
nickg@ecoscentric.com
Thu Sep 26 10:07:00 GMT 2002
张 亮 <johnsonest@hotmail.com> writes:
> Dear nickg,
> i have difficulty in orgnizing my header file and source file with
> makefile:
> I create two folder ,named after "include" and "src" in current directory:
> >ls
> include src test.c
>
> in test.c, i want to call codes in "include" and "src" folder:
>
> #include <stdio.h>
> #include "cs.h" //in include folder
>
> int main() {
> ....
> ...
> call fucntions in file "cs.c" in folder "src"
> ...
> }
>
> to compile this
> my makefile is:
>
> HEADER_DIR = include
> test: test.o cs.o gcc -o test test.o cs.o
> test.o: test.c cs.h gcc -c test.c cs.o : cs.c cs.h
> gcc -c cs.c -I$(SOURCE_DIR) clean:
> -rm *.o
>
> but:
> >make
> make: *** No rule to make target `cs.c', needed by `cs.o'. Stop.
> in fact,my cs.c is a set of functions called each other,no entry function.
>
> i am a newcomer about makefile,could you check my makefile ,tell me
> where error occur?
>
This is not really relevant to eCos, and it is not my job to teach you
how to use make, but I'll give you a few pointers:
Make does not know that you want it to look into the src subdirectory
for cs.c. You need to tell it, either by referring to src/cs.c
explicily in the makefile, or by using the VPATH mechanism. Find and
read the GNU make documentation for details.
--
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list