From 894b32fe2f6c0642cffc5f8407b85a28c1f03325 Mon Sep 17 00:00:00 2001 From: Aleksei Chubukov Date: Wed, 22 Nov 2023 00:40:57 +0400 Subject: [PATCH] say hello to this abom^H^H^H^H cute Makefile --- .gitignore | 2 ++ Makefile | 22 ++++++++++++++++++++++ c00_ex00.c => c00/ex00.c | 0 c00_ex01.c => c00/ex01.c | 0 c00_ex02.c => c00/ex02.c | 0 c00_ex03.c => c00/ex03.c | 0 c00_ex04.c => c00/ex04.c | 0 c00_ex05.c => c00/ex05.c | 0 c00_ex06.c => c00/ex06.c | 0 c00_ex07.c => c00/ex07.c | 7 +++++-- c00_ex08.c => c00/ex08.c | 0 11 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Makefile rename c00_ex00.c => c00/ex00.c (100%) rename c00_ex01.c => c00/ex01.c (100%) rename c00_ex02.c => c00/ex02.c (100%) rename c00_ex03.c => c00/ex03.c (100%) rename c00_ex04.c => c00/ex04.c (100%) rename c00_ex05.c => c00/ex05.c (100%) rename c00_ex06.c => c00/ex06.c (100%) rename c00_ex07.c => c00/ex07.c (78%) rename c00_ex08.c => c00/ex08.c (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89efb0f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +*.swp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1b1698f --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +#location of test mains +OFFSHORE_MAINS := . +# location of project directories +OFFSHORE_PROJECTS := .. + +empty:= +space:= $(empty) $(empty) +CFLAGS_MANDATORY := -Wall -Wextra -Werror +all: $(foreach e, 00 01 02 03 04 05 06 07 08, build/c00/ex$e) +build: + mkdir $@ +norme: + norminette -R CheckForbiddenSourceHeader ../c$(subst _,$(space),) +clean: + rm -rf build + +.SECONDEXPANSION: +build/c%: $(OFFSHORE_PROJECTS)/c$$(subst _,+,$$*)/*.c $$(OFFSHORE_MAINS)/c$$*.c + mkdir -p $(@D) + $(CC) -o $@ $(CFLAGS_MANDATORY) $(CFLAGS) $^ + +.PHONY: all norme clean diff --git a/c00_ex00.c b/c00/ex00.c similarity index 100% rename from c00_ex00.c rename to c00/ex00.c diff --git a/c00_ex01.c b/c00/ex01.c similarity index 100% rename from c00_ex01.c rename to c00/ex01.c diff --git a/c00_ex02.c b/c00/ex02.c similarity index 100% rename from c00_ex02.c rename to c00/ex02.c diff --git a/c00_ex03.c b/c00/ex03.c similarity index 100% rename from c00_ex03.c rename to c00/ex03.c diff --git a/c00_ex04.c b/c00/ex04.c similarity index 100% rename from c00_ex04.c rename to c00/ex04.c diff --git a/c00_ex05.c b/c00/ex05.c similarity index 100% rename from c00_ex05.c rename to c00/ex05.c diff --git a/c00_ex06.c b/c00/ex06.c similarity index 100% rename from c00_ex06.c rename to c00/ex06.c diff --git a/c00_ex07.c b/c00/ex07.c similarity index 78% rename from c00_ex07.c rename to c00/ex07.c index 2a68b0c..7930d38 100644 --- a/c00_ex07.c +++ b/c00/ex07.c @@ -1,8 +1,11 @@ void ft_putnbr(int); void ft_putchar(char); +#include +#include int main(void) { - ft_putnbr(0xEFFFFFFF); + printf("%d = \n", INT_MIN); + ft_putnbr(INT_MIN); ft_putchar('\n'); ft_putnbr(-7141); ft_putchar('\n'); @@ -20,6 +23,6 @@ int main(void) ft_putchar('\n'); ft_putnbr(0xBADF00D); ft_putchar('\n'); - ft_putnbr(0x7FFFFFFF); + ft_putnbr(INT_MAX); ft_putchar('\n'); } diff --git a/c00_ex08.c b/c00/ex08.c similarity index 100% rename from c00_ex08.c rename to c00/ex08.c