aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2017-05-12 01:58:36 +0200
committerThomas "Cakeisalie5" Touhey <thomas@touhey.fr>2017-05-12 01:58:36 +0200
commit4441a6b19ec45fe76df86a3a8543ba137fe27b02 (patch)
tree9b954a1401eeddb02f3f2ecacf12ad7152221faf
parentbb2ff0bf94695962a7973282698097066c4e1068 (diff)
Starts to build, not quite ready yet.
-rwxr-xr-xMakefile119
-rwxr-xr-xMakefile.msg61
-rwxr-xr-xMakefile.vars68
-rw-r--r--README.md19
-rw-r--r--arch/all/core/include/cdefs/attrs.h2
-rw-r--r--arch/all/core/include/stdarg.h22
-rwxr-xr-xtool/Module.py7
-rwxr-xr-xtool/Toolchain/GNU.py17
-rwxr-xr-xtool/Toolchain/Hitachi.py87
-rwxr-xr-xtool/Toolchain/base.py30
-rwxr-xr-xtool/__main__.py10
11 files changed, 120 insertions, 322 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100755
index 6862193..0000000
--- a/Makefile
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/make -f
-# Include variables and the message subsystem
-include Makefile.vars Makefile.msg
-#******************************************************************************#
-# General targets #
-#******************************************************************************#
-# Build everything.
-all: all-$(T)
-
-# Mostly clean everything. (remove everything but the end results)
-mostlyclean:
- $(call rmsg,Removing object directory.)
- $(call qcmd,$(RM) -r $(OBJDIR))
- mclean: mostlyclean
-
-# Clean everything.
-clean: clean-$(T)
- fclean: clean
-
-# Clean everything, and configuration.
-mrproper: clean-$(T) clean-foreign-libcarrot
-
-# Remake everything. (clean and build)
-re: clean all
-
-.PHONY: all mostlyclean mclean clean fclean mrproper re
-#******************************************************************************#
-# Information getting from the Makefile variables #
-#******************************************************************************#
-# Get the project name.
- getname:
- @echo lib$(LIB_NAME)
-
-# Get the maintainer
- getmaintainer:
- @echo "$(LIB_MAINTAINER_NAME) <$(LIB_MAINTAINER_MAIL)>"
-
-# Get the project version.
- getversion:
- @echo "$(LIB_VERSION)"
-
-.PHONY: getname getmaintainer getversion
-#******************************************************************************#
-# Demo related #
-#******************************************************************************#
-ifneq ($(T),addin)
- demo:
- $(call qcmd,$(MAKE) demo)
- clean-demo:
- $(call qcmd,$(MAKE) demo mrproper)
- re-demo: clean-demo demo
-
-.PHONY: demo clean-demo re-demo
-endif
-#******************************************************************************#
-# Objects-related #
-#******************************************************************************#
-# Make an object directory.
-$(eval $(call make-directory-rules,$(PRE),$(OBJDIR)/))
-$(foreach dr,$(DIRS), \
-$(eval $(call make-directory-rules,$(PRE),$(OBJDIR)/$(dr))))
-
-# Make an object out of a source file.
-$(foreach src,$(basename $(SRC)), \
-$(eval $(call make-obj-rules,$(PRE),$(OBJDIR),$(SRCDIR),$(src))))
-#******************************************************************************#
-# Library-specific targets #
-#******************************************************************************#
-# Make the library.
- all-lib: lib$(LIB_NAME).$(LIB_EXT)
-
-# Make the library.
-$(eval $(call make-archive-rules,$(PRE),lib$(LIB_NAME),$(ALLOBJ)))
-
-# Mostlyclean.
- mostlyclean-lib mclean-lib: mclean
-
-# Clean and remove the built library.
- clean-lib: mclean-lib
- $(call rmsg,Removing the library.)
- $(call qcmd,$(RM) ./lib$(LIB_NAME).a)
-
-# Remake the library.
- re-lib: clean-lib all-lib
-
-.PHONY: all-lib mostlyclean-lib mclean-lib clean-lib re-lib
-#******************************************************************************#
-# Add-in-related targets (mini framework) #
-#******************************************************************************#
-# Make the add-in.
- all-addin: $(PRE)/$(NAME).g1a
-
-# Make the local library.
-ifeq ($(T),addin)
- foreign-libcarrot:
- $(call bmsg,Building lib$(LIB_NAME).)
- $(call qcmd,$(MAKE) . P=. lib$(LIB_NAME).a | sed 's/^/ /')
-
- clean-foreign-libcarrot:
- $(call rmsg,Cleaning lib$(LIB_NAME).)
- $(call qcmd,$(MAKE) . P=. mrproper | sed 's/^/ /')
-else
- clean-foreign-libcarrot:
-endif
-
-# Make the final file.
-$(eval $(call make-bin-rules,$(PRE),$(NAME),$(ALLOBJ),foreign-libcarrot))
-
-# Clean the add-in data
- mostlyclean-addin: mostlyclean
- $(call qcmd,$(RM) $(PRE)/$(NAME).elf $(PRE)/$(NAME).abs $(PRE)/$(NAME).bin)
-
-# Clean the add-in data
- clean-addin: mostlyclean-addin
- $(call qcmd,$(RM) $(PRE)/$(NAME).g1a)
-
-.PHONY: all-addin mostlyclean-addin clean-addin
-.PHONY: foreign-libcarrot clean-foreign-libcarrot
-# End of file.
diff --git a/Makefile.msg b/Makefile.msg
deleted file mode 100755
index 4863607..0000000
--- a/Makefile.msg
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/make -f
-# The Makefile message subsystem.
-# For nice logs. 5 dollars per log only.
-#******************************************************************************#
-# Colors and misc #
-#******************************************************************************#
-# Used colors ANSI modifiers escape codes
- color_green := 32
- color_red := 31
- color_yellow := 33
-
-# Newline - comes handy in some situations
-define \n
-
-
-endef
-
-#******************************************************************************#
-# General messages #
-#******************************************************************************#
-# Command message - display basic info about the command, and run it.
-define cmd
-@$(if $(MAKE_FULL_LOG),,printf "\033[1;""$4""m>\033[0m \033[1m%s\033[0m %s\n" "$1" "$2";)
- $(if $(MAKE_FULL_LOG),,@)$3
-endef
-
-# Quiet command - make it non-quiet if full log is enabled.
-define qcmd
-$(if $(MAKE_FULL_LOG),,@)$1
-endef
-
-# Normal message - display it.
-define msg
-$(if $(MAKE_FULL_LOG),,@printf "\033[1;""$2""m>\033[0m \033[1m%s\033[0m\n" "$1")
-endef
-#******************************************************************************#
-# Commands #
-#******************************************************************************#
-# Build command
-define bcmd
-$(call cmd,$1,$2,$3,$(color_green))
-endef
-#******************************************************************************#
-# Messages #
-#******************************************************************************#
-# Build message
-define bmsg
-$(call msg,$1,$(color_green))
-endef
-
-# Remove message
-define rmsg
-$(call msg,$1,$(color_red))
-endef
-
-# Install message
-define imsg
-$(call msg,$1,$(color_yellow))
-endef
-
-# End of file
diff --git a/Makefile.vars b/Makefile.vars
deleted file mode 100755
index 1fb6c1e..0000000
--- a/Makefile.vars
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/make -f
-#******************************************************************************#
-# Include configuration #
-#******************************************************************************#
--include Makefile.cfg
-
-# Should we build the library, or the add-in?
- T = lib
- PRE = .
- TST = .
-ifndef P
- P = .
-endif
-ifneq ($(P),.)
- T = addin
- PRE = $(P)
-
- P = .
-endif
-#******************************************************************************#
-# Project main information #
-#******************************************************************************#
-# Project name.
- LIB_NAME = carrot
-
-# Maintainer information.
- LIB_MAINTAINER_NAME = Thomas \"Cakeisalie5\" Touhey
- LIB_MAINTAINER_MAIL = thomas@touhey.fr
-
-# Project version.
- LIB_MAJOR = 0
- LIB_MINOR = 1
- LIB_INDEV = yes
-
-# Project version string.
- LIB_VERSION = $(MAJOR).$(MINOR)$(if $(INDEV),-indev)
-#******************************************************************************#
-# Project directories #
-#******************************************************************************#
-# Headers directory - where all the headers are.
- INCDIR = $(PRE)/include
- INCDIRS = $(CURDIR)/include
-ifeq ($(T),addin)
- INCDIRS += $(INCDIR)
-endif
-
-# Sources directory - where all the sources are.
- SRCDIR = src
-
-# Objects directory - where the objects will be put.
- OBJDIR = obj
-#******************************************************************************#
-# Look for sources and includes #
-#******************************************************************************#
-# Include platform-specific things.
-include build/gcc.mk
-
-# Look up the sources
- SRC := $(foreach ext,$(SOURCE_EXT), \
- $(wildcard $(PRE)/$(SRCDIR)/*.$(ext) $(PRE)/$(SRCDIR)/**/*.$(ext)))
- SRC := $(SRC:$(PRE)/$(SRCDIR)/%=%)
- DIRS := $(sort $(dir $(SRC)))
- ALLOBJ := $(SRC:%=$(OBJDIR)/%.o)
-
-# Look up the includes
- INC := $(shell find $(INCDIRS) -mindepth 1 -name "*.h")
- INCXX := $(shell find $(INCDIRS) -mindepth 1 -name "*.hpp") $(INC)
-# End of file.
diff --git a/README.md b/README.md
index ffc686b..15d4e4a 100644
--- a/README.md
+++ b/README.md
@@ -10,5 +10,20 @@ with compatibility with several compilers such as Hitachi/Renesas' C/C++
compiler (SHC) and the GNU Compiler Collection (GCC).
## Requirements
-You will need Python 3.x to run the build tool. Other dependencies are
-optional, and will be tipped off by this tool.
+You will need Python 3.x to run the build tool, with the following modules
+(you should install them using `pip`):
+- `PyYAML` (YAML file parser).
+
+Other dependencies are optional, and will be tipped off by this tool.
+Here are the toolchains you can use:
+- the GNU toolchain: `sh3eb-elf-gcc`, `sh3eb-elf-as`, `sh3eb-elf-as`;
+- the Renesas toolchain: `shc.exe`, `asmsh.exe`, `LnkSpawn.exe`.
+
+## Building
+Build using the Python 3.x script:
+
+ python3 tool
+
+Use the `--tools` option to use a specific toolchain, such as `gnu` or
+`hitachi`. You can use the `--tooldir <DIR>` option to tell it where the
+toolchain is.
diff --git a/arch/all/core/include/cdefs/attrs.h b/arch/all/core/include/cdefs/attrs.h
index bbef882..32f904b 100644
--- a/arch/all/core/include/cdefs/attrs.h
+++ b/arch/all/core/include/cdefs/attrs.h
@@ -37,6 +37,8 @@
# define __THROW throw()
# elif defined(__GNUC__)
# define __THROW __attribute__((nothrow))
+# else
+# define __THROW
# endif
/* ************************************************************************** */
/* __align: align data */
diff --git a/arch/all/core/include/stdarg.h b/arch/all/core/include/stdarg.h
index 6e1025c..74b33cc 100644
--- a/arch/all/core/include/stdarg.h
+++ b/arch/all/core/include/stdarg.h
@@ -37,21 +37,21 @@ __BEGIN_DECLS
# if defined(__HITACHI__)
typedef char *va_list;
+/* (get the 4-aligned address) */
+# define __va_ceil(_ADDR) \
+ (va_list)(((__uintptr_t)(_ADDR) & ~3) + ((__uintptr_t)(_ADDR) & 3) ? 4 : 0)
+# define __va_floor(_ADDR) \
+ (va_list)((__uintptr_t)(_ADDR) & ~3)
+
/* Open and close a variable argument list. */
-# define va_start(_AP, _PARAM) (void)((_AP) = (int)( \
- ((char*)&(_PARAM) + sizeof(_PARAM)) % 4u \
- ? ((char*)&(_PARAM) + sizeof(_PARAM) + (4u - sizeof(_PARAM) % 4u)) \
- : ((char*)&(_PARAM) + sizeof(_PARAM))))
+# define va_start(_AP, _PARAM) \
+ (void)(_AP = __va_ceil((char*)&_PARAM + sizeof(_PARAM)))
# define va_end(_AP)
/* Obtain an argument from the variable argument list. */
-# define va_arg(_AP, _TYPE) (*((_AP) = ((int)( \
- ((_AP) + sizeof(_TYPE)) % 4u \
- ? (_AP) + sizeof(_TYPE) + (4u - (sizeof(_TYPE) % 4u)) \
- : (_AP) + sizeof(_TYPE)), \
- ((_AP) + sizeof(_TYPE)) % 4u \
- ? (_AP) - sizeof(_TYPE) - (4u - (sizeof(_TYPE) % 4u)) \
- : (_AP) - sizeof(_TYPE))))
+# define va_arg(_AP, _TYPE) \
+ (_TYPE)(*(_AP = __va_ceil(_AP + sizeof(_TYPE)), \
+ __va_floor(_AP - sizeof(_TYPE))))
/* Copy a variable argument list. */
# define __va_copy(_D, _S) _D = _S
diff --git a/tool/Module.py b/tool/Module.py
index c731477..05de45a 100755
--- a/tool/Module.py
+++ b/tool/Module.py
@@ -12,12 +12,15 @@ class SourceModule:
`default` is the default dependencies for languages. '''
def __init__(self, root, name, default={}):
''' Initialize the class, gather the information from the FS. '''
- configpath = os.path.join(root, *name.split('/'), 'config.yml')
+ nameparts = name.split('/') + ['config.yml']
+ configpath = os.path.join(root, *nameparts)
config = yaml.load(open(configpath).read())
# Get the meta information.
self.root = root
self.name = name
+ nameparts = name.split('/')
+ self.__root = os.path.join(self.root, *nameparts)
self.description = config['description']
self.arch = config['arch'] if 'arch' in config else []
self.deps = config['deps'] if 'deps' in config else []
@@ -39,7 +42,7 @@ class SourceModule:
def getpath(self, *elements):
''' Get the complete path of a subdirectory. '''
- return os.path.join(self.root, self.name, *elements)
+ return os.path.join(self.__root, *elements)
def getfiles(self, directory, extensions):
''' Get the files list. '''
diff --git a/tool/Toolchain/GNU.py b/tool/Toolchain/GNU.py
index 25c5d3a..037e612 100755
--- a/tool/Toolchain/GNU.py
+++ b/tool/Toolchain/GNU.py
@@ -23,7 +23,13 @@ class GNUToolchain(Toolchain):
def __init__(self, *args, **kwargs):
''' Initialize the toolchain. '''
- super(GNUToolchain, self).__init__(*args, *kwargs)
+ super(GNUToolchain, self).__init__(*args, **kwargs)
+
+ # Check if the binaries exist
+ self.getutil({
+ 'gcc': ['sh3eb-elf-gcc', 'sh3eb-elf-gcc.exe'],
+ 'as': ['sh3eb-elf-as', 'sh3eb-elf-as.exe'],
+ 'ar': ['sh3eb-elf-ar', 'sh3eb-elf-ar.exe']})
# Get the arch flags.
arch = self.arch
@@ -39,12 +45,6 @@ class GNUToolchain(Toolchain):
# C/C++ warning flags
self.__cwarn = ['-Wall', '-Wextra', '-Wno-attributes', '-pedantic']
- # Check if the binaries exist
- self.getutil({
- 'gcc': ['sh3eb-elf-gcc'],
- 'as': ['sh3eb-elf-as'],
- 'ar': ['sh3eb-elf-ar']})
-
def direct__cc(self, obj, src, incdirs, std):
commandline = [self.util['gcc']]
commandline += ['-x', 'c', '-std=' + std]
@@ -98,6 +98,7 @@ class GNUToolchain(Toolchain):
def direct__pack(self, lib, objs):
commandline = [self.util['ar']]
- commandline += ['rcs', lib, *objs]
+ commandline += ['rcs', lib]
+ commandline += list(objs)
return call(commandline)
diff --git a/tool/Toolchain/Hitachi.py b/tool/Toolchain/Hitachi.py
index 649cada..0499015 100755
--- a/tool/Toolchain/Hitachi.py
+++ b/tool/Toolchain/Hitachi.py
@@ -1,12 +1,11 @@
#!/usr/bin/env python3
''' Renesas/Hitachi toolchain. '''
-import os
+import os, tempfile
from subprocess import call
-from tempfile import mkstemp
from .base import Toolchain
-class HitachiToolchain():
+class HitachiToolchain(Toolchain):
arches = ['sh1', 'sh2', 'sh2e', 'sh2a', 'sh2afpu', 'sh2dsp', 'sh3',
'sh3dsp', 'sh4', 'sh4a', 'sh4aldsp']
c_standards = ['c89']
@@ -20,17 +19,9 @@ class HitachiToolchain():
'asm': ['src']
}
- def __init_toolchain(self, arch, cstd='c89'):
+ def __init__(self, *args, **kwargs):
''' Initialize the toolchain. '''
-
- # Check if the arch is supported
- arches = ['sh1', 'sh2', 'sh2e', 'sh2a', 'sh2afpu', 'sh2dsp', 'sh3',
- 'sh3dsp', 'sh4', 'sh4a', 'sh4aldsp']
- if not arch in arches:
- raise Exception
- self.__cpu = ['-cpu=%s'%arch, '-endian=big']
- if arch[-3:] == 'dsp':
- self.__cpu.append('-dspc')
+ super(HitachiToolchain, self).__init__(*args, **kwargs)
# Check if the binaries exist
self.getutil({
@@ -38,13 +29,17 @@ class HitachiToolchain():
'asmsh': ['asmsh.exe'],
'lnk': ['LnkSpawn.exe']})
- def direct__cc(self, obj, src, incdirs=[]):
+ # Get the arch flags
+ self.__CPU = self.arch.upper()
+ self.__cpu = ['-cpu=%s'%(self.arch), '-endian=big']
+ if self.arch[-3:] == 'dsp': self.__cpu.append('-dspc')
+
+ def direct__cc(self, obj, src, incdirs, std):
# Make the temporary thing with all of the subcommands.
- tmpinfo = mkstemp()
- tmp = os.fdopen(tmpinfo[0])
- print(src, self.__cpu, '-lang=c', sep='\n', file=tmp)
- if incdirs:
- print('-include="'+'","'.join(incdirs)+'"', file=tmp)
+ tmpinfo = tempfile.mkstemp()
+ tmp = os.fdopen(tmpinfo[0], mode='w')
+ print(src, *self.__cpu, sep='\n', file=tmp)
+ print('-lang=c', sep='\n', file=tmp)
print('-size', '-gbr=auto', '-noinline', '-chgincpath', '-errorpath',
'-nologo', '-debug', sep='\n', file=tmp)
tmp.close()
@@ -53,57 +48,77 @@ class HitachiToolchain():
commandline = [self.util['shc']]
commandline += ['-subcommand=' + tmpinfo[1]]
+ # Edit the environment.
+ env = os.environ.copy()
+ env['SHCPU'] = self.__CPU
+ env['SHC_LIB'] = os.path.dirname(self.util['shc'])
+ env['SHC_INC'] = os.pathsep.join(incdirs)
+ env['SHC_TMP'] = tempfile.gettempdir()
+
# Open the subprocess
- ret = call(commandline)
+ ret = call(commandline, env=env)
os.remove(tmpinfo[1])
return ret
def direct__cxx(self, obj, src, incdirs=[]):
# Make the temporary thing with all of the subcommands.
- tmpinfo = mkstemp()
- tmp = os.fdopen(tmpinfo[1])
- print(src, self.__cpu, '-lang=cpp', sep='\n', file=tmp)
- if incdirs:
- print('-include="'+'","'.join(incdirs)+'"', file=tmp)
+ tmpinfo = tempfile.mkstemp()
+ tmp = os.fdopen(tmpinfo[0], mode='w')
+ print(src, *self.__cpu, sep='\n', file=tmp)
+ print('-lang=cpp', sep='\n', file=tmp)
print('-size', '-noinline', '-chgincpath', '-errorpath',
'-nologo', '-debug', sep='\n', file=tmp)
tmp.close()
+ # Edit the environment.
+ env = os.environ.copy()
+ env['SHCPU'] = self.__CPU
+ env['SHC_LIB'] = os.path.dirname(self.util['shc'])
+ env['SHC_INC'] = os.pathsep.join(incdirs)
+ env['SHC_TMP'] = tempfile.gettempdir()
+
# Make the command line.
commandline = [self.util['shc']]
commandline += ['-subcommand=' + tmpinfo[1]]
# Open the subprocess
- ret = call(commandline)
+ ret = call(commandline, env=env)
os.remove(tmpinfo[1])
return ret
- def direct__asm(self, obj, src):
+ def direct__asm(self, obj, src, incdirs):
# Make the temporary thing with all of the subcommands.
- tmpinfo = mkstemp()
- tmp = os.fdopen(tmpinfo[1])
- print(src, self.__cpu, '-object="%s"'%obj,
- '-round=zero', '-denormalize=off', '-nodebug',
- '-literal=pool,branch,jump,return', '-nolist',
+ tmpinfo = tempfile.mkstemp()
+ tmp = os.fdopen(tmpinfo[0], mode='w')
+ print(src, *self.__cpu, sep='\n', file=tmp)
+ print('-object="%s"'%obj, '-round=zero', '-denormalize=off',
+ '-nodebug', '-literal=pool,branch,jump,return', '-nolist',
'-nologo', '-chgincpath', '-errorpath', sep='\n', file=tmp)
tmp.close()
+ # Edit the environment.
+ env = os.environ.copy()
+ env['SHCPU'] = self.__CPU
+ env['SHC_LIB'] = os.path.dirname(self.util['asmsh'])
+ env['SHC_INC'] = os.pathsep.join(incdirs)
+ env['SHC_TMP'] = tempfile.gettempdir()
+
# Make the command line.
commandline = [self.util['asmsh']]
commandline += ['-subcommand=' + tmpinfo[1]]
# Open the subprocess
- ret = call(commandline)
+ ret = call(commandline, env=env)
os.remove(tmpinfo[1])
return ret
def direct__pack(self, lib, objs):
# Make the temporary thing with all of the subcommands.
- tmpinfo = mkstemp()
+ tmpinfo = tempfile.mkstemp()
tmp = os.fdopen(tmpinfo[1])
print('noprelink', 'form', 'library', 'nomessage', 'nologo',
- *map(lambda x:'-input="%s"'%x, objs), 'output "%s"'%lib,
- '-exit', sep='\n', file=tmp)
+ 'output "%s"'%lib, '-exit',
+ *map(lambda x:'-input="%s"'%x, objs), sep='\n', file=tmp)
tmp.close()
# Make the command line.
diff --git a/tool/Toolchain/base.py b/tool/Toolchain/base.py
index 27b11aa..0784dc8 100755
--- a/tool/Toolchain/base.py
+++ b/tool/Toolchain/base.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
''' Toolchain base class. '''
-import os
+import os, traceback
class Toolchain():
arches = []
@@ -43,22 +43,32 @@ class Toolchain():
if not std in self.c_standards:
return 1
try: return self.direct__cc(obj, src, incdirs, std)
- except: return 1
+ except Exception:
+ traceback.print_exc()
+ return 1
def cxx(self, obj, src, incdirs=[], std='c++98'):
if not std in self.cxx_standards:
return 1
try: return self.direct__cxx(obj, src, incdirs, std)
- except: return 1
+ except Exception:
+ traceback.print_exc()
+ return 1
def asmc(self, obj, src, incdirs=[]):
- try: self.direct__asmc(obj, src, incdirs)
- except: return 1
+ try: return self.direct__asmc(obj, src, incdirs)
+ except Exception:
+ traceback.print_exc()
+ return 1
- def asm(self, obj, src):
- try: self.direct__asmc(obj, src)
- except: return 1
+ def asm(self, obj, src, incdirs=[]):
+ try: return self.direct__asm(obj, src, incdirs)
+ except Exception:
+ traceback.print_exc()
+ return 1
def pack(self, lib, objs):
- try: self.direct__pack(lib, objs)
- except: return 1
+ try: return self.direct__pack(lib, objs)
+ except Exception:
+ traceback.print_exc()
+ return 1
diff --git a/tool/__main__.py b/tool/__main__.py
index 027ac82..4dfc976 100755
--- a/tool/__main__.py
+++ b/tool/__main__.py
@@ -55,7 +55,7 @@ if __name__ == '__main__':
exit(0)
# Make the commands.
- toolchain = get_toolchain('gnu', args.arch, args.tooldir)
+ toolchain = get_toolchain(args.toolchain, args.arch, args.tooldir)
ext = {
'cc': toolchain.lang['cc'] if 'cc' in toolchain.lang else [],
'cxx': toolchain.lang['cxx'] if 'cxx' in toolchain.lang else [],
@@ -69,7 +69,7 @@ if __name__ == '__main__':
print('No modules, check that your config is correct.')
exit(1)
- for name, module in modules.items():
+ for name, module in map(lambda x:(x, modules[x]), sorted(modules)):
# C files
for source in module.getfiles('src', ext['cc']):
objpath = module.getpath('obj', source + '.o')
@@ -172,9 +172,9 @@ if __name__ == '__main__':
# Get the objects.
objs = []
for name, module in modules.items():
- objs += [*map(lambda x:module.getpath('obj', x + '.o'),
- module.getfiles('src',
- ext['cc'] + ext['cxx'] + ext['asmc'] + ext['asm']))]
+ objs += list(map(lambda x:module.getpath('obj', x + '.o'),
+ module.getfiles('src', ext['cc'] + ext['cxx'] + ext['asmc']
+ + ext['asm'])))
# Make the library.
print('AR %s'%'libcarrot.' + toolchain.lib_ext)