1

I can't run make with my Makefile. I got this message:

Makefile:8: *** missing separator. Stop.

I really don't know why, I already checked everything and I can't find any problem.

I already tried cat -e -t -v Makefile to see if I added a space, but I didn't find nothing.

Makefile code

CC=gcc
BINARY = airt
VERSION = v1.0.0-beta
FILES = chunk.h chunk.c memory.h memory.c common.h main.c

@echo $(VERSION)

@echo "Compiling..."
airt: $(FILES)
    $(CC) -o $(BINARY) $(FILES)

clean:
    rm -rf *.o
    rm -rf $(BINARY)
JFMR
  • 23,265
  • 4
  • 52
  • 76
Blue Slime
  • 53
  • 1
  • 2
  • 7
  • for completeness can you confirm that "too see if I added a space" means you have ruled out the answer to this https://stackoverflow.com/questions/920413/make-error-missing-separator – newbie Dec 31 '18 at 16:46
  • You can't have free-standing shell commands -- they must be inside a recipe. See what message you get if you place a tab in front of the `@echo` commands. – Brent Bradburn Dec 31 '18 at 16:54

1 Answers1

1

I think what you want is to use Make's info built-in function instead:

$(info $(VERSION))

Regarding the second echo, I would place it inside your target's recipe:

airt: $(FILES)
    @echo "Compiling..."
    $(CC) -o $(BINARY) $(FILES)

This way, the echo command will be executed by the shell, when the target airt is built.

JFMR
  • 23,265
  • 4
  • 52
  • 76