#!/usr/bin/python3
#!/usr/bin/python3 

import os,sys,math
from build.amsbuildlib4 import *

if(len(sys.argv)>=2):
    if(sys.argv[1]=="clean"):
        obj_list = flist('./build_mingw64',recurse=True,exts=['.o'])
        for o in obj_list:
            os.remove('{}'.format(o))
    exit()

os.system('python3 ./build/make.mingw64.lib.py')
os.system('python3 ./build/make.mingw64.test.py')

obj_list = flist('./src',recurse=True,exts=['.o'])
for o in obj_list:
    os.remove('{}'.format(o))

if(sys.platform!="win32"):
    os.chdir('./build_mingw64')
    callproc('wine tests.exe')
    os.chdir('..')
else:
    os.chdir('./build_mingw64')
    callproc('tests.exe')
    os.chdir('..')
