Alex Chi avatar Alex Chi committed 55b85bc

[TASK] add new enum about os type, like x86-32, x86-64, arm
[ERR] doesn't work about include dependancy files
[ERR] can't mkdir/remove the output path

Comments (0)

Files changed (4)

naclautomake/common.py

     '''
     return type('Enum', (), enums)
 
-EToolChain = Enum(NEWLIB = 'newlib', GLIBC = 'glibc', ARM = 'arm', PNACL = 'pnacl')
+EToolChain = Enum(NEWLIB = 'newlib', GLIBC = 'glibc', PNACL = 'pnacl')
+EOSType = Enum(X86_32 = 'x86_32', X86_64 = 'x86_64', ARM = 'arm')
 EMakeType = Enum(DEBUG = 'debug', PROFILE = 'profile', DEPLOY = 'deploy')
 EProjectType = Enum(SLIB = 'a', DLIB = 'so', NEXE = 'nexe')
 

naclautomake/define.py

         res = '\n'.join([res, 'NEWLIB_LIB?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-ar r'])
         res = '\n'.join([res, 'NEWLIB_CCFLAGS?=-MMD -pthread $(NACL_WARNINGS) -idirafter $(NACL_SDK_ROOT)/include'])
         res = '\n'.join([res, 'NEWLIB_LDFLAGS?=-pthread'])
-        return res
-
-    def mfCompilerArm(self):
-        res = '# ARM compiler'
+        res = '\n'.join([res, ''])
+        res = '\n'.join([res, '# ARM compiler'])
         res = '\n'.join([res, 'ARM_CC?=$(TC_PATH)/$(OSNAME)_arm_newlib/bin/arm-nacl-gcc -c'])
         res = '\n'.join([res, 'ARM_CXX?=$(TC_PATH)/$(OSNAME)_arm_newlib/bin/arm-nacl-g++ -c'])
         res = '\n'.join([res, 'ARM_LINK?=$(TC_PATH)/$(OSNAME)_arm_newlib/bin/arm-nacl-g++ -Wl,-as-needed'])
             res = '\n'.join([res, self.mfCompilerNewLib()])
         if EToolChain.GLIBC in self.__setting__.toolchains:
             res = '\n'.join([res, self.mfCompilerGLibC()])
-        if EToolChain.ARM in self.__setting__.toolchains:
-            res = '\n'.join([res, self.mfCompilerArm()])
         if EToolChain.PNACL in self.__setting__.toolchains:
             res = '\n'.join([res, self.mfCompilerPNaCl()])
         return res

naclautomake/project.py

 @author: Alex Chi
 '''
 from common import EToolChain
+from common import EOSType
 from common import EMakeType
 from common import EProjectType
 from common import UniqueList
         return self.__setting__.outputPath + '/' + self.__name__
 
     def makeoutputdirKey(self, toolchain = '', maketype = ''):
-        res = self.name
+        #res = self.name
+        res = self.outputpath
         if 0 < len(toolchain):
-            res = '-'.join([res, toolchain])
+            res = '/'.join([res, toolchain])
         if 0 < len(maketype):
-            res = '-'.join([res, maketype])
-        return res + '-makeoutputdir'
+            res = '/'.join([res, maketype])
+        return res# + '-makeoutputdir'
 
     def makeoutputdirPath(self, toolchain = '', maketype = ''):
         res = self.outputpath
         return res
 
     def makeoutputdirValue(self, toolchain = '', maketype = ''):
-        return '    $(MKDIR) ' + self.makeoutputdirPath(toolchain, maketype)
+        return '\t$(MKDIR) ' + self.makeoutputdirPath(toolchain, maketype)
 
     def mfMakeOutputDir(self):
         res = '# make output directory'
         res = '# Include header dependency files.'
         for toolchain in self.__setting__.toolchains:
             for maketype in self.__setting__.maketypes:
-                res = '\n'.join([res, '-include ' + self.makeoutputdirPath(toolchain, maketype)])
+                res = '\n'.join([res, '-include ' + self.makeoutputdirPath(toolchain, maketype) + '/*.d'])
         return res
 
-    def nmfKey(self, toolchain, maketype, x86 = ''):
+    def nmfKey(self, toolchain, maketype):
         res = self.makeoutputdirPath(toolchain, maketype)
         res = '/'.join([res, self.name])
-        if 0 < len(x86):
-            res = '_'.join([res, 'x86_' + x86])
         res = '.'.join([res, 'nmf'])
         return res
 
     def nmfValue(self, toolchain, maketype):
