aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-15 16:19:44 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-15 16:19:44 +0200
commit46687fa2cef63e99a0ded077d88c3b19b20cc1ca (patch)
tree020590d4319b4bd0217cdf97750f3a8338d3069e /Makefile
parentAdded line to gitignore (diff)
download42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.gz
42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.bz2
42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.xz
42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.tar.zst
42-cub3d-46687fa2cef63e99a0ded077d88c3b19b20cc1ca.zip
Now BSD compliant
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 18 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 6a76604..c024768 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ OBJS_DIR = obj/
LFT_DIR = libft/
MLX_DIR = minilibx/
MLX_GNU_DIR = minilibx-linux/
+MLX_BSD_DIR = minilibx-bsd/
#==================================================================================================#
#---------------------------------------------- Files ---------------------------------------------#
#==================================================================================================#
@@ -203,15 +204,19 @@ ${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}
@${MKDIR} ${OBJS_DIR}
ifeq (${OS}, Darwin)
${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_DIR} -I${INCS_DIR} -o $@ $<
-else
+else ifeq (${OS}, Linux)
${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_GNU_DIR} -I${INCS_DIR} -o $@ $<
+else
+ ${CC} -c ${CFLAGS} ${CDEFS} -I${LFT_DIR}${INCS_DIR} -I${MLX_BSD_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
+else ifeq (${OS}, Linux)
@${MAKE} --no-print-directory -C ${MLX_GNU_DIR} all
+else
+ @${MAKE} --no-print-directory -C ${MLX_BSD_DIR} all
endif
ifdef ASAN
@$(MAKE) --no-print-directory -C ${LFT_DIR} all ASAN=1
@@ -221,9 +226,12 @@ endif
ifeq (${OS}, Darwin)
${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_DIR} -lft -lmlx -lm -lpthread \
-framework OpenGL -framework AppKit
+else ifeq (${OS}, Linux)
+ ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_GNU_DIR} \
+-lft -lX11 -lXext -lmlx -lm -lbsd -lpthread
else
- ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_GNU_DIR} -lft -lX11 -lXext -lmlx -lm -lbsd \
--lpthread
+ ${CC} ${CFLAGS} -o $@ ${OBJS} -L${LFT_DIR} -L${MLX_BSD_DIR} -L/usr/local/lib \
+-lft -lX11 -lXext -lmlx -lm -lpthread
endif
#--------------------------------------------------------------------------------------------------#
all: ${NAME}
@@ -231,8 +239,10 @@ all: ${NAME}
clean:
ifeq (${OS}, Darwin)
@$(MAKE) --no-print-directory -C ${MLX_DIR} clean
-else
+else ifeq (${OS}, Linux)
@${MAKE} --no-print-directory -C ${MLX_GNU_DIR} clean
+else
+ @${MAKE} --no-print-directory -C ${MLX_BSD_DIR} clean
endif
@$(MAKE) --no-print-directory -C ${LFT_DIR} clean
${RM} ${OBJS_DIR}
@@ -242,6 +252,9 @@ fclean: clean
ifeq (${OS}, Linux)
${RM} ${MLX_GNU_DIR}libmlx_x86_64.a
endif
+ifeq (${OS}, FreeBSD)
+ ${RM} ${MLX_BSD_DIR}libmlx_FreeBSD.a
+endif
${RM} ${NAME}
${RM} ${NAME}.dSYM
#--------------------------------------------------------------------------------------------------#