refactor: fix the makefile problems
This commit is contained in:
36
tests/Makefile
Normal file
36
tests/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
NAME = tests
|
||||
CC = cc
|
||||
CCFLAGS = -Wall -Wextra -Werror -MMD -MP
|
||||
|
||||
SRC = main.c
|
||||
SRC += libunit/00_launcher.c libunit/01_ok.c libunit/02_ko.c libunit/03_sigsegv.c libunit/04_sigbus.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
LIBS = -L.. -lunit -L../libft -lft
|
||||
INC = -I. -I../framework -I../libft
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
test: $(NAME)
|
||||
./$(NAME)
|
||||
|
||||
%.o: %.c Makefile
|
||||
$(CC) $(CCFLAGS) $(INC) -c $< -o $@
|
||||
|
||||
$(NAME): $(OBJ) | libunit
|
||||
$(CC) $(CCFLAGS) $(INC) $(OBJ) $(LIBS) -o $(NAME)
|
||||
|
||||
libunit:
|
||||
$(MAKE) -C ..
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJ) $(SRC:.c=.d)
|
||||
|
||||
fclean: clean
|
||||
$(RM) $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
-include $(SRC:.c=.d)
|
||||
|
||||
.PHONY: all clean fclean re libunit
|
||||
5
tests/main.c
Normal file
5
tests/main.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "tests.h"
|
||||
|
||||
int main(void) {
|
||||
libunit_launcher();
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/24 15:32:30 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 16:16:20 by elagouch ### ########.fr */
|
||||
/* Updated: 2026/01/24 18:41:02 by elagouch ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# include "libunit.h"
|
||||
|
||||
// LAUNCHERS
|
||||
int strlen_launcher(void);
|
||||
int libunit_launcher(void);
|
||||
|
||||
// libunit
|
||||
int test_ok(void);
|
||||
@@ -24,8 +24,4 @@ int test_ko(void);
|
||||
int test_sigsegv(void);
|
||||
int test_sigbus(void);
|
||||
|
||||
// strlen
|
||||
int test_basic(void);
|
||||
int test_null(void);
|
||||
|
||||
#endif // !TESTS_H
|
||||
|
||||
Reference in New Issue
Block a user