You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.8 KiB
76 lines
1.8 KiB
# **************************************************************************** #
|
|
# #
|
|
# ::: :::::::: #
|
|
# Makefile :+: :+: :+: #
|
|
# +:+ +:+ +:+ #
|
|
# By: hroussea <hroussea@student.42lyon.fr> +#+ +:+ +#+ #
|
|
# +#+#+#+#+#+ +#+ #
|
|
# Created: 2021/06/06 18:04:16 by hroussea #+# #+# #
|
|
# Updated: 2021/06/13 15:24:25 by hroussea ### ########lyon.fr #
|
|
# #
|
|
# **************************************************************************** #
|
|
|
|
# toolchain stuff
|
|
CC = gcc
|
|
|
|
# flags
|
|
CFLAGS = -Wall -Wextra -Werror
|
|
DEBUG_FLAGS =
|
|
OPTI_FLAGS = -O3 -march=native
|
|
|
|
# artifacts
|
|
NAME = pipex
|
|
|
|
# source files
|
|
SRCS := main.c pipexlife.c pipexargs.c fileutils.c
|
|
|
|
# object files
|
|
OBJS := ${addprefix obj/,${SRCS:.c=.o}}
|
|
|
|
# include folders
|
|
INCLUDE = ${addprefix -I,include} ${shell ${MAKE} -C libft getincpath}
|
|
|
|
HDS = include/pipex/fileutils.h include/pipex/pipex.h
|
|
|
|
# lib folders
|
|
LIBD = ${addprefix -L,libft}
|
|
|
|
# libraries
|
|
LINK = ${addprefix -l,ft}
|
|
|
|
# thanks GNU Make
|
|
SRCS := ${addprefix src/,${SRCS}}
|
|
|
|
# rules
|
|
all: ${NAME}
|
|
|
|
${NAME}: ${OBJS} libft/libft.a
|
|
${CC} ${OBJS} ${LIBD} ${LINK} -o $@
|
|
|
|
libft/libft.a:
|
|
${MAKE} -C libft
|
|
|
|
${OBJS}: | obj
|
|
|
|
obj/%.o: src/%.c ${HDS}
|
|
${CC} ${CFLAGS} ${DEBUG_FLAGS} ${OPTI_FLAGS} ${INCLUDE} -c $< -o $@
|
|
|
|
obj:
|
|
mkdir -p $@
|
|
|
|
clean:
|
|
rm -rf obj
|
|
|
|
fclean: clean
|
|
${RM} ${NAME}
|
|
${MAKE} -C libft fclean
|
|
|
|
re:
|
|
${MAKE} fclean
|
|
${MAKE} all
|
|
|
|
norme:
|
|
norminette include src libft
|
|
|
|
.PHONY: all clean fclean re norme
|