-1

My makefile will not run for some reason. This code comes from one of my instructors on how to run a makefile for java programs. It's called Makefile

all:
    javac cs286_p1/*.javac
    jar cmf manifest.mf cs286_p1.jar cs286_p1
    @echo "+ to run type: java -jar exampleProgram.jar"
    @echo "+ to run with command line arguments, simply append them to the line above"

I've run cat -e -t -v Makefile to see what the result was and it was this:

$ cat -e -t -v Makefile
all:^M$
^Ijavac cs286_p1/*.javac^M$
^Ijar cmf manifest.mf cs286_p1.jar cs286_p1^M$
^I@echo "+ to run type: java -jar exampleProgram.jar"^M$
^I@echo "+ to run with command line arguments, simply append them to the line above"^M$

Any help with this?

EDIT: It seems as as though dos2unix didn't work. I edited the file to take out the ~$. I'm editing and working on this in a linux environment that I'm currently connected to, I however started this on Notepad++ and made sure that ANSII was the encoding. Still not working, however, anything else that can be thought of?

Nallid
  • 1
  • 1
  • 2
  • 1
    "I edited the file to take out the ~$" The what? Did you edit the file to take out the carriage returns (shown as ^M)? How did you edit the file and what did you do? – Zanna Mar 04 '19 at 08:22
  • 1
    “I however started this on Notepad++ and made sure that ANSII was the encoding.” This is not enough, you are getting trouble with end-of-line (EOL) marks. This is a separate feature from encoding and it cannot be configured in Notepad++ (as of 6.8.8). Notepad++ is aware of the Linux EOLs (LF) and will use them when opening a file brought from Linux but when a new file is created, it uses Windows EOLs (CR+LF). How did you use dos2unix and what makes you think it didn’t work? – Melebius Mar 04 '19 at 13:23

1 Answers1

1

Looks like you have Microsoft line endings (Carriage Return + Linefeed, x0d0a instead of Linefeed alone, x0a). You edited this file in Windows, I suppose.

If you want to continue doing this, you should either get a Windows editor like notepad++ which can control the line endings (linux-like or windows-like) or else you apply dos2unix Makefile.

muclux
  • 5,154