コード例 #1
0
ファイル: data.py プロジェクト: iHaD/Spidermonkey
 def get_defines(self):
     for define, value in self.defines.iteritems():
         if value is True:
             defstr = define
         else:
             defstr = '%s=%s' % (define, shell_quote(value))
         yield ('-D%s' % defstr)
コード例 #2
0
ファイル: data.py プロジェクト: sandhua/gecko-dev
 def get_defines(self):
     for define, value in self.defines.iteritems():
         if value is True:
             defstr = define
         else:
             defstr = '%s=%s' % (define, shell_quote(value))
         yield('-D%s' % defstr)
コード例 #3
0
ファイル: data.py プロジェクト: jrmuizel/mozilla-central-skia
 def get_defines(self):
     for define, value in self.defines.iteritems():
         if value is True:
             yield('-D%s' % define)
         elif value is False:
             yield('-U%s' % define)
         else:
             yield('-D%s=%s' % (define, shell_quote(value)))
コード例 #4
0
 def get_defines(self):
     for define, value in self.defines.iteritems():
         if value is True:
             yield ('-D%s' % define)
         elif value is False:
             yield ('-U%s' % define)
         else:
             yield ('-D%s=%s' % (define, shell_quote(value)))
コード例 #5
0
ファイル: mozmake.py プロジェクト: alibus/gecko-dev-vvuk
  def WriteTargetMakefile(self, output_file, rel_path, qualified_target, spec, build_file, depth):
    configs = spec['configurations']
    # Update global list of link dependencies.
    if spec['type'] in ('static_library', 'shared_library'):
      self.target_link_deps[qualified_target] = "$(call EXPAND_LIBNAME_PATH,%s,$(DEPTH)/%s/%s)" % (striplib(spec['target_name']), self.relative_srcdir, rel_path)

    data = {}
    #TODO: handle actions/rules/copies
    if 'actions' in spec:
      pass
    if 'rules' in spec:
      pass
    if 'copies' in spec:
      pass
    libs = []
    if 'dependencies' in spec:
      for dep in spec['dependencies']:
        if dep in self.target_link_deps:
          libs.append(self.target_link_deps[dep])
    if libs:
      data['EXTRA_LIBS'] = libs

    # Get DEFINES/INCLUDES
    for configname in sorted(configs.keys()):
      config = configs[configname]
      #XXX: this sucks
      defines = config.get('defines')
      if defines:
        data['DEFINES_%s' % configname] = [shell_quote("-D%s" % d) for d in defines]
      includes = []
      for i in config.get('include_dirs', []):
        # Make regular paths into srcdir-relative paths, leave
        # variable-specified paths alone.
        if i.startswith("$(") or os.path.isabs(i):
          if ' ' in i:
            includes.append('"%s"' % i)
          else:
            includes.append(i)
        else:
          includes.append("$(srcdir)/" + i)
      if includes:
        data['INCLUDES_%s' % configname] = ["-I%s" %i for i in includes]
      #XXX: handle mac stuff?
# we want to use our compiler options in general
#      cflags = config.get('cflags')
#      if cflags:
#        data['CPPFLAGS_%s' % configname] = cflags
#      cflags_c = config.get('cflags_c')
#      if cflags_c:
#        data['CFLAGS_%s' % configname] = cflags_c
#      cflags_cc = config.get('cflags_cc')
#      if cflags_cc:
#        data['CXXFLAGS_%s' % configname] = cflags_cc
# we need to keep pkg-config flags however
      cflags_mozilla = config.get('cflags_mozilla')
      if cflags_mozilla:
        data['CPPFLAGS_%s' % configname] = cflags_mozilla
      asflags_mozilla = config.get('asflags_mozilla')
      if asflags_mozilla:
        data['ASFLAGS_%s' % configname] = asflags_mozilla
    sources = {
      'CPPSRCS': {'exts': CPLUSPLUS_EXTENSIONS, 'files': []},
      'CSRCS': {'exts': ['.c'], 'files': []},
      'CMSRCS': {'exts': ['.m'], 'files': []},
      'CMMSRCS': {'exts': ['.mm'], 'files': []},
      'SSRCS': {'exts': AS_EXTENSIONS, 'files': []},
      }
    copy_srcs = []
    for s in spec.get('sources', []):
      if not Compilable(s):
        continue

      # Special-case absolute paths, they'll get copied into the objdir
      # for compiling.
      if os.path.isabs(s):
        # GNU Make falls down pretty badly with spaces in filenames.
        # Conveniently, using a single-character ? as a wildcard
        # works fairly well.
        copy_srcs.append(s.replace(' ', '?'))
        s = os.path.basename(s)

      ext = os.path.splitext(s)[1]
      for source_type, d in sources.iteritems():
        if ext in d['exts']:
          d['files'].append(s)
          break
      
    for source_type, d in sources.iteritems():
      if d['files']:
        data[source_type] = d['files']

    if copy_srcs:
      data['COPY_SRCS'] = copy_srcs

    if spec['type'] == 'executable':
      data['PROGRAM'] = spec['target_name']
    elif spec['type'] == 'static_library':
      data['LIBRARY_NAME'] = striplib(spec['target_name'])
      data['FORCE_STATIC_LIB'] = 1
    elif spec['type'] in ('loadable_module', 'shared_library'):
      data['LIBRARY_NAME'] = striplib(spec['target_name'])
      data['FORCE_SHARED_LIB'] = 1
    else:
      # Maybe nothing?
      return False
    WriteMakefile(output_file, data, build_file, depth, self.topsrcdir,
                  # we set srcdir up one directory, since the subdir
                  # doesn't actually exist in the source directory
                  swapslashes(os.path.normpath(os.path.join(self.topsrcdir, self.relative_srcdir, os.path.split(rel_path)[0]))),
                  self.relative_srcdir,
                  self.common_mk_path)
    return True