#!/bin/env python
import string
import glob
import os
def main():
iter(".")
pass
def iter(dir):
file_items = os.listdir(dir)
for item in file_items:
path = os.path.join(dir, item)
if os.path.isdir(path):
iter(path)
if item == "Makefile" or item[-4:] == ".mak":
file_path = os.path.join(dir, item)
tmp_file_path = os.path.join(dir, "makefile")
command = "sed s/-march=pentium//g " + file_path + " > " + tmp_file_path
os.system(command)
os.rename(tmp_file_path, file_path)
command = "sed s/-march=bf561//g " + file_path + " > " + tmp_file_path
os.system(command)
os.rename(tmp_file_path, file_path)
command = "sed s/-mcpu=pentium/-mcpu=bf561/g " + file_path + " > " + tmp_file_path
os.system(command)
os.rename(tmp_file_path, file_path)
command = "sed s/CC=gcc/CC=bfin-uclinux-gcc/g " + file_path + " > " + tmp_file_path
os.system(command)
os.rename(tmp_file_path, file_path)
command = "sed s/CXX=g++/CXX=bfin-uclinux-g++/g " + file_path + " > " + tmp_file_path
os.system(command)
os.rename(tmp_file_path, file_path)
command = "sed s/RANLIB=ranlib/RANLIB=bfin-uclinux-ranlib/g " + \
file_path + " > " + tmp_file_path
os.system(command)
os.rename(tmp_file_path, file_path)
if __name__ == "__main__":
main()
|