From aa947c9474ad83aa9315bc585d1f0b79060fee61 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:33 +0100 Subject: BUILD: Split configure.engines down to a single file per engine. This is the first part of allowing engines to be added dynamically. They are placed into a folder in engines/ which must contain a file named "configure.engine" to add the engine, which is pulled into the top level configure script automatically. --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index cb0b8902fc..4825cdc498 100755 --- a/configure +++ b/configure @@ -97,7 +97,9 @@ add_feature() { _srcdir=`dirname $0` # Read list of engines -. $_srcdir/engines/configure.engines +for i in $_srcdir/engines/*/configure.engine; do + . "$i" +done # # Default settings -- cgit v1.2.3 From 00c27a28f91cc2bbf512461e69c86be998462728 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Split engines/plugins_table header down to a file per engine. This is the third and final commit enabling fully pluggable engines. Now providing an engine folder contains a configure.engine, engine.mk and engine-plugin.h file, it will be picked up automatically by the configure script. --- configure | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 4825cdc498..2bad89a87d 100755 --- a/configure +++ b/configure @@ -4382,3 +4382,14 @@ include \$(srcdir)/Makefile EOF fi + +echo "Creating engines/plugins_table.h" +cat > engines/plugins_table.h << EOF +/* This file is automatically generated by configure */ +/* DO NOT EDIT MANUALLY */ +// This file is being included by "base/plugins.cpp" +EOF + +for i in $_srcdir/engines/*/engine-plugin.h; do + cat $i >> engines/plugins_table.h +done -- cgit v1.2.3 From 1ac01d2333af11d403ef84dd5192abb18814e5b3 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Remove need for engine-plugin.h in engines. This is now generated automatically by the configure script from the engine directory names. --- configure | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 2bad89a87d..1832383a25 100755 --- a/configure +++ b/configure @@ -4390,6 +4390,13 @@ cat > engines/plugins_table.h << EOF // This file is being included by "base/plugins.cpp" EOF -for i in $_srcdir/engines/*/engine-plugin.h; do - cat $i >> engines/plugins_table.h +for i in $_srcdir/engines/*; do + if [ -d $i ]; then + j=`echo ${i#$_srcdir/engines/} | tr '[:lower:]' '[:upper:]'` + cat >> engines/plugins_table.h << EOF +#if PLUGIN_ENABLED_STATIC($j) +LINK_PLUGIN($j) +#endif +EOF + fi done -- cgit v1.2.3 From ef85456859e466adc8913041e4f31809485c45ab Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Remove need for engine.mk in each engine directory. Each engine now only has to provide a single configure.engine file adding the engine into the configure script, which then produces the required other files automatically. --- configure | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 1832383a25..bf8649a9b8 100755 --- a/configure +++ b/configure @@ -4383,6 +4383,40 @@ EOF fi +echo "Creating engines/engines.mk" +cat > engines/engines.mk << EOF +# This file is automatically generated by configure +# DO NOT EDIT MANUALLY +# This file is being included by "Makefile.common" +EOF + +for engine in $_engines; do + j=`echo $engine | tr '[:lower:]' '[:upper:]'` + if test "`get_engine_sub $engine`" = "no" ; then + # main engine + cat >> engines/engines.mk << EOF + +ifdef ENABLE_$j +DEFINES += -DENABLE_$j=\$(ENABLE_$j) +MODULES += engines/$engine +EOF + + for subeng in `get_engine_subengines $engine` ; do + k=`echo $subeng | tr '[:lower:]' '[:upper:]'` + cat >> engines/engines.mk << EOF + +ifdef ENABLE_$k +DEFINES += -DENABLE_$k +endif +EOF + done + + cat >> engines/engines.mk << EOF +endif +EOF + fi +done + echo "Creating engines/plugins_table.h" cat > engines/plugins_table.h << EOF /* This file is automatically generated by configure */ @@ -4390,9 +4424,9 @@ cat > engines/plugins_table.h << EOF // This file is being included by "base/plugins.cpp" EOF -for i in $_srcdir/engines/*; do - if [ -d $i ]; then - j=`echo ${i#$_srcdir/engines/} | tr '[:lower:]' '[:upper:]'` +for engine in $_engines; do + if test "`get_engine_sub $engine`" = "no" ; then + j=`echo $engine | tr '[:lower:]' '[:upper:]'` cat >> engines/plugins_table.h << EOF #if PLUGIN_ENABLED_STATIC($j) LINK_PLUGIN($j) -- cgit v1.2.3 From 19a20ad71fb8b57504f54786b39ba481dd1400b0 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:34 +0100 Subject: BUILD: Create engines/ dir if necessary, to fix out-of-tree builds --- configure | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'configure') diff --git a/configure b/configure index bf8649a9b8..e474490efb 100755 --- a/configure +++ b/configure @@ -4383,6 +4383,10 @@ EOF fi +# Ensure engines folder exists prior to trying to generate +# files into it (used for out-of-tree-builds) +mkdir -p engines + echo "Creating engines/engines.mk" cat > engines/engines.mk << EOF # This file is automatically generated by configure -- cgit v1.2.3 From ffce805fb2b116ef1d4f03540158d42b3fcd5e80 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 7 Nov 2013 12:58:35 +0100 Subject: BUILD: Add code to maintain ordering of engines in generated files. This is mainly "cosmetic" to keep the SCUMM engine and subengines at the top of the various files, but probably a good idea to prevent any subtle regressions associated with changing the order. --- configure | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'configure') diff --git a/configure b/configure index e474490efb..d454591f08 100755 --- a/configure +++ b/configure @@ -4199,8 +4199,18 @@ for engine in $_engines; do fi done -# Prepare the information to be shown +# Sort engines to place our headline engine at start... +# No technical reason, just historical convention +headline_engine=scumm +_sorted_engines="${headline_engine}" for engine in $_engines; do + if test "${engine}" != "${headline_engine}" ; then + _sorted_engines="${_sorted_engines} ${engine}" + fi +done + +# Prepare the information to be shown +for engine in $_sorted_engines; do if test "`get_engine_sub $engine`" = "no" ; then # It's a main engine prepare_engine_build_strings $engine @@ -4394,7 +4404,7 @@ cat > engines/engines.mk << EOF # This file is being included by "Makefile.common" EOF -for engine in $_engines; do +for engine in $_sorted_engines; do j=`echo $engine | tr '[:lower:]' '[:upper:]'` if test "`get_engine_sub $engine`" = "no" ; then # main engine @@ -4428,7 +4438,7 @@ cat > engines/plugins_table.h << EOF // This file is being included by "base/plugins.cpp" EOF -for engine in $_engines; do +for engine in $_sorted_engines; do if test "`get_engine_sub $engine`" = "no" ; then j=`echo $engine | tr '[:lower:]' '[:upper:]'` cat >> engines/plugins_table.h << EOF -- cgit v1.2.3