Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

make: *** No rule to make target 'rm', needed by 'clean' or Makefile:27: *** missing separator

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


>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading