From cee4c0450e477e6b683fb3db883227c2a7fa423f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 25 Sep 2008 20:00:03 +0200 Subject: [PATCH] screen: don't compile disabled sources Instead of evaluating macros from config.h in the disabled source, don't start the compiler on it at all. --- Makefile.am | 2 +- configure.ac | 8 +++++++- src/Makefile.am | 21 ++++++++++++++++----- src/screen.c | 2 ++ src/screen_artist.c | 5 ----- src/screen_keydef.c | 5 ----- src/screen_lyrics.c | 4 ---- src/screen_search.c | 5 ----- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 25a7b63..77720dd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index ef9a617..4637c25 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/Makefile.am b/src/Makefile.am index 9a2d5c0..f91c2cf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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} diff --git a/src/screen.c b/src/screen.c index e391a9d..71631db 100644 --- a/src/screen.c +++ b/src/screen.c @@ -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); diff --git a/src/screen_artist.c b/src/screen_artist.c index be7049b..23a56d5 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -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 */ diff --git a/src/screen_keydef.c b/src/screen_keydef.c index ad54714..a37d27d 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -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 diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index d83bf5b..3c03934 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -17,8 +17,6 @@ * */ -#include "config.h" -#ifndef DISABLE_LYRICS_SCREEN #include #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 */ diff --git a/src/screen_search.c b/src/screen_search.c index 5135b6c..245eb52 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -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 */ -- 2.30.2