Code

screen: don't compile disabled sources
authorMax Kellermann <max@duempel.org>
Thu, 25 Sep 2008 18:00:03 +0000 (20:00 +0200)
committerMax Kellermann <max@duempel.org>
Thu, 25 Sep 2008 18:00:03 +0000 (20:00 +0200)
Instead of evaluating macros from config.h in the disabled source,
don't start the compiler on it at all.

Makefile.am
configure.ac
src/Makefile.am
src/screen.c
src/screen_artist.c
src/screen_keydef.c
src/screen_lyrics.c
src/screen_search.c

index 25a7b6376b0daff0cb71cb5c6ffbedd911565b20..77720dd1a6a7c9b6d1b64ca2741b7afdf1af1a7b 100644 (file)
@@ -23,7 +23,7 @@ EXTRA_DIST = \
 # lyrics plugins
 #
 
-if LYRICS
+if ENABLE_LYRICS_SCREEN
 
 lyrics_plugin_dir = @lyrics_plugin_dir@
 lyrics_plugins = hd.sh leoslyrics.py lyricswiki.rb
index ef9a617cdb2c88955167e5e086b31a4933c77a4c..4637c2555f87ad0f3a93dec7bc7a15ab3849004a 100644 (file)
@@ -218,6 +218,8 @@ if test "x$artist_screen" != "xyes" ; then
    AC_DEFINE(DISABLE_ARTIST_SCREEN, 1, [Disable artist screen])
 fi
 
+AM_CONDITIONAL(ENABLE_ARTIST_SCREEN, test x$artist_screen = xyes)
+
 dnl Optional screen - search
 AC_MSG_CHECKING([whether to include the search screen])
 AC_ARG_ENABLE([search-screen], 
@@ -229,6 +231,8 @@ AC_MSG_RESULT([$search_screen])
 if test "x$search_screen" != "xyes" ; then
    AC_DEFINE(DISABLE_SEARCH_SCREEN, 1, [Disable search screen])
 fi
+
+AM_CONDITIONAL(ENABLE_SEARCH_SCREEN, test x$search_screen = xyes)
   
 dnl Optional screen - key editor
 AC_MSG_CHECKING([whether to include the key editor screen])
@@ -242,6 +246,8 @@ if test "x$keydef_screen" != "xyes" ; then
    AC_DEFINE(DISABLE_KEYDEF_SCREEN, 1, [Disable key editor screen])
 fi
 
+AM_CONDITIONAL(ENABLE_KEYDEF_SCREEN, test x$keydef_screen = xyes)
+
 dnl Optional screen - lyrics
 AC_MSG_CHECKING([whether to include the lyrics screen]) 
 AC_ARG_ENABLE([lyrics-screen], 
@@ -254,7 +260,7 @@ if test "x$lyrics_screen" != "xyes" ; then
    lyrics_screen=no
 fi
 
-AM_CONDITIONAL(LYRICS, test x$lyrics_screen = xyes)
+AM_CONDITIONAL(ENABLE_LYRICS_SCREEN, test x$lyrics_screen = xyes)
 
 AC_MSG_RESULT([$lyrics_screen])
 
index 9a2d5c02263330f6a8c585669cffd1ba7af2a8d7..f91c2cff5ef04d493b89d0e9de4697021c978c20 100644 (file)
@@ -58,20 +58,31 @@ ncmpc_SOURCES = \
   screen_play.c\
        screen_browser.c\
   screen_file.c\
-  screen_artist.c\
-  screen_search.c\
   screen_help.c\
-  screen_lyrics.c\
-  screen_keydef.c\
   list_window.c\
   colors.c\
   support.c\
   wreadln.c\
   strfsong.c\
   utils.c\
-       lyrics.c \
        str_pool.c
 
+if ENABLE_ARTIST_SCREEN
+ncmpc_SOURCES += screen_artist.c
+endif
+
+if ENABLE_SEARCH_SCREEN
+ncmpc_SOURCES += screen_search.c
+endif
+
+if ENABLE_KEYDEF_SCREEN
+ncmpc_SOURCES += screen_keydef.c
+endif
+
+if ENABLE_LYRICS_SCREEN
+ncmpc_SOURCES += screen_lyrics.c lyrics.c
+endif
+
 ncmpc_SOURCES+=${ncmpc_headers}
 
 
index e391a9d6295968f39f6e51c3ddbf1125c970134a..71631db6e48d61fa1aa64d85ec836996b1e812a5 100644 (file)
@@ -61,7 +61,9 @@ extern const struct screen_functions screen_search;
 #ifdef ENABLE_KEYDEF_SCREEN
 extern const struct screen_functions screen_keydef;
 #endif
+#ifdef ENABLE_LYRICS_SCREEN
 extern const struct screen_functions screen_lyrics;
+#endif
 
 typedef struct screen_functions * (*screen_get_mode_functions_fn_t) (void);
 
index be7049b4d00db013d0498d614d6376517c5de92b..23a56d5b418b6d11edc6f2107ee49c67fbb9e493 100644 (file)
@@ -16,9 +16,6 @@
  *
  */
 
-#include "config.h"
-
-#ifndef DISABLE_ARTIST_SCREEN
 #include "ncmpc.h"
 #include "options.h"
 #include "support.h"
@@ -486,5 +483,3 @@ const struct screen_functions screen_artist = {
        .cmd = artist_cmd,
        .get_title = get_title,
 };
-
-#endif /* ENABLE_ARTIST_SCREEN */
index ad547147600168feb4614759d20a2581578039ca..a37d27d2a0dfb2eda684beef648c30782823e1b5 100644 (file)
@@ -16,9 +16,6 @@
  *
  */
 
-#include "config.h"
-
-#ifndef  DISABLE_KEYDEF_SCREEN
 #include "ncmpc.h"
 #include "mpdclient.h"
 #include "options.h"
@@ -375,5 +372,3 @@ const struct screen_functions screen_keydef = {
        .cmd = keydef_cmd,
        .get_title = keydef_title,
 };
-
-#endif
index d83bf5b36b993d9acfdca8cd8d2356aa8f3873d5..3c0393488fde736866ae6a669f20a8fbab42f23d 100644 (file)
@@ -17,8 +17,6 @@
  *
  */
 
-#include "config.h"
-#ifndef DISABLE_LYRICS_SCREEN
 #include <sys/stat.h>
 #include "ncmpc.h"
 #include "options.h"
@@ -336,5 +334,3 @@ const struct screen_functions screen_lyrics = {
        .cmd = lyrics_cmd,
        .get_title = lyrics_title,
 };
-
-#endif /* ENABLE_LYRICS_SCREEN */
index 5135b6cf027309fbea390791426d524655d01ad4..245eb5243c9c9bc9000895fb54dea15967585af7 100644 (file)
@@ -16,9 +16,6 @@
  *
  */
 
-#include "config.h"
-
-#ifndef DISABLE_SEARCH_SCREEN
 #include "ncmpc.h"
 #include "options.h"
 #include "support.h"
@@ -525,5 +522,3 @@ const struct screen_functions screen_search = {
        .cmd = search_cmd,
        .get_title = get_title,
 };
-
-#endif /* ENABLE_SEARCH_SCREEN */