Fix the generation of .o from .S

The object rules now have four members, this is getting KLUDGY!

[object, source, type (i.e. suffix), base]


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1006 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Ronald G. Minnich 2003-07-23 03:11:40 +00:00
parent 99d0d7b300
commit 3874d40ad6
1 changed files with 17 additions and 3 deletions

View File

@ -265,6 +265,7 @@ class romimage:
if (suffix == '.o'):
suffix = '.c'
base = object_name[:-2]
type = object_name[-1:]
if (object_name[0] == '.'):
source = base + suffix
else:
@ -274,7 +275,7 @@ class romimage:
l = getdict(dict, base)
if (l):
print "Warning, object/driver %s previously defined" % base
setdict(dict, base, [object, source])
setdict(dict, base, [object, source, type, base])
def addinitobjectrule(self, name):
self.addobjectdriver(self.initobjectrules, name)
@ -1502,6 +1503,19 @@ def writeimagemakefile(image):
file.write("\n# objectrules:\n")
for objrule, obj in image.getobjectrules().items():
source = topify(obj[1])
type = obj[2]
if (type == 'S'):
# for .S, .o depends on .s
file.write("%s: %s.s\n" % (obj[0], obj[3]))
file.write("\t@echo $(CC) ... -o $@ $<\n")
file.write("\t$(CC) -c $(CPU_OPT) -o $@ $<\n")
# and .s depends on .S
file.write("%s.s: %s\n" % (obj[3], source))
file.write("\t@echo $(CPP) ... $< > $@\n")
# Note: next 2 lines are ONE output line!
file.write("\t$(CPP) $(CPPFLAGS) $< ")
file.write(">$@.new && mv $@.new $@\n")
else:
file.write("%s: %s\n" % (obj[0], source))
file.write("\t$(CC) -c $(CFLAGS) -o $@ $<\n")
#file.write("%s\n" % objrule[2])