Correcting all stuff for libft
This commit is contained in:
parent
3ac78b4c7f
commit
d16b39091a
6 changed files with 21 additions and 43 deletions
|
|
@ -6,7 +6,7 @@
|
|||
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
|
||||
# Updated: 2024/05/28 15:50:04 by rparodi ### ########.fr #
|
||||
# Updated: 2024/05/29 14:20:08 by rparodi ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
# Variables
|
||||
|
||||
# Name
|
||||
NAME = test
|
||||
NAME = libmmath.a
|
||||
LIBDIRNAME = libft
|
||||
SRCDIRNAME = sources
|
||||
|
||||
|
|
@ -26,17 +26,15 @@ RM = rm -rf
|
|||
CFLAGS = -Werror -Wextra -Wall -Wno-unused-command-line-argument -g3 -MMD
|
||||
|
||||
# Sources
|
||||
LIB =
|
||||
LIB = ./libft/ft_split.c
|
||||
|
||||
SRC = ./main.c \
|
||||
./sources/operation/ft_pow.c \
|
||||
SRC = ./sources/operation/ft_pow.c \
|
||||
./sources/operation/ft_add.c \
|
||||
./sources/utils/ft_init_numbers.c \
|
||||
./sources/utils/ft_nblen.c \
|
||||
./sources/comparison/ft_is_less.c \
|
||||
./sources/comparison/ft_equal.c \
|
||||
./sources/comparison/ft_is_greater.c \
|
||||
./sources/ft_split.c
|
||||
./sources/comparison/ft_is_greater.c
|
||||
|
||||
# Objects
|
||||
OBJDIRNAME = ./objects
|
||||
|
|
@ -85,8 +83,7 @@ $(NAME): $(OBJ) $(LIB_OBJ)
|
|||
@mkdir -p $(OBJDIRNAME)/$(LIBDIRNAME)
|
||||
@mkdir -p $(OBJDIRNAME)/$(SRCDIRNAME)
|
||||
@printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n'
|
||||
@cc $(CFLAGS) -o $(NAME) -c $(OBJ) $(LIB_OBJ)
|
||||
@ar rc $(NAME) $(OBJ) $(OBJBonus)
|
||||
@ar rc $(NAME) $(OBJ) $(OBJBonus) 1>/dev/null
|
||||
@ranlib $(NAME)
|
||||
# Creating the objects
|
||||
$(OBJDIRNAME)/%.o: %.c
|
||||
|
|
@ -128,5 +125,5 @@ footer:
|
|||
# Phony
|
||||
.PHONY: all bonus clean fclean re
|
||||
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
# -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
-include ${OBJ:.o=.d}
|
||||
|
|
|
|||
37
math/main.c
37
math/main.c
|
|
@ -1,36 +1,17 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/27 14:41:26 by rparodi #+# #+# */
|
||||
/* Updated: 2024/05/28 15:48:40 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "./includes/ft_math.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
t_number nb;
|
||||
t_number nb;
|
||||
|
||||
if (argc != 2)
|
||||
if (argc == 2)
|
||||
{
|
||||
printf("Usage: %s <string>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
else if (argc == 2)
|
||||
{
|
||||
if (ft_init_numbers(argv[1], &nb) == ERROR)
|
||||
{
|
||||
printf("Error\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
printf("Number = %s \n(int: %s, %zu) (float: %s, %zu)\n", nb.number, nb.int_part, nb.int_size, nb.float_part, nb.float_size);
|
||||
ft_init_numbers(argv[1], &nb);
|
||||
printf("Number: %s\n", nb.number);
|
||||
printf("Integer: %s\n", nb.int_part);
|
||||
printf("Float: %s\n", nb.float_part);
|
||||
printf("Integer size: %zu\n", nb.int_size);
|
||||
printf("Float size: %zu\n", nb.float_size);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue