Makefile relinking issue

129 Views Asked by At

I was trying to adjust my standard makefile to include vpath. I got it working as I want, however it keeps relinking now. Anybody knows what I'm doing wrong? Does it have to do with my usage of vpath?

Relevant part of my makefile:

NAME        :=  minishell

# Directories
INCL_DIR    :=  includes
SRCS_DIR    :=  srcs
OBJDIR      :=  objs
vpath       %.c $(SRCS_DIR)
vpath       %.c $(SRCS_DIR)/executor

# Config
CC          :=  gcc
FLAGS       :=  -Wall -Wextra

# Srcs
SRCS        :=  main.c \
                get_cmd.c \
                exit_error.c \
                ft_strlen.c
OBJS        :=  $(SRCS:.c=.o)


all:        $(NAME)

$(NAME):    $(OBJS)
    $(CC) $(addprefix $(OBJDIR)/, $(OBJS)) $(FLAGS) -o $(NAME)

%.o: %.c
    @mkdir -p $(OBJDIR)
    $(CC) $(FLAGS) -c $< -o $(addprefix $(OBJDIR)/, $@) -I$(INCL_DIR)

Project folder structure (simplified):

Minishell/
    includes/
    srcs/
        executor/
        main.c
    Makefile

Thanks a lot!

0

There are 0 best solutions below