cgccmakefile

make: Circular mysh <- mysh dependency dropped


I have a very simple Makefile which is supposed to do the same task as gcc -o mysh mysh.c -Wall but I am receiving make: Circular mysh <- mysh dependency dropped. however the executable is created and works fine. Do you know how to remove this message?

C=gcc
CFLAGS=-Wall

all: mysh
mysh: mysh
        ${C} ${CFLAGS} -o mysh mysh.c

clean:
        rm -f mysh
run: mysh
        ./mysh

Solution

  • Change

    mysh: mysh
    

    into

    mysh: mysh.c
    

    That should do it.

    You had mysh dependent on mysh which is a circular dependency.