diff --git a/.gitignore b/.gitignore
index 7c6881b5b1994ad8cbd3a701b09a32b5b4158f7a..dc27bba81270ec94340cf9409c6362a8827b5448 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,8 @@
 *.o
 *.s
 *.a
+*.d
+*.Td
 *.lib
 *.so
 *.dylib
@@ -12,7 +14,6 @@
 .DS_STORE
 *.exe
 a.out
-html
-latex
+doc/doxygen/
 sokoban
 sokoban_test
diff --git a/Doxyfile b/doc/Doxyfile
similarity index 99%
rename from Doxyfile
rename to doc/Doxyfile
index 5f1fcb113f1d72e9a206d1e7644ccb3187d44d4f..574f38822de902039f2447b9133dcd94420054bc 100644
--- a/Doxyfile
+++ b/doc/Doxyfile
@@ -38,13 +38,13 @@ PROJECT_NAME           = "Sokoban"
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         =
+PROJECT_NUMBER         = 1.0.0
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
 # quick idea about the purpose of the project. Keep the description short.
 
-PROJECT_BRIEF          =
+PROJECT_BRIEF          = "Le fameux jeu Sokoban, poussez les boîtes !"
 
 # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
 # in the documentation. The maximum height of the logo should not exceed 55
@@ -58,7 +58,7 @@ PROJECT_LOGO           =
 # entered, it will be relative to the location where doxygen was started. If
 # left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       =
+OUTPUT_DIRECTORY       = doc/doxygen/
 
 # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
 # directories (in 2 levels) under the output directory of each output format and
@@ -158,7 +158,7 @@ INLINE_INHERITED_MEMB  = NO
 # shortest path that makes the file name unique will be used
 # The default value is: YES.
 
-FULL_PATH_NAMES        = YES
+FULL_PATH_NAMES        = NO
 
 # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
 # Stripping is only done if one of the specified strings matches the left-hand
@@ -491,7 +491,7 @@ EXTRACT_PACKAGE        = NO
 # included in the documentation.
 # The default value is: NO.
 
-EXTRACT_STATIC         = NO
+EXTRACT_STATIC         = YES
 
 # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
 # locally in source files will be included in the documentation. If set to NO,
@@ -829,7 +829,7 @@ WARN_LOGFILE           =
 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
 # Note: If this tag is empty the current directory is searched.
 
-INPUT                  =
+INPUT                  = src/ include/ README.md
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -970,7 +970,7 @@ EXAMPLE_RECURSIVE      = NO
 # that contain images that are to be included in the documentation (see the
 # \image command).
 
-IMAGE_PATH             =
+IMAGE_PATH             = images/
 
 # The INPUT_FILTER tag can be used to specify a program that doxygen should
 # invoke to filter for each input file. Doxygen will invoke the filter program
@@ -1026,7 +1026,7 @@ FILTER_SOURCE_PATTERNS =
 # (index.html). This can be useful if you have a project on for instance GitHub
 # and want to reuse the introduction page also for the doxygen output.
 
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE = README.md
 
 #---------------------------------------------------------------------------
 # Configuration options related to source browsing
@@ -1039,7 +1039,7 @@ USE_MDFILE_AS_MAINPAGE =
 # also VERBATIM_HEADERS is set to NO.
 # The default value is: NO.
 
-SOURCE_BROWSER         = NO
+SOURCE_BROWSER         = YES
 
 # Setting the INLINE_SOURCES tag to YES will include the body of functions,
 # classes and enums directly into the documentation.
diff --git a/grid.h b/include/grid.h
similarity index 100%
rename from grid.h
rename to include/grid.h
diff --git a/player.h b/include/player.h
similarity index 100%
rename from player.h
rename to include/player.h
diff --git a/level1.txt b/levels/level1.txt
similarity index 100%
rename from level1.txt
rename to levels/level1.txt
diff --git a/makefile b/makefile
index 0668057a8a1bbdd898ce4087e82ab6cf3fc1cb82..67cc8256115f2ee54e5a7b6a1b8be3354e3fc163 100644
--- a/makefile
+++ b/makefile
@@ -1,17 +1,29 @@
 CC = gcc
-CFLAGS = -Wall -Wextra -g		# L'option de debug -g à enlever
+CPPFLAGS = -I include
+# L'option de debug -g à enlever
+CFLAGS = -Wall -Wextra -g
 LDFLAGS =
 LDLIBS = -lncurses
-ALL_SOURCES = $(wildcard *.c)
-TEST_SOURCES = $(filter-out main.c, $(ALL_SOURCES))
-SOURCES = $(filter-out test.c, $(ALL_SOURCES))
-HEADERS = $(wildcard *.h)
-ALL_OBJECTS = $(ALL_SOURCES:.c=.o)
-TEST_OBJECTS = $(TEST_SOURCES:.c=.o)
-OBJECTS = $(SOURCES:.c=.o)
-LEVELS = $(wildcard level*.txt)
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DPATH)$*.Td
+POSTCOMPILE = mv -f $(DPATH)$*.Td $(DPATH)$*.d && touch $@
+SPATH = src/
+HPATH = include/
+OPATH = obj/
+DPATH = dep/
+LEVELPATH = levels/
+ALL_SOURCES = $(wildcard $(SPATH)*.c)
+TEST_SOURCES = $(filter-out $(SPATH)main.c, $(ALL_SOURCES))
+SOURCES = $(filter-out $(SPATH)test.c, $(ALL_SOURCES))
+HEADERS = $(wildcard $(HPATH)*.h)
+ALL_OBJECTS = $(addprefix $(OPATH),$(patsubst %.c,%.o,$(notdir $(ALL_SOURCES))))
+TEST_OBJECTS  = $(addprefix $(OPATH),$(patsubst %.c,%.o,$(notdir $(TEST_SOURCES))))
+OBJECTS  = $(addprefix $(OPATH),$(patsubst %.c,%.o,$(notdir $(SOURCES))))
+ALL_DEPENDS = $(addprefix $(DPATH),$(patsubst %.c,%.d,$(notdir $(ALL_SOURCES))))
+LEVELS = $(wildcard $(LEVELPATH)level*.txt)
+DOCGEN = doxygen
+DOXYFILE = doc/Doxyfile
 ARCHIVE_NAME = ERKEN_Efe.tar.gz
-ARCHIVE_SOURCES = $(SOURCES) $(HEADERS) makefile $(LEVELS) README.md Doxyfile
+ARCHIVE_SOURCES = $(SOURCES) $(HEADERS) makefile $(LEVELS) README.md $(DOXYFILE)
 ARCHIVER = tar
 ARCHIVE_FLAGS = -cvzf
 TEST_EXEC = sokoban_test
@@ -29,16 +41,29 @@ $(EXEC) : $(OBJECTS)
 $(TEST_EXEC) : $(TEST_OBJECTS)
 	$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
 
-%.o : %.c %.h
-	$(CC) $(CFLAGS) -c $<
+$(OPATH)%.o : $(SPATH)%.c $(DPATH)%.d | $(OPATH) $(DPATH)
+	$(CC) $(DEPFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+	@$(POSTCOMPILE)
+
+$(OPATH) :
+	mkdir -p $@
+
+$(DPATH) :
+	mkdir -p $@
+
+$(ALL_DEPENDS) :
+
+# include $(wildcard $(ALL_DEPENDS))
+-include $(ALL_DEPENDS)
 
 clean :
-	rm -f $(EXEC) $(TEST_EXEC) $(ALL_OBJECTS)
+	rm -f $(EXEC) $(TEST_EXEC) $(ALL_OBJECTS) $(ALL_DEPENDS)
 
 doc :
-	doxygen Doxyfile
+	$(DOCGEN) $(DOXYFILE)
 
 archive : $(ARCHIVE_NAME)
 
 $(ARCHIVE_NAME) : $(ARCHIVE_SOURCES)
 	$(ARCHIVER) $(ARCHIVE_FLAGS) $@ $^
+
diff --git a/grid.c b/src/grid.c
similarity index 100%
rename from grid.c
rename to src/grid.c
diff --git a/main.c b/src/main.c
similarity index 100%
rename from main.c
rename to src/main.c
diff --git a/player.c b/src/player.c
similarity index 100%
rename from player.c
rename to src/player.c
diff --git a/test.c b/src/test.c
similarity index 92%
rename from test.c
rename to src/test.c
index 7db07354d87487c05da585f34c18534f8ad31f19..9e91f06a97f353975edfb1a9f0dc2dc184302ff2 100644
--- a/test.c
+++ b/src/test.c
@@ -26,7 +26,7 @@ int main01()
 
 int main02() {
     // Test de la fonction init_level() dans grid.c
-    grid* level = init_level("level1.txt");
+    grid* level = init_level("levels/level1.txt");
 
     printf("Number of lines is: %d\n", level->row_number);
     printf("Number of columns is: %d\n", level->column_number);
@@ -40,7 +40,7 @@ int main02() {
 
 int main03() {
     // Test de la fonction display() dans grid.c
-    grid* level = init_level("level1.txt");
+    grid* level = init_level("levels/level1.txt");
     display(level);
     free_level(level);
     return 0;
@@ -48,7 +48,7 @@ int main03() {
 
 int main() {
     // Test de la fonction move_player() dans player.c
-    grid* level = init_level("level1.txt");
+    grid* level = init_level("levels/level1.txt");
     char quitCar = '\0';
     while (quitCar != 'q') {
         printf("Appuyez sur \"q\" pour quitter\n");