mirror of
https://github.com/DavidGailleton/42-ft_printf.git
synced 2026-11-01 11:42:03 +01:00
- Use the flag-aware implementation for both make and make bonus
(bonus/ moved to src/, _bonus suffix dropped, bonus rule = all)
- Do not treat zero-length output (%s with "", %.0d with 0) as an error
- Return -1 without printing when a % has no conversion ("abc%", "%5")
- Keep field width with '#', '+' and ' '; ignore '0' with '-'
- Fix '#' prefix on zero, '+'/' ' with zero padding, INT_MIN negation UB
- Add README.md required by the subject
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.1 KiB
Makefile
58 lines
1.1 KiB
Makefile
NAME= libftprintf.a
|
|
LIBFT= $(BUILD_DIR)/libft.a
|
|
|
|
SRC_DIR= src
|
|
INC_DIR= include
|
|
LIBFT_DIR= libft
|
|
BUILD_DIR= .build
|
|
|
|
SRC= $(SRC_DIR)/ft_printf.c \
|
|
$(SRC_DIR)/ft_putnbr_base.c \
|
|
$(SRC_DIR)/print_char.c \
|
|
$(SRC_DIR)/print_hex.c \
|
|
$(SRC_DIR)/print_number.c \
|
|
$(SRC_DIR)/print_pointer.c \
|
|
$(SRC_DIR)/print_str.c \
|
|
$(SRC_DIR)/print_unsigned.c \
|
|
$(SRC_DIR)/ft_create_arg.c \
|
|
$(SRC_DIR)/ft_main_arg.c \
|
|
$(SRC_DIR)/ft_parsing.c \
|
|
$(SRC_DIR)/utils_flag.c
|
|
|
|
OBJ= $(SRC:%.c=$(BUILD_DIR)/%.o)
|
|
DEP= $(SRC:%.c=$(BUILD_DIR)/%.d)
|
|
|
|
CC= cc
|
|
CFLAGS= -Wall -Wextra -Werror -I$(INC_DIR) -I$(LIBFT_DIR) -MMD -MP
|
|
AR= ar rcs
|
|
|
|
all: $(NAME)
|
|
|
|
bonus: all
|
|
|
|
$(NAME): $(OBJ) $(LIBFT)
|
|
cp $(LIBFT) $(NAME)
|
|
$(AR) $(NAME) $(OBJ)
|
|
|
|
$(BUILD_DIR)/%.o: %.c
|
|
mkdir -p $(dir $@)
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(LIBFT):
|
|
$(MAKE) -C $(LIBFT_DIR)
|
|
cp $(LIBFT_DIR)/libft.a $(LIBFT)
|
|
|
|
clean:
|
|
rm -f $(OBJ) $(DEP)
|
|
$(MAKE) -C $(LIBFT_DIR) clean
|
|
|
|
fclean: clean
|
|
rm -f $(NAME) $(LIBFT)
|
|
$(MAKE) -C $(LIBFT_DIR) fclean
|
|
|
|
re: fclean all
|
|
|
|
-include $(DEP)
|
|
|
|
.PHONY: all clean fclean re bonus
|