Browse Source

fix: Makefile portability

master
narnaud 3 years ago
parent
commit
8cd1f1b183
  1. 13
      Makefile

13
Makefile

@ -3,10 +3,15 @@ LIBFT = libft.a
SRCS = minishell.c lexer.c parser.c utils.c caller.c built-in.c env.c SRCS = minishell.c lexer.c parser.c utils.c caller.c built-in.c env.c
OBJS = ${SRCS:.c=.o} OBJS = ${SRCS:.c=.o}
#READLINE_INC = ~/.brew/opt/readline/include
#LIB = -L ~/.brew/lib -lreadline -L ~/.brew/lib -lhistory -L. -lft
LIB = -lreadline -lhistory -L. -lft UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
LIB = -lreadline -lhistory -L. -lft
endif
ifeq ($(UNAME_S), Darwin)
READLINE_INC = -I ~/.brew/opt/readline/include
LIB = -L ~/.brew/lib -lreadline -L ~/.brew/lib -lhistory -L. -lft
endif
$(NAME): $(LIBFT) $(OBJS) $(NAME): $(LIBFT) $(OBJS)
gcc ${OBJS} ${LIB} -o ${NAME} gcc ${OBJS} ${LIB} -o ${NAME}
@ -18,7 +23,7 @@ $(LIBFT):
all: $(NAME) all: $(NAME)
%.o: %.c %.o: %.c
gcc -Werror -Wextra -Wall -g -c $< # -I ${READLINE_INC} #for rl_replace_line gcc -Werror -Wextra -Wall -g -c $< ${READLINE_INC}
clean: clean:
rm -rf ${OBJS} rm -rf ${OBJS}

Loading…
Cancel
Save