Makefile

Hi guys.I have a problem about makefile. I hava a diagram following..

[url=http://hizliresim.com/x8Gj6V][img]http://i.hizliresim.com/x8Gj6V.jpg[/img][/url]

I wrote a makefile file but I do not know where library file is write??

my makefile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

dummy:        prog1.exe prog2.exe
              echo "build done"

prog1.exe:    x.o y.o 
              $(CC) x.o y.o -o prog1.exe

prog2.exe:    z.o d.o
              $(cc) z.o d.o -o prog2.exe

x.o:          x.c defs.h
              $(CC) -c x.c

y.o:          y.c def2.h def3.h
              $(CC) -c y.c

z.o:         z.c def2.h def3.h
             $(CC) -c z.c

d.o           d.c def3.h
              $(CC) -c d.c 








please help?
Last edited on
It looks like you need to link it with prog1
OK.But can you show me on code?
5
6
prog1.exe:    x.o y.o libpet.a
              $(CC) x.o y.o -lpet -o prog1.exe
thank you very much.Finally,
why did you lpet instead of libpet..?
The -l argument takes a library name, not a library filename. The filename varies from platform to platform; the name does not.
Thank you very much.İt works. Final question, can we save exe files previous directories?
I used mv command but it does not work.
5
6
prog1.exe:    x.o y.o libpet.a
              $(CC) x.o y.o -lpet -o ../other-directory/prog1.exe
Topic archived. No new replies allowed.