Home > Net >  make: *** No rule to make target 'rm', needed by 'clean' or Makefile:27: *** mis
make: *** No rule to make target 'rm', needed by 'clean' or Makefile:27: *** mis

Time:06-24

hi i have problem when i try to use this command "make fclean" can you help me ? the makefile return me "Makefile:27: *** missing separator" if I don't put "" behind "clean:" but when i'm put this, he return : "make: *** No rule to make target 'rm', needed by 'clean'"

##
## **** PROJECT, 2022
## Makefile
## File description:
## Makefile that build the project
##

SRC =       ./main.c    \
            ./calc.c

OBJ = $(SRC:.c=.o)

NAME = fakeProj

CFLAGS = -ftest-coverage -O2

BCK_DIR = backup

CC = clang

all: $(NAME)

$(NAME):    $(OBJ)
    $(CC) -o $(NAME) $(OBJ)

clean:
      rm -f $(OBJ)

fclean: clean     \
      rm -f $(NAME)

re: fclean  all

# .PHONY: all clean fclean re


CodePudding user response:

Remove your stray backslash:

fclean: clean     \
        rm -f $(NAME)

By adding a backslash at the end of this line, make treats it like:

fclean: clean rm -f $(NAME)

(e.g., these are all prerequisites of the fclean target)

  • Related