Skip to content

Commit 6ec0af7

Browse files
committed
first commit
0 parents  commit 6ec0af7

8 files changed

+912
-0
lines changed

make.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/python
2+
#coding: utf-8
3+
4+
__author__ = "Summer Rain"
5+
6+
from sys import argv
7+
from time import time
8+
from os import path, system, listdir
9+
10+
program = "mteval_sbp.linux"
11+
include_path = "."
12+
src_path = "src"
13+
lib_path = "."
14+
15+
compile_flag = "-O3"
16+
link_flag = ""
17+
lib_flag = ""
18+
19+
if __name__ == "__main__":
20+
files = [fe for fe in listdir(src_path) if fe.endswith(".cpp") or fe.endswith(".cc")]
21+
ofes = []
22+
for sfe in files:
23+
#print "compiling %s ..." %(sfe)
24+
print "%s %s %s" %("-" * 20, sfe, "-" * 20)
25+
ofe = "." + sfe.replace(".cpp", ".o").replace(".cc", ".o")
26+
time1 = path.getmtime(src_path + "/" + sfe)
27+
if path.isfile(ofe):
28+
time2 = path.getmtime(ofe)
29+
else:
30+
time2 = time1 - 1
31+
32+
if time1 > time2 or len(argv) == 2 and argv[1] == "clean":
33+
cmd = "g++ -c %s/%s %s -o %s -I%s" %(src_path, sfe, compile_flag, ofe, include_path)
34+
print cmd
35+
if system(cmd) != 0:
36+
exit(1)
37+
else:
38+
print "%s is the newest" %(ofe)
39+
ofes.append(ofe)
40+
if files != []:
41+
print "-" * 40
42+
cmd = "g++ %s -o %s %s %s -L%s" %(" ".join(ofes), program, link_flag, lib_flag, lib_path)
43+
print cmd
44+
system(cmd)

0 commit comments

Comments
 (0)