⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umake_win_makefile.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 2 页
字号:
# # ***** BEGIN LICENSE BLOCK *****# Source last modified: $Id: umake_win_makefile.py,v 1.9 2004/10/19 19:38:11 hubbe Exp $# # Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.# # The contents of this file, and the files included with this file,# are subject to the current version of the RealNetworks Public# Source License (the "RPSL") available at# http://www.helixcommunity.org/content/rpsl unless you have licensed# the file under the current version of the RealNetworks Community# Source License (the "RCSL") available at# http://www.helixcommunity.org/content/rcsl, in which case the RCSL# will apply. You may also obtain the license terms directly from# RealNetworks.  You may not use this file except in compliance with# the RPSL or, if you have a valid RCSL with RealNetworks applicable# to this file, the RCSL.  Please see the applicable RPSL or RCSL for# the rights, obligations and limitations governing use of the# contents of the file.# # Alternatively, the contents of this file may be used under the# terms of the GNU General Public License Version 2 or later (the# "GPL") in which case the provisions of the GPL are applicable# instead of those above. If you wish to allow use of your version of# this file only under the terms of the GPL, and not to allow others# to use your version of this file under the terms of either the RPSL# or RCSL, indicate your decision by deleting the provisions above# and replace them with the notice and other provisions required by# the GPL. If you do not delete the provisions above, a recipient may# use your version of this file under the terms of any one of the# RPSL, the RCSL or the GPL.# # This file is part of the Helix DNA Technology. RealNetworks is the# developer of the Original Code and owns the copyrights in the# portions it created.# # This file, and the files included with this file, is distributed# and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY# KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS# ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET# ENJOYMENT OR NON-INFRINGEMENT.# # Technology Compatibility Kit Test Suite(s) Location:#    http://www.helixcommunity.org/content/tck# # Contributor(s):# # ***** END LICENSE BLOCK *****# """ Makefile generator which generates nmake files and VC6 DSP/DSW files """import stringimport makefileimport umake_makefileimport umake_libimport umakeimport bldregimport osproject_extension = "dsp"workspace_extension = "dsw"#### FIXME list:## o add the 'make copy' commands to the post-build-commands## o Make multitarget makefiles use dependencies to build##   the subprojects instead of using a Makefile project##   (Is it possible to create a name-only project??)def prepend_str_list(prepend_str, list):    """Given a string and a list of strings, returns a new list with the    string pre-pended to each item in the list."""        new_list = []    for current_str in list:        new_list.append(prepend_str + current_str)    return new_list###### What follows is a bunch of text fragments### which make up a *.dsp file###header1="""# Microsoft Developer Studio Project File - Name="$(MODULE)" - Package Owner=<4># Microsoft Developer Studio Generated Build File, Format Version 6.00# ** DO NOT EDIT **"""header2="""CFG=$(MODULE) - Win32 Debug!MESSAGE This is not a valid makefile. To build this project using NMAKE,!MESSAGE use the Export Makefile command and run!MESSAGE !MESSAGE NMAKE /f "$(MODULE).mak".!MESSAGE !MESSAGE You can specify a configuration when running NMAKE!MESSAGE by defining the macro CFG on the command line. For example:!MESSAGE !MESSAGE NMAKE /f "$(MODULE).mak" CFG="$(MODULE) - Win32 Debug"!MESSAGE !MESSAGE Possible choices for configuration are:!MESSAGE """header3="""!MESSAGE # Begin Project# PROP AllowPerConfigDependencies 1# PROP Scc_ProjName ""# PROP Scc_LocalPath ""CPP=$(CC)MTL=midl.exeRSC=$(RC)"""config="""# PROP BASE Use_MFC 0# PROP BASE Use_Debug_Libraries $(DEBUG)# PROP BASE Output_Dir "$(OUTDIR)"# PROP BASE Intermediate_Dir "$(OBJDIR)"# PROP BASE Target_Dir ""# PROP Use_MFC 0# PROP Use_Debug_Libraries $(DEBUG)# PROP Output_Dir "$(OUTDIR)"# PROP Intermediate_Dir "$(OBJDIR)"# PROP Ignore_Export_Lib 0# PROP Target_Dir ""# ADD BASE CPP $(ALL_CC_FLAGS)# ADD CPP $(ALL_CC_FLAGS)# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32# ADD BASE RSC $(RCFLAGS)# ADD RSC $(RCFLAGS)BSC32=bscmake.exe# ADD BASE BSC32 /nologo# ADD BSC32 /nologo """config_exe="""LINK32=$(LD)# ADD BASE LINK32 $(LDFLAGS)# ADD LINK32 $(LINKER_OPTIONS)"""config_lib="""LIB32=$(LD) -lib# ADD BASE LIB32 /nologo# ADD LIB32 /nologo /OUT:$(OUTFILE) $(SOURCE_OBJS)"""config_make="""# PROP BASE Cmd_Line "$(MAKE) /f $(MAKEFILE)"# PROP Cmd_Line "$(MAKE) /f $(MAKEFILE)"# PROP Rebuild_Opt "/a""""config_postbuildcmd="""# Begin Special Build ToolSOURCE="$(InputPath)"PostBuild_Cmds=$(POSTBUILDCMDS)# End Special Build Tool"""class Config:    """Class representing one profile in a MSDEV project"""        def __init__(self,                 type,                 variables,                 target_type,                 post_build = []):        self.variables = variables.copy()        self.type=type        self.variables["TYPE"]=type        self.target_type = target_type        if string.lower(type[:6]) == "debug":            self.variables["DEBUG"]="1"        else:            self.variables["DEBUG"]="0"        self.post_build_cmds = post_build    def generate(self, project):        global config        global config_link        global config_lib        global config_make        if self.target_type == "lib":            text = config + config_lib        elif self.target_type == "":            text = config + config_make        else:            text = config + config_exe        self.variables["POSTBUILDCMDS"]=string.join(self.post_build_cmds,"\t")        if len(self.post_build_cmds):            text = text + config_postbuildcmd                    return makefile.expand_variables(text, self.variables)    def generate_message(self):        if self.target_type == "exe":            text="""!MESSAGE "$(MODULE) - Win32 $(TYPE)" (based on "Win32 (x86) Application")"""        elif self.target_type == "lib":            text="""!MESSAGE "$(MODULE) - Win32 $(TYPE)" (based on "Win32 (x86) Static Library")"""        elif self.target_type == "dll":            text="""!MESSAGE "$(MODULE) - Win32 $(TYPE)" (based on "Win32 (x86) Dynamic-Link Library")"""        elif self.target_type == "":            text="""!MESSAGE "$(MODULE) - Win32 $(TYPE)" (based on "Win32 (x86) External Target")"""        else:            raise "Target type '%s' is not valid!" % self.target_type        return makefile.expand_variables(text, self.variables)    def generate_message2(self):        text='# Name "$(MODULE) - Win32 $(TYPE)"'        return makefile.expand_variables(text, self.variables)class Project:    """Class representing and generating one MSDEV project"""        def __init__(self, name, makefile_name, target_type, variables):        self.name = name        self.makefile_name = makefile_name        self.target_type = target_type        self.configurations = []        self.sourcefiles = []        self.headerfiles = []        self.variables = variables    def AddConfig(self, type, variables, postbuild = []):        self.configurations.append(Config(type, variables, self.target_type, postbuild))    def AddSourceFile(self, sourcefile):        self.sourcefiles.append( sourcefile )    def AddHeaderFile(self, filename):        self.headerfiles.append(filename)    def AddHeaderFiles(self, filenames):        self.headerfiles.extend(filenames)    def generate(self):        global header1        global header2        global header3        text = [ makefile.expand_variables(header1, self.variables) ]        if self.target_type == "exe":            text.append('# TARGTYPE "Win32 (x86) Application" 0x0101')        elif self.target_type == "lib":            text.append('# TARGTYPE "Win32 (x86) Static Library" 0x0104')        elif self.target_type == "dll":            text.append('# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102')        elif self.target_type == "":            text.append('# TARGTYPE "Win32 (x86) External Target" 0x0106')        text.append(makefile.expand_variables(header2, self.variables))        for config in self.configurations:            text.append(config.generate_message())        text.append(makefile.expand_variables(header3, self.variables))        i=0        ifelse="IF"        for config in self.configurations:            text.append('!%s  "$(CFG)" == "$(MODULE) - Win32 %s"' % (ifelse, config.type))            text.append(config.generate(self))            ifelse="ELSEIF"        text.append("!ENDIF")        text.append("")        text.append("# Begin Target")        text.append("")        for config in self.configurations:            text.append(config.generate_message2())        #text.append('# Begin Group "Resources"')        #text.append("")        #text.append('# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"')        #text.append("# End Group")        text.append('# Begin Group "Source Files"')        for sourcefile in self.sourcefiles:            text.append('# Begin Source File')            text.append('')            text.append('SOURCE=%s' % sourcefile.path)            if sourcefile.obj_path:                text.append('# PROP Intermediate_Dir "%s"' % os.path.dirname(sourcefile.obj_path))            if sourcefile.build_rule.source_suffix in [".cpp", ".cc",".c"]:                xflags=self.variables["EXTRA_%s_FLAGS" % sourcefile.build_rule.command.make_var]                if xflags:                    text.append('# ADD CPP %s' % xflags)            text.append('# End Source File')                    text.append('# End Group')        text.append('# Begin Group "Header Files"')        for source in self.headerfiles:            text.append('# Begin Source File')            text.append('')            text.append('SOURCE=%s' % source)            text.append('# End Source File')                    text.append('# End Group')        text.append('# End Target')        text.append('# End Project')                        text.append("")        text=string.join(text,"\n")        text=string.replace(text,"$(MODULE)",self.name)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -