diff --git a/caca/Makefile.am b/caca/Makefile.am
index e2b3731..3e27733 100644
--- a/caca/Makefile.am
+++ b/caca/Makefile.am
@@ -35,21 +35,13 @@ libcaca_la_SOURCES = \
frame.c \
dither.c \
font.c \
- import.c \
- export.c \
file.c \
figfont.c \
graphics.c \
event.c \
time.c \
- driver_conio.c \
- driver_ncurses.c \
- driver_raw.c \
- driver_slang.c \
- driver_vga.c \
- driver_win32.c \
- $(cocoa_source) \
- $(extra_source) \
+ $(codec_source) \
+ $(driver_source) \
$(NULL)
libcaca_la_DEPENDENCIES = \
mono9.data \
@@ -59,6 +51,20 @@ libcaca_la_CPPFLAGS = $(AM_CPPFLAGS) @CACA_CFLAGS@ -D__LIBCACA__
libcaca_la_LDFLAGS = -no-undefined -version-number @LT_VERSION@
libcaca_la_LIBADD = @CACA_LIBS@ $(ZLIB_LIBS)
+codec_source = \
+ codec/import.c \
+ codec/export.c \
+ $(NULL)
+
+driver_source = \
+ driver/conio.c \
+ driver/ncurses.c \
+ driver/raw.c \
+ driver/slang.c \
+ driver/vga.c \
+ driver/win32.c \
+ $(NULL)
+
install-exec-local:
$(mkinstalldirs) $(DESTDIR)$(libdir)
. libcaca.la; \
@@ -83,20 +89,20 @@ if USE_PLUGINS
plugin_LTLIBRARIES = libx11_plugin.la libgl_plugin.la
plugindir = $(libdir)/caca
-libx11_plugin_la_SOURCES = driver_x11.c
+libx11_plugin_la_SOURCES = driver/x11.c
libx11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(X11_CFLAGS)
libx11_plugin_la_LDFLAGS = -no-undefined -module -no-version
libx11_plugin_la_LIBADD = libcaca.la $(X11_LIBS)
-libgl_plugin_la_SOURCES = driver_gl.c
+libgl_plugin_la_SOURCES = driver/gl.c
libgl_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(GL_CFLAGS) #$(FTGL_CFLAGS)
libgl_plugin_la_LDFLAGS = -no-undefined -module -no-version
libgl_plugin_la_LIBADD = libcaca.la $(GL_LIBS) #$(FTGL_LIBS)
else
-extra_source = driver_x11.c driver_gl.c
+driver_source += driver/x11.c driver/gl.c
endif
if USE_COCOA
-cocoa_source = driver_cocoa.m
+driver_source += driver/cocoa.m
endif
diff --git a/caca/export.c b/caca/codec/export.c
similarity index 100%
rename from caca/export.c
rename to caca/codec/export.c
diff --git a/caca/import.c b/caca/codec/import.c
similarity index 100%
rename from caca/import.c
rename to caca/codec/import.c
diff --git a/caca/driver_cocoa.m b/caca/driver/cocoa.m
similarity index 100%
rename from caca/driver_cocoa.m
rename to caca/driver/cocoa.m
diff --git a/caca/driver_conio.c b/caca/driver/conio.c
similarity index 100%
rename from caca/driver_conio.c
rename to caca/driver/conio.c
diff --git a/caca/driver_gl.c b/caca/driver/gl.c
similarity index 100%
rename from caca/driver_gl.c
rename to caca/driver/gl.c
diff --git a/caca/driver_ncurses.c b/caca/driver/ncurses.c
similarity index 100%
rename from caca/driver_ncurses.c
rename to caca/driver/ncurses.c
diff --git a/caca/driver_raw.c b/caca/driver/raw.c
similarity index 100%
rename from caca/driver_raw.c
rename to caca/driver/raw.c
diff --git a/caca/driver_slang.c b/caca/driver/slang.c
similarity index 100%
rename from caca/driver_slang.c
rename to caca/driver/slang.c
diff --git a/caca/driver_vga.c b/caca/driver/vga.c
similarity index 100%
rename from caca/driver_vga.c
rename to caca/driver/vga.c
diff --git a/caca/driver_win32.c b/caca/driver/win32.c
similarity index 100%
rename from caca/driver_win32.c
rename to caca/driver/win32.c
diff --git a/caca/driver_x11.c b/caca/driver/x11.c
similarity index 100%
rename from caca/driver_x11.c
rename to caca/driver/x11.c
diff --git a/caca/libcaca.vcproj b/caca/libcaca.vcproj
index c39be23..d679f86 100644
--- a/caca/libcaca.vcproj
+++ b/caca/libcaca.vcproj
@@ -223,35 +223,35 @@
>