1# ScummVM - Graphic Adventure Engine 2# Copyright (C) 2021 Stryzhniou Fiodar 3 4# ScummVM is the legal property of its developers, whose names 5# are too numerous to list here. Please refer to the COPYRIGHT 6# file distributed with this source distribution. 7 8# This program is free software; you can redistribute it and/or 9# modify it under the terms of the GNU General Public License 10# as published by the Free Software Foundation; either version 2 11# of the License, or (at your option) any later version. 12 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17 18# You should have received a copy of the GNU General Public License 19# along with this program; if not, write to the Free Software 20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 22from __future__ import with_statement 23import os 24from common_names import * 25 26excluded = ("", "") 27 28def exclude_special_cpp(tmp): 29 d = "%s.cpp" %tmp[:-2] 30 if d in excluded: 31 print "excluded: %s" %d 32 return "" 33 return tmp 34 35src_dirs = ("backends", "common", "engines", "gui", "math") 36mmp_name = "scummvm_base.mmp" 37 38mmp_template = """ 39TARGET scummvm_base.lib 40TARGETTYPE lib 41#include "../%s/build_config.mmh" 42 43// compiler must use png.h from libpng.lib instead ScummVM's 44OPTION GCCE -I'/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/png' 45 46// added and managed by porter 47SOURCEPATH ..\..\..\..\\backends 48SOURCE audiocd\sdl\sdl-audiocd.cpp 49SOURCE fs\symbian\symbianstream.cpp 50SOURCE mixer\symbiansdl\symbiansdl-mixer.cpp 51// end porter job\n 52#include "build_parts.mmh" 53\n#include \"../%s/macros.mmh\"\n 54""" 55 56 57def checkMacro(macro, active_conf = active_config): 58 t = macro.split()[-1] 59 if t in active_conf: 60 return True 61 else: 62 if t not in disabled_config: 63 print "New macro found: %s" %t 64 return False 65 66def processModule_mk(folder, mmp_file, active_conf = active_config): 67 pth = os.path.join('..\..\..', folder) 68 try: 69 with open(os.path.join(pth, "module.mk")) as ff: 70 f = ff.readlines() 71 except IOError: #folder added in newer version 72 return 73 pth = os.path.join('..\..\..\..', folder) 74 SafeWriteFile(mmp_file, "\nSOURCEPATH %s\n" %pth, 'a') 75 76 src = [] 77 addsrc = None 78 79 for i in f: 80 if "MODULE_OBJS :=" in i: 81 addsrc = True 82 elif "endif" in i: 83 addsrc = False 84 elif "SDL_BACKEND" in i: 85 addsrc = True 86 elif "ENABLE_" in i: 87 addsrc = checkMacro(i, active_conf) 88 elif "USE_" in i: 89 addsrc = checkMacro(i, active_conf) 90 elif "DISABLE_" in i: 91 addsrc = checkMacro(i, active_conf) 92 elif addsrc is True: 93 tmp = i.strip() 94 tmp = tmp.rstrip("\\") 95 tmp = tmp.strip() 96 tmp = exclude_special_cpp(tmp) 97 if tmp.endswith(".o"): 98 src += ["SOURCE %s.cpp" %tmp[:-2]] 99 SafeWriteFile(mmp_file, src, 'a') 100 101 102def parse_base(platform = "S60v3"): 103 uids = get_UIDs(build) 104 mmp_file = os.path.join(mmps, mmp_name) 105 SafeWriteFile(mmp_file, mmp_template %(platform, platform) ) 106 [processModule_mk(i, mmp_file) for i in src_dirs] 107 108if __name__ == "__main__": 109 parse_base() 110