From ee6d0649cd87d97c423e8e79a074443a469004bc Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 28 Feb 2015 16:25:09 +0000 Subject: fix invalid order of commands using dictionnaries, the order of the commands are not guaranteed since dictionnaries are unordered. Fixec by replacing dictionnaries by lists. Signed-off-by: Olivier Gayot --- gen_makefile.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'gen_makefile.py') diff --git a/gen_makefile.py b/gen_makefile.py index 0940739..3b70af4 100755 --- a/gen_makefile.py +++ b/gen_makefile.py @@ -33,7 +33,7 @@ class makefile_generator(): def append_separator(self): print('') - def append_rule(self, target, dep='', cmds={}): + def append_rule(self, target, dep='', cmds=[]): print('%s: %s' % (target, dep)) for cmd in cmds: @@ -41,7 +41,7 @@ class makefile_generator(): self.append_separator() - def append_static_rule(self, target, dep='', cmds={}): + def append_static_rule(self, target, dep='', cmds=[]): self.append_rule(target, dep, cmds) self.phony.append(target) @@ -68,30 +68,30 @@ class makefile_generator(): self.append_static_rule('all', '$(NAME)') # linkage - self.append_rule('$(NAME)', '$(OBJ)', { + self.append_rule('$(NAME)', '$(OBJ)', [ '$(%s) -o "$@" $^ $(LDFLAGS)' % (self._compiler_var) - }) + ]) # include dependencies print('-include $(DEP)') self.append_separator() # rule to generate dependencies - self.append_rule('%.d', '%%.%s' % (self._extension), { + self.append_rule('%.d', '%%.%s' % (self._extension), [ '$(%s) -MM $(CPPFLAGS) $(%s) $< -MF $@ -MT "$*.o $@"' % (self._compiler_var, self._compiler_flags_var), - }) + ]) - self.append_static_rule('clean', cmds={ + self.append_static_rule('clean', cmds=[ '$(RM) $(OBJ)', '$(RM) $(NAME)', - }) - self.append_static_rule('mrproper', 'clean', { + ]) + self.append_static_rule('mrproper', 'clean', [ '$(RM) $(DEP)', - }) - self.append_static_rule('distclean', 'mrproper', { - '$(RM) $(addsuffix ~,$(SRC))' - }) + ]) + self.append_static_rule('distclean', 'mrproper', [ + '$(RM) $(addsuffix ~,$(SRC))', + ]) # phony rule self.append_rule('.PHONY', ' '.join(self.phony)) -- cgit v1.2.3