diff options
author | rubidium <rubidium@openttd.org> | 2007-01-02 19:19:48 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-02 19:19:48 +0000 |
commit | 013df98f79866a75f367853c9e436f3c5c79f645 (patch) | |
tree | ad4a63860df2626b22f77e7dac712e958bea54cb /projects/generate | |
parent | 3d32fd3f4bfaceb8a48530fbc2f4bd5db2752596 (diff) | |
download | openttd-013df98f79866a75f367853c9e436f3c5c79f645.tar.xz |
(svn r7759) -Merge: makefile rewrite. This merge features:
- A proper ./configure, so everything needs to be configured only once, not for every make.
- Usage of makedepend when available. This greatly reduces the time needed for generating the dependencies.
- A generator for all project files. There is a single file with sources, which is used to generate Makefiles and the project files for MSVC.
- Proper support for OSX universal binaries.
- Object files for non-MSVC compiles are also placed in separate directories, making is faster to switch between debug and release compiles and it does not touch the directory with the source files.
- Functionality to make a bundle of all needed files for for example a nightly or distribution of a binary with all needed GRFs and language files.
Note: as this merge moves almost all files, it is recommended to make a backup of your working copy before updating your working copy.
Diffstat (limited to 'projects/generate')
-rwxr-xr-x | projects/generate | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/projects/generate b/projects/generate new file mode 100755 index 000000000..da431a901 --- /dev/null +++ b/projects/generate @@ -0,0 +1,158 @@ +#!/bin/bash + +# This file generates all project files based on sources.list, so everyone who +# can start a bash process, can update the project files. + +ROOT_DIR="`pwd`/.." +if ! [ -e "$ROOT_DIR/source.list" ] +then + ROOT_DIR="`pwd`" +fi +if ! [ -e "$ROOT_DIR/source.list" ] +then + echo "Can't find source.list, needed in order to make this run. Please go to either" + echo " the project dir, or the root dir of a clean SVN checkout." + exit 1 +fi + +# openttd_vs80.sln is for MSVC 2005 +# openttd_vs80.vcproj is for MSVC 2005 +# langs_vs80.vcproj is for MSVC 2005 +# strgen_vs80.vcprojc is vor MSVC 2005 + +# openttd.sln is for MSVC 2003 +# openttd.vcproj is for MSVC 2003 +# langs.vcproj is for MSVC 2003 +# strgen.vcproj is for MSVC 2003 + +# openttd.tgt is for WatCom + + + +# First, collect the list of Windows files +sdl_config="1" +os="MSVC" +enable_dedicated="0" +with_cocoa="0" +enable_directmusic="1" +file_prefix="..\\\\src\\\\" + +load_main_data() { + # Read the source.list and process it + RES="`awk ' + /^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; } + /^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; } + /^( *)#if/ { + gsub(" ", "", $0); + gsub("^#if", "", $0); + gsub("^ ", "", $0); + + if (deep != skip) { deep += 1; next; } + + deep += 1; + + if ($0 == "SDL" && "'$sdl_config'" == "") { next; } + if ($0 == "OSX" && "'$os'" != "OSX") { next; } + if ($0 == "DEDICATED" && "'$enable_dedicated'" != "1") { next; } + if ($0 == "COCOA" && "'$with_cocoa'" == "0") { next; } + if ($0 == "BEOS" && "'$os'" != "BEOS") { next; } + if ($0 == "WIN32" && "'$os'" != "MINGW" && + "'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; } + if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } + if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; } + + skip += 1; + + next; + } + /^( *)#/ { + if (deep == skip) { + gsub(" ", "", $0); + gsub("^#", "", $0); + gsub("^ ", "", $0); + + if (first_time != 0) { + print " </Filter>"; + } else { + first_time = 1; + } + + print " <Filter"; + print " Name=\\""$0"\\""; + print " Filter=\\"\\">"; + } + + next; + } + /^$/ { next } + { + if (deep == skip) { + gsub(" ", "", $0); + gsub("/", "\\\\", $0); + print " <File"; + print " RelativePath=\\".\\\\'$file_prefix'"$0"\\">"; + print " </File>"; + } + } + END { print " </Filter>"; } + ' < $1`" + + eval "$2=\"\$RES\"" +} + +load_lang_data() { + RES="" + for i in `ls $1` + do + i=`basename $i | sed s/.txt$//g` + RES="$RES + <File + RelativePath=\"..\\src\\lang\\"$i".txt\" + > + <FileConfiguration + Name=\"Debug|Win32\"> + <Tool + Name=\"VCCustomBuildTool\" + Description=\"Generating "$i" language file\" + CommandLine=\"..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang "\$(InputPath)"
\" + AdditionalDependencies=\"\" + Outputs=\"..\\bin\\lang\\"$i".lng\" + /> + </FileConfiguration> + </File>" + done + + eval "$2=\"\$RES\"" +} + +generate() { + echo "Generating $2..." + # Everything above the !!FILES!! marker + RES="`awk ' + /!!FILES!!/ { stop = 1; } + { + if (stop == 0) { print $0 } + } + ' < \"$ROOT_DIR/projects/$2\".in > \"$ROOT_DIR/projects/$2\"`" + + # The files-list + echo "$1" >> "$ROOT_DIR/projects/$2" + + # Everything below the !!FILES!! marker + RES="`awk ' + BEGIN { stop = 1; } + /!!FILES!!/ { stop = 2; } + { + if (stop == 0) { print $0 } + if (stop == 2) { stop = 0 } + } + ' < \"$ROOT_DIR/projects/$2.in\" >> \"$ROOT_DIR/projects/$2\"`" +} + +load_main_data "$ROOT_DIR/source.list" openttd +load_lang_data "$ROOT_DIR/src/lang/*.txt" lang + +generate "$openttd" "openttd.vcproj" +generate "$openttd" "openttd_vs80.vcproj" +generate "$lang" "langs_vs80.vcproj" +generate "$lang" "langs.vcproj" |