Reputation: 173
I am still relatively new to Linux, but I have an assignment in my operating systems class that involves several files. My professor gave us his makefile, but it isn't working for me. Make just returns errors. I know that I have all of the same files as my professor and, although mine aren't done yet, there is no reason I see for the code to not compile.
Here is the Makefile:
sync: sync.c prodcons.c prodcons.h producer.c producer.h consumer.c consumer.h Makefile
${CC} -g -Wall -pthread -o sync ssync.c prodcons.c producer.c consumer.c ln -sf sync assn4
and here is the error message I am getting:
J_studentid@cs3060:~/assn4$ make
cc -g -Wall -pthread -o sync sync.c prodcons.c producer.c consumer.c ln -sf sync assn4
cc: error: ln: No such file or directory
cc: error: sync: No such file or directory
cc: error: assn4: No such file or directory
cc: error: unrecognized command line option ‘-sf’; did you mean ‘-Hf’?
Makefile:2: recipe for target 'sync' failed
make: *** [sync] Error 1
J_studentid@cs3060:~/assn4$
I saw the professor compile and run the code in class, so I know it has the potential to work, but it is giving me problems. I am more than happy to provide more information or code, but I don't think the contents of the files is relevant to the compilation errors. Thank you!
Upvotes: 0
Views: 2528
Reputation: 31
I am pretty sure that this is the intended source code of your makefile that is both valid and working:
all:
${CC} -g -Wall -pthread -o sync ssync.c prodcons.c producer.c consumer.c
ln -sf sync assn4
Issues with your makefile were:
all:
ln -sf sync assn4
were used as compiler argumentsAlso, please make sure that the command lines (e.g., ${CC} ...
) always start with a TAB character. I cannot tell whether there was some in your codeblock since they are changed to spaces automatically here but wanted to point out.
Upvotes: 2