svk
March 2nd, 2009, 06:08 PM
I'm a little bit confused about makefiles. According to the documentation (http://www.cs.utah.edu/dept/old/texinfo/make/make.html#SEC5), a rule has the following format:
target ... : dependencies ...
command
...
...
I was told that the command part can be any shell command. With that in mind, I tried to do this in my makefile:
final:
ls *.o
tar cf final.tar makefile *.cpp *.h
I was expecting that the ls commands would simply print out all the filenames that have the .o extension. Instead, I got this:
serg@bijou:~/Desktop$ make final
ls *.o
ls: cannot access *.o: No such file or directory
make: *** [turnin] Error 2
And it never creates the tar archive on the next line of the makefile. Why doesn't this work and how can I fix it?
target ... : dependencies ...
command
...
...
I was told that the command part can be any shell command. With that in mind, I tried to do this in my makefile:
final:
ls *.o
tar cf final.tar makefile *.cpp *.h
I was expecting that the ls commands would simply print out all the filenames that have the .o extension. Instead, I got this:
serg@bijou:~/Desktop$ make final
ls *.o
ls: cannot access *.o: No such file or directory
make: *** [turnin] Error 2
And it never creates the tar archive on the next line of the makefile. Why doesn't this work and how can I fix it?