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