Files
ft_printf/Makefile

144 lines
4.0 KiB
Makefile
Raw Normal View History

2022-04-13 08:01:46 +02:00
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/01/18 15:11:16 by gbaconni #+# #+# #
# Updated: 2022/04/18 09:07:48 by gbaconni ### lausanne.ch #
2022-04-13 08:01:46 +02:00
# #
# **************************************************************************** #
#
# make ft_printf
# make all
# make clean
# make fclean
# make re
# make
#
2022-04-17 11:31:29 +02:00
GIT_REPO = git@vogsphere.42lausanne.ch:vogsphere/intra-uuid-fd8d00fc-8c22-400e-a8d9-dcc364688380-4092952-gbaconni
2022-04-17 11:53:16 +02:00
PDF_FR = https://cdn.intra.42.fr/pdf/pdf/50142/fr.subject.pdf
PDF_EN = https://cdn.intra.42.fr/pdf/pdf/50141/en.subject.pdf
2022-04-17 11:31:29 +02:00
2022-04-13 08:01:46 +02:00
NAME = ft_printf
LIBFTPRINTF = libftprintf
LFLAGS = -L. -L$(LIBFTPRINTF) -lftprintf
SRC = main.c
INCLUDE = -I. -I$(LIBFTPRINTF)
HDR = $(LIBFTPRINTF)/libftprintf.h
CC = gcc
CFLAGS = -Wall -Wextra -Werror
ifeq ($(FAST), 1)
CFLAGS += -pipe -O3 -ffast-math -fomit-frame-pointer -funroll-loops
#CFLAGS += -pipe -Ofast -ffast-math -funroll-loops -fomit-frame-pointer
2022-04-13 08:01:46 +02:00
endif
ifeq ($(DEBUG), 1)
CFLAGS += -g -O0 -fsanitize=address -fsanitize=undefined -fsanitize=signed-integer-overflow
endif
ifeq ($(LEAK), 1)
CFLAGS += -g -O0
2022-04-13 08:01:46 +02:00
endif
VALGRIND = valgrind
VALGRINDFLAGS = --quiet --leak-check=full --show-leak-kinds=all
ifeq ($(LEAK), 1)
PREFIX += $(VALGRIND) $(VALGRINDFLAGS)
endif
2022-04-13 08:01:46 +02:00
RM = rm
RMFLAGS = -f
2022-04-13 08:01:46 +02:00
NORMINETTE = norminette
NORMINETTEFLAGS = -o
MAKE = make
all: $(NAME)
$(NAME):
@$(MAKE) -C $(LIBFTPRINTF) all >/dev/null 2>&1
@$(CC) $(CFLAGS) $(INCLUDE) $(SRC) $(LFLAGS) -o $@
clean:
@$(RM) $(RMFLAGS) $(NAME)
fclean: clean
@$(MAKE) -C $(LIBFTPRINTF) fclean
re: fclean all
@$(MAKE) -C $(LIBFTPRINTF) re
2022-04-13 08:01:46 +02:00
check:
@$(MAKE) -C $(LIBFTPRINTF) check
leak:
@$(MAKE) -C $(LIBFTPRINTF) re LEAK=1
2022-04-13 08:01:46 +02:00
debug:
@$(MAKE) -C $(LIBFTPRINTF) re DEBUG=1
fast:
@$(MAKE) -C $(LIBFTPRINTF) re FAST=1
test: clean $(NAME)
@$(PREFIX) ./$(NAME) "%c" C || true
@$(PREFIX) ./$(NAME) "%s" "42 Lausanne" || true
@$(PREFIX) ./$(NAME) "%d" 42 || true
2022-04-17 09:59:41 +02:00
@$(PREFIX) ./$(NAME) "%i" 2147483647 || true
@$(PREFIX) ./$(NAME) "%i" -2147483646 || true
@$(PREFIX) ./$(NAME) "%u" 4294967295 || true
@$(PREFIX) ./$(NAME) "%x" 42 || true
@$(PREFIX) ./$(NAME) "%X" 42 || true
2022-04-15 00:26:47 +02:00
@$(PREFIX) ./$(NAME) "%%" "" || true
@$(PREFIX) ./$(NAME) "%p" "" || true
@$(PREFIX) ./$(NAME) "%p" "\n" || true
@$(PREFIX) ./$(NAME) "Forty Two" "" || true
@$(PREFIX) ./$(NAME) "\t\r\n" "" || true
test2: leak
@$(MAKE) test LEAK=1
2022-04-13 08:01:46 +02:00
test3: debug
2022-04-13 08:01:46 +02:00
@$(MAKE) test DEBUG=1
test4: fast
2022-04-13 08:01:46 +02:00
@$(MAKE) test FAST=1
2022-04-17 11:53:16 +02:00
doc:
@curl -s -L -z fr.subject.pdf -o fr.subject.pdf $(PDF_FR)
@curl -s -L -z en.subject.pdf -o en.subject.pdf $(PDF_EN)
update: config online fetch
2022-04-13 08:53:46 +02:00
sync: config online fetch
@git status | grep -q 'nothing to commit' || (git diff; read -p "Comment: " comment; git add -A; git commit -am "$${comment-$$(date '+%F %T')}"; git push)
2022-04-13 08:53:46 +02:00
online:
2022-04-13 23:03:55 +02:00
@dig +short vogsphere.baco.net A | grep -qF '213.5.156.25' || echo 'vogsphere.baco.net unresolvable'
@nc -vzw3 vogsphere.baco.net 443 2>&1 | grep -qF 'succeeded' || echo 'vogsphere.baco.net unreachable'
2022-04-13 08:53:46 +02:00
fetch:
@git fetch
2022-04-13 08:53:46 +02:00
config:
2022-04-13 08:39:49 +02:00
@git config user.name "gbaconni"
@git config user.email "gbaconni@student.42lausanne.ch"
@git config pull.rebase true
@git config branch.autosetuprebase always
42:
2022-04-17 11:31:29 +02:00
@git clone $(GIT_REPO) 42 || true
21: 42
@mv 42/.git .42.git
@rsync --verbose --archive --delete --include '*.c' --include '*.h' --include 'Makefile' --include '*/' --exclude '*' libftprintf/ 42/
@mv .42.git 42/.git
@make -C 42 check fclean clean re all sync
2022-04-13 08:39:49 +02:00