diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-02-28 16:25:09 +0000 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-02-28 16:25:09 +0000 |
commit | ee6d0649cd87d97c423e8e79a074443a469004bc (patch) | |
tree | b2f8fa2a9061fae85ce45706bef949412e0b9ca0 | |
parent | 70336a3d33198e5eec277f073c33265bf974f8d5 (diff) |
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 <duskcoder@gmail.com>
-rwxr-xr-x | gen_makefile.py | 26 |
1 files changed, 13 insertions, 13 deletions
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)) |