LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   makefile (https://www.linuxquestions.org/questions/programming-9/makefile-21403/)

Winter 05-20-2002 02:43 PM

makefile
 
I have an assignment and I am supposed to create a file called "makefile" and use the command 'make' to execute "makefile"

here is the example given..

----------------------------------
sample: main.o sort.o addone.o search.o
cc main.o sort.o addone.o search.o -o foo
main.o: main.c
sort.o: sort.c
addone.o: addone.c
search.o: search.c

(NOTE: The spaces preceding "cc main.o . . ." is really a tab. The tab character must be present!)

Now, to create the executable program called "foo", simple type "make" on the command line.
----------------------------------

I tried this

sample: main.o orderedlist.o average.o deviation.o input.o variance.o classify.o highscore.o lowscore.o testinput.o
cc main.o orderedlist.o average.o deviation.o input.o variance.o classify.o highscore.o lowscore.o testinput.o -o main
main.o: main.c
orderedlist.o: orderedlist.c
average.o: average.c
deviation.o: deviation.c
input.o: input.c
variance.o: variance.c
classify.o: classify.c
highscore.o: highscore.c
lowscore.o: lowscore.c
testinput.o: testinput.c


that gave an error..

makefile:2: *** missing separator. Stop.

I am assuming that this error was caused because of a lack of : usage in line 2.. how do I correct this?

urhome 05-20-2002 05:00 PM

I ran into this problem also and I think I resolved it by creating an entirely new makefile using vi and pasting the contents of the old one on a per line basis. The error I think was because there were some unprintable characters got inserted in the makefile somehow with the editor I was using. Good luck.

Winter 05-21-2002 12:43 PM

I got it working thx!


All times are GMT -5. The time now is 11:40 PM.