diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -12,6 +12,7 @@ SRCS_DIR = src/ OBJS_DIR = obj/ LFT_DIR = libft/ MLX_DIR = minilibx/ +MLX_GNU_DIR = minilibx_linux/ #==================================================================================================# #---------------------------------------------- Files ---------------------------------------------# #==================================================================================================# @@ -123,7 +124,11 @@ endif DEBUG = -glldb FSANITIZE = -fsanitize=address #--------------------------------------------------------------------------------------------------# -CC = clang +ifeq (${OS}, Darwin) + CC = clang +else + CC = gcc +endif #--------------------------------------------------------------------------------------------------# CFLAGS = -std=c89 CFLAGS += -Wall @@ -153,12 +158,14 @@ ${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR} ifeq (${OS}, Darwin) ${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} -o $@ $< else - ${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${INCS_DIR} -o $@ $< + ${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_GNU_DIR} -I${INCS_DIR} -o $@ $< endif #--------------------------------------------------------------------------------------------------# ${NAME}: ${OBJS} ${LFT_SRCS} ${LFT_DIR}${INCS_DIR}libft.h ifeq (${OS}, Darwin) @$(MAKE) --no-print-directory -C ${MLX_DIR} all +else + @${MAKE} --no-print-directory -C ${MLX_GNU_DIR} all endif ifdef ASAN @$(MAKE) --no-print-directory -C ${LFT_DIR} all ASAN=1 @@ -169,7 +176,8 @@ ifeq (${OS}, Darwin) ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm -lpthread \ -framework OpenGL -framework AppKit else - ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd -lpthread + ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_GNU_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd \ +-lpthread endif #--------------------------------------------------------------------------------------------------# all: ${NAME} @@ -177,12 +185,17 @@ all: ${NAME} clean: ifeq (${OS}, Darwin) @$(MAKE) --no-print-directory -C ${MLX_DIR} clean +else + @${MAKE} --no-print-directory -C ${MLX_GNU_DIR} clean endif @$(MAKE) --no-print-directory -C ${LFT_DIR} clean ${RM} ${OBJS_DIR} #--------------------------------------------------------------------------------------------------# fclean: clean @$(MAKE) --no-print-directory -C ${LFT_DIR} fclean +ifeq (${OS}, Linux) + ${RM} ${MLX_GNU_DIR}libmlx_x86_64.a +endif ${RM} ${NAME} ${RM} ${NAME}.dSYM #--------------------------------------------------------------------------------------------------# |