From 318228a66346049b04105f41364d9ea5beb302fd Mon Sep 17 00:00:00 2001
From: Rick <rick@gnous.eu>
Date: Sun, 13 Dec 2020 14:48:02 +0100
Subject: [PATCH] =?UTF-8?q?Ajout=20lib=20et=20modification=20jour4=20La=20?=
=?UTF-8?q?lib=20cr=C3=A9=C3=A9e=20pour=20le=20jour=204=20est=20maintenant?=
=?UTF-8?q?=20dans=20le=20dossier=20lib=20et=20le=20make.sh=20compile=20en?=
=?UTF-8?q?=20utilisant=20la=20lib=20afin=20de=20compiler=20les=20jours=20?=
=?UTF-8?q?suivant=20l=E2=80=99utilisant.=20Le=20jour=204=20est=20modifi?=
=?UTF-8?q?=C3=A9=20pour=20=C3=AAtre=20utilis=C3=A9=20dans=20le=20turbo=5F?=
=?UTF-8?q?main=20et=20son=20Makefile=20est=20supprim=C3=A9=20(=C3=A9tant?=
=?UTF-8?q?=20inutile=20maintenant).?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jour4/Makefile | 18 ------------------
jour4/main.c | 18 ------------------
{jour4 => lib}/utils.c | 0
{jour4 => lib}/utils.h | 0
make.sh | 6 ++++--
5 files changed, 4 insertions(+), 38 deletions(-)
delete mode 100644 jour4/Makefile
rename {jour4 => lib}/utils.c (100%)
rename {jour4 => lib}/utils.h (100%)
diff --git a/jour4/Makefile b/jour4/Makefile
deleted file mode 100644
index 2e76cf5..0000000
--- a/jour4/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-CC=gcc
-CFLAGS= -Wall -g
-
-all: clean main clean
-
-main: main.o utils.o
- $(CC) -o $@ $^
-
-main.o: main.c
- $(CC) $(CFLAGS) $^ -o $@ -c
-
-utils.o: utils.c
- $(CC) $(CFLAGS) $^ -o $@ -c
-
-.PHONY: all clean
-
-clean:
- rm -f *.o
diff --git a/jour4/main.c b/jour4/main.c
index 8348583..c5dbe41 100644
--- a/jour4/main.c
+++ b/jour4/main.c
@@ -4,24 +4,6 @@
#include "utils.h"
-#define FILENAME "input"
-
-void premPartie(FILE *ptr);
-void deuxPartie(FILE *ptr);
-
-int main()
-{
- FILE *ptr = fopen(FILENAME, "r");
- if (ptr == NULL)
- return 1;
-
- //premPartie(ptr);
- deuxPartie(ptr);
-
- fclose(ptr);
- return 0;
-}
-
void deuxPartie(FILE *ptr)
{
int find = 0, tmp;
diff --git a/jour4/utils.c b/lib/utils.c
similarity index 100%
rename from jour4/utils.c
rename to lib/utils.c
diff --git a/jour4/utils.h b/lib/utils.h
similarity index 100%
rename from jour4/utils.h
rename to lib/utils.h
diff --git a/make.sh b/make.sh
index cde494e..91cb504 100755
--- a/make.sh
+++ b/make.sh
@@ -11,10 +11,12 @@ do
done
rm -f *.o turbo_main
+echo "Compilation de la lib utils.c."
+gcc -Wall -g lib/utils.c -o utils.o -c
echo "Compilation de turbo_main.c."
gcc -Wall -g turbo_main.c -o turbo_main.o -c
echo "Compilation du jour $jour."
-gcc -Wall -g jour$jour/main.c -o tmp.o -c
-gcc -o turbo_main tmp.o turbo_main.o
+gcc -Wall -g jour$jour/main.c -o tmp.o -c -Ilib
+gcc -o turbo_main tmp.o turbo_main.o utils.o
rm -f *.o
cp jour$jour/input input