2013年8月28日星期三

Neighborhoods heroes linux makefile under preparation

myapp: hello.o
hello.o: hello.c hello.h
gcc-c hello.c
My makefile is written , the resulting file is only hello.o, no myapp executable file. Will our heroes , how do I modify .
------ Solution ---------------------------------------- ----
gcc-c hello.c
This line must begin with a tab rather than a space
------ Solution ------------------------ --------------------

myapp: hello.o
    gcc -o myapp hello.o

------ For reference only ------------ ---------------------------
thank two
Finally, I put into this makefile
myapp: hello.o hellolinux.o
gcc hello.o hellolinux.o-o myapp
hello.o: hello.c hello.h
gcc-c hello.c-o hello.o
hellolinux.o: hellolinux.h hellolinux.c
gcc - hellolinux.c-o hellolinux.o

For myapp: hello.o hellolinux.o
gcc hello.o hellolinux.o-o myapp
I wish that can be understood as : myapp relies on two documents hello.o and hellolinux.o
If any of these documents discovered changed , execute gcc hello.o hellolinux.o-o myapp

没有评论:

发表评论