Files
42test/libft/Makefile

130 lines
4.1 KiB
Makefile
Raw Normal View History

2021-10-22 10:26:25 +02:00
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
2021-10-23 16:41:04 +02:00
# By: <gbaconni@student.42lausanne.ch> +#+ +:+ +#+ #
2021-10-22 10:26:25 +02:00
# +#+#+#+#+#+ +#+ #
2021-10-23 16:41:04 +02:00
# Created: 2021/10/22 09:10:00 by gbaconni #+# #+# #
2021-10-24 07:01:00 +00:00
# Updated: 2021/10/24 06:59:36 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
2021-10-23 22:29:53 +02:00
LIBRARY = libft
LIBS = -lft
2021-10-22 10:26:25 +02:00
2021-10-23 22:29:53 +02:00
INCLUDE = munit
HDR = munit.h
2021-10-22 10:26:25 +02:00
SRC = \
2021-10-23 22:29:53 +02:00
munit.c \
$(INCLUDE)/munit.c
2021-10-22 10:26:25 +02:00
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
2021-10-23 16:10:09 +02:00
@make test DEBUG=1
2021-10-23 10:37:02 +02:00
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 ""
2021-10-23 11:13:00 +02:00
@echo "If the above is not the correct location of your libft, use one of the following command to fix it:"
2021-10-23 10:37:02 +02:00
@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"
2021-10-23 22:29:53 +02:00
@echo "d: alelievr/libft-unit-test (tests)"
@echo "e: alelievr/libft-unit-test (bench)"
@echo "test: a b c d e"
2021-10-22 16:07:10 +02:00
@echo "update: git pull"
2021-10-23 22:29:53 +02:00
_munit:
2021-10-22 10:26:25 +02:00
@./$(OUT) || true
2021-10-23 22:29:53 +02:00
a: update compile _munit
2021-10-23 11:13:00 +02:00
@echo ""
@echo "Summary:"
@./$(OUT) 2>&1 | grep -i -e 'error' -e 'tests successful'|| true
2021-10-22 10:26:25 +02:00
2021-10-23 22:29:53 +02:00
_libftTester:
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-23 22:29:53 +02:00
b: compile _libftTester
2021-10-22 10:26:25 +02:00
@make -C libftTester m || true
@make -C libftTester b || true
2021-10-23 22:29:53 +02:00
_Libftest:
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
2021-10-23 22:29:53 +02:00
c: compile _Libftest
@cd Libftest && ./grademe.sh -u || true
2021-10-24 01:05:08 +02:00
@echo ""
@echo "For more details do:"
2021-10-24 01:06:19 +02:00
@echo "less Libftest/deepthought"
@echo ""
2021-10-23 22:29:53 +02:00
_libft-unit-test:
@grep -q 'ft_memccpy' libft-unit-test/src/init.c && sed -i'.orig' -e '/ft_memccpy/d' libft-unit-test/src/init.c || true
@grep -q 'ft_memccpy' libft-unit-test/hardcore-mode/hardcore-main.c && sed -i'.orig' -e '/ft_memccpy/d' libft-unit-test/hardcore-mode/hardcore-main.c || true
@grep -q 'test-memccpy' libft-unit-test/Makefile && sed -i'.orig' -e '/test-memccpy/d' libft-unit-test/Makefile || true
@rm -f libft-unit-test/hardcore-mode/test-memccpy.c || true
d: compile _libft-unit-test
@make -C libft-unit-test f || true
2021-10-24 01:05:08 +02:00
@echo ""
@echo "For more details do:"
2021-10-24 01:06:19 +02:00
@echo "less libft-unit-test/result.log"
@echo ""
2021-10-22 10:26:25 +02:00
2021-10-23 22:29:53 +02:00
e: compile _libft-unit-test
@make -C libft-unit-test b || true
2021-10-22 10:26:25 +02:00
test: a b c d
2021-10-22 11:24:55 +02:00
update:
@git pull
2021-10-22 10:26:25 +02:00
compile:
2021-10-23 22:29:53 +02:00
@make -C $(LIBRARY) all
2021-10-24 07:01:00 +00:00
$(CC) $(CFLAGS) -I$(INCLUDE) $(SRC) -I${LIBRARY} -L${LIBRARY} ${LIBS} -DMUNIT_DISABLE_TIMING=1 -o $(OUT)
2021-10-22 10:26:25 +02:00
clean:
2021-10-24 08:52:11 +02:00
@make -C $(LIBRARY) clean || true
2021-10-22 11:30:53 +02:00
@make -C libftTester clean || true
@make -C libft-unit-test clean || true
2021-10-24 08:52:11 +02:00
fclean: clean
@make -C $(LIBRARY) fclean || true
@make -C libftTester fclean || true
@make -C libft-unit-test fclean || true
2021-10-22 10:26:25 +02:00
@$(RM) $(RMFLAGS) $(OUT)
re: fclean all