Files
42test/libft/Makefile

105 lines
3.2 KiB
Makefile
Raw Normal View History

2021-10-22 10:26:25 +02:00
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: gbaconni <gbaconni@42lausanne.ch> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/10/22 09:10:00 by gbaconni #+# #+# #
2021-10-23 10:37:02 +02:00
# Updated: 2021/10/23 10:30:24 by gbaconni ### ########.fr #
2021-10-22 10:26:25 +02:00
# #
# **************************************************************************** #
#
# make munit.out
# make all
# make clean
# make fclean
# make re
# make
#
OUT = munit.out
LIBDIR = libft
LIB = ft
HDRDIR = munit
HDR = $(HDRDIR)/munit.h
SRCDIR = .
SRC = \
$(SRCDIR)/munit.c \
$(HDRDIR)/munit.c
CC = gcc
2021-10-23 10:37:02 +02:00
CFLAGS = -Wall -Wextra -Werror
ifeq ($(DEBUG), 1)
CFLAGS += -g -fsanitize=address -O1
endif
2021-10-22 10:26:25 +02:00
RM = rm
RMFLAGS = -f
all: compile test
2021-10-23 10:37:02 +02:00
debug:
@make re DEBUG=1
setup:
@echo "Set the location of your libft to:"
@ln -snvf $$(find ~ -mindepth 2 -maxdepth 4 -name libft.a -type f -exec dirname "{}" \; 2>/dev/null | head -n1) libft
@echo ""
@echo "If the above is not correct the correct location of your libft, use one of the following command to fix it:"
@find ~ -mindepth 2 -maxdepth 4 -name libft.h -type f -exec dirname "{}" \; 2>/dev/null | xargs -r -I{} echo ln -snvf {} libft
2021-10-22 16:07:10 +02:00
help:
@echo "a: nemequ/µnit"
@echo "b: Tripouille/libftTester"
@echo "c: jtoty/Libftest"
@echo "d: alelievr/libft-unit-test"
@echo "test: a b c d"
@echo "update: git pull"
2021-10-22 11:33:15 +02:00
a: update compile
2021-10-22 10:26:25 +02:00
@./$(OUT) || true
b: compile
2021-10-22 15:02:54 +02:00
@grep -q 'update message' libftTester/Makefile && sed -i'.orig' -e 's/update \(message\)/\1/g' libftTester/Makefile || true
@grep -q '/libft$$' libftTester/Makefile || sed -i'.orig' -e 's/^\(PARENT_DIR.*\)/\1\/libft/' libftTester/Makefile || true
2021-10-22 10:26:25 +02:00
@make -C libftTester m || true
@make -C libftTester b || true
c: compile
2021-10-22 11:28:12 +02:00
@test -f Libftest/my_config.sh || (cd Libftest && ./grademe.sh >/dev/null 2>&1) || true
2021-10-22 21:28:52 +00:00
@grep -q '^PATH_LIBFT=\.\./libft' Libftest/my_config.sh || sed -i'.orig' -e 's/^\(PATH_LIBFT\)=.*/\1=..\/libft/' Libftest/my_config.sh || true
@grep -q "'ft_memccpy'" Libftest/srcs/variables/functions/part_1.sh && sed -i'.orig' -e "/'ft_memccpy'/d" Libftest/srcs/variables/functions/part_1.sh || true
@rm -fr Libftest/tests/Part1_functions/ft_memccpy || true
2021-10-22 10:26:25 +02:00
@cd Libftest && ./grademe.sh || true
d: compile
@make -C libft-unit-test all || true
@cd libft-unit-test && ./run_test || true
test: a b c d
@echo "done."
2021-10-22 11:24:55 +02:00
update:
@git pull
2021-10-22 10:26:25 +02:00
compile:
@make -C $(LIBDIR) all
@$(CC) $(CFLAGS) $(SRC) -I${LIBDIR} -I$(HDRDIR) -L${LIBDIR} -l${LIB} -o $(OUT)
clean:
@make -C $(LIBDIR) clean
@$(RM) $(RMFLAGS) $(OUT)
fclean: clean
2021-10-22 11:30:53 +02:00
@make -C libftTester clean || true
@make -C libft-unit-test clean || true
2021-10-22 10:26:25 +02:00
@make -C $(LIBDIR) fclean
@$(RM) $(RMFLAGS) $(OUT)
re: fclean all