-        res = '        $(CREATENMF) -o $@ $^ -s ' + self.makeoutputdirPath(toolchain, maketype)
+        res = '\t$(CREATENMF) -o $@ $^ -s ' + self.makeoutputdirPath(toolchain, maketype)
+        return res
+
+    def mfBuildWithToolChain(self, toolchain):
+        res = '# build ' + self.name + ' with ' + toolchain
+        for maketype in self.__setting__.maketypes:
+            res = '\n'.join([res, ''])
+            res = '\n'.join([res, self.mfBuildWithToolChainAndMakeType(toolchain, maketype)])
         return res
 
-    def mfBuildWithX86(self, x86):
-        res = '# build ' + self.name + ' with x86_' + x86
+    def mfBuildWithToolChainAndMakeType(self, toolchain, maketype):
+        res = '# build ' + self.name + ' with ' + toolchain + '|' + maketype
+        if self.__type__ == EProjectType.NEXE:
+            res = '\n'.join([res, ''])
+            res = '\n'.join([res, self.mfGenerateNMF(toolchain, maketype)])
         return res
 
-    def mfGenerateNMF(self, toolchain, maketype, x86 = ''):
+    def mfGenerateNMF(self, toolchain, maketype):
         res = '# generate nmf file'
-        res = '\n'.join([res, 'ALL_TARGETS+=' + self.nmfKey(toolchain, maketype, x86)])
-        res = '\n'.join([res, self.nmfKey(toolchain, maketype, x86) + ':'])
+        res = '\n'.join([res, 'ALL_TARGETS+=' + self.nmfKey(toolchain, maketype)])
+        res = '\n'.join([res, self.nmfKey(toolchain, maketype) + ': | ' + self.makeoutputdirPath(toolchain, maketype)])
         res = '\n'.join([res, self.nmfValue(toolchain, maketype)])
         return res
 
         res = '\n'.join([res, self.__name__ + ':'])
         for dependname in self.__depends__:
             res = ' '.join([res, dependname])
-        res = '\n'.join([res, self.mfBuildWithX86('32')])
-        if self.__type__ == EProjectType.NEXE:
+        for toolchain in self.__setting__.toolchains:
             res = '\n'.join([res, ''])
-            res = '\n'.join([res, self.mfGenerateNMF(EToolChain.NEWLIB, EMakeType.DEBUG, '32')])
+            res = '\n'.join([res, self.mfBuildWithToolChain(toolchain)])
         return res
 
     def mfClean(self):
         res = '\n'.join([res, self.__name__ + '-clean:'])
         for toolchain in self.__setting__.toolchains:
             for maketype in self.__setting__.maketypes:
-                res = '\n'.join([res, '    $(RM) -fr ' + self.outputpath + '/' + toolchain + '/' + maketype])
-            res = '\n'.join([res, '    $(RM) -fr ' + self.outputpath + '/' + toolchain])
+                res = '\n'.join([res, '\t$(RM) -fr ' + self.outputpath + '/' + toolchain + '/' + maketype])
+            res = '\n'.join([res, '\t$(RM) -fr ' + self.outputpath + '/' + toolchain])
         return res
 
     def makefile(self):

naclautomake/setting.py

 @author: Alex
 '''
 from common import EToolChain
+from common import EOSType
 from common import EMakeType
 from common import UniqueSet
 from makefile import NaClMakefile
     '''
     '''
 
-    def __init__(self, solutionpath, outputpath, naclsdkpath = '', chromepath = '', toolchains = [EToolChain.NEWLIB], maketypes = [EMakeType.DEBUG]):
+    def __init__(self, solutionpath, outputpath
+                 , naclsdkpath = '', chromepath = ''
+                 , toolchains = [EToolChain.NEWLIB]
+                 , ostypes = [EOSType.X86_32, EOSType.X86_64, EOSType.ARM]
+                 , maketypes = [EMakeType.DEBUG]):
         self.__solutionPath__ = solutionpath
         self.__outputPath__ = outputpath
         self.__naclsdkPath__ = naclsdkpath
         self.__chromePath__ = chromepath
         self.__toolchains__ = UniqueSet(toolchains)
+        self.__ostypes__ = UniqueSet(ostypes)
         self.__maketypes__ = UniqueSet(maketypes)
 
     @property
         return self.__toolchains__
 
     @property
+    def ostypes(self):
+        return self.__ostypes__
+
+    @property
     def maketypes(self):
         return self.__maketypes__
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.