Commits

Armin Rigo committed 2dd6e75 Merge

merge heads

Comments (0)

Files changed (4)

 
 # General information about the project.
 project = u'PyPy'
-copyright = u'2011, The PyPy Project'
+copyright = u'2013, The PyPy Project'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the

pypy/translator/platform/test/test_distutils.py

 
     def test_nice_errors(self):
         py.test.skip("Unsupported")
+
+    def test_900_files(self):
+        py.test.skip('Makefiles not suppoerted')

pypy/translator/platform/test/test_platform.py

         res = self.platform.execute(executable)
         self.check_res(res)
 
+    def test_900_files(self):
+        txt = '#include <stdio.h>\n'
+        for i in range(900):
+            txt += 'int func%03d();\n' % i
+        txt += 'int main() {\n    int j=0;'    
+        for i in range(900):
+            txt += '    j += func%03d();\n' % i
+        txt += '    printf("%d\\n", j);\n'
+        txt += '    return 0;};\n'
+        cfile = udir.join('test_900_files.c')
+        cfile.write(txt)
+        cfiles = [cfile]
+        for i in range(900):
+            cfile2 = udir.join('implement%03d.c' %i)
+            cfile2.write('''
+                int func%03d()
+            {
+                return %d;
+            }
+            ''' % (i, i))
+            cfiles.append(cfile2)
+        mk = self.platform.gen_makefile(cfiles, ExternalCompilationInfo(), path=udir)
+        mk.write()
+        self.platform.execute_makefile(mk)
+        res = self.platform.execute(udir.join('test_900_files'))
+        self.check_res(res, '%d\n' %sum(range(900)))
+
+
     def test_nice_errors(self):
         cfile = udir.join('test_nice_errors.c')
         cfile.write('')

pypy/translator/platform/windows.py

 
         for rule in rules:
             m.rule(*rule)
-
+        
+        objects = ' $(OBJECTS)'
+        create_obj_response_file = []
+        if len(' '.join(rel_ofiles)) > 4000:
+            # cmd.exe has a limit of ~4000 characters before a command line is too long.
+            # Use a response file instead, at the cost of making the Makefile very ugly.
+            for i in range(len(rel_ofiles) - 1):
+                create_obj_response_file.append('echo %s >> obj_names.rsp' % \
+                                                rel_ofiles[i])
+            # use cmd /c for the last one so that the file is flushed 
+            create_obj_response_file.append('cmd /c echo %s >> obj_names.rsp' % \
+                                            rel_ofiles[-1])
+            objects = ' @obj_names.rsp'
         if self.version < 80:
             m.rule('$(TARGET)', '$(OBJECTS)',
-                   '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA) $(OBJECTS) /out:$@ $(LIBDIRS) $(LIBS)')
+                    create_obj_response_file + [\
+                   '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' /out:$@ $(LIBDIRS) $(LIBS)',
+                   ])
         else:
             m.rule('$(TARGET)', '$(OBJECTS)',
-                   ['$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA) $(OBJECTS) $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS) /MANIFEST /MANIFESTFILE:$*.manifest',
+                    create_obj_response_file + [\
+                    '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS) /MANIFEST /MANIFESTFILE:$*.manifest',
                     'mt.exe -nologo -manifest $*.manifest -outputresource:$@;1',
                     ])
         m.rule('debugmode_$(TARGET)', '$(OBJECTS)',
-               ['$(CC_LINK) /nologo /DEBUG $(LDFLAGS) $(LDFLAGSEXTRA) $(OBJECTS) $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS)',
+                create_obj_response_file + [\
+               '$(CC_LINK) /nologo /DEBUG $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS)',
                 ])
 
         if shared: