aboutsummaryrefslogtreecommitdiffstats
path: root/amalgamate/merge_all.py
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-09-27 20:03:51 +0900
committeripknHama <ipknhama@gmail.com>2014-09-27 20:03:51 +0900
commit3e5e91c4243619d1d118eed332bdcf3a05105296 (patch)
tree0bd57d464f1ec000382fd45c972d0d2426cf0173 /amalgamate/merge_all.py
parentbad75f25b83f4096d1c03d2246b996f332cfc710 (diff)
downloadcrow-3e5e91c4243619d1d118eed332bdcf3a05105296.tar.gz
crow-3e5e91c4243619d1d118eed332bdcf3a05105296.zip
Now amalgamation will be updated automatically.
Diffstat (limited to 'amalgamate/merge_all.py')
-rw-r--r--amalgamate/merge_all.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/amalgamate/merge_all.py b/amalgamate/merge_all.py
index 7935ead..fe7b50f 100644
--- a/amalgamate/merge_all.py
+++ b/amalgamate/merge_all.py
@@ -1,13 +1,20 @@
import glob
+import os
import re
from collections import defaultdict
+import sys
+
+header_path = "../include"
+if len(sys.argv) > 1:
+ header_path = sys.argv[1]
+
OUTPUT = 'crow_all.h'
re_depends = re.compile('^#include "(.*)"', re.MULTILINE)
-headers = [x.rsplit('/',1)[-1] for x in glob.glob('../include/*.h')]
+headers = [x.rsplit('/',1)[-1] for x in glob.glob(os.path.join(header_path,'*.h'))]
print headers
edges = defaultdict(list)
for header in headers:
- d = open("../include/" + header).read().decode('utf8')
+ d = open(os.path.join(header_path, header)).read().decode('utf8')
match = re_depends.findall(d)
for m in match:
# m should included before header
@@ -36,7 +43,7 @@ for x in edges:
print order
build = []
for header in order:
- d = open("../include/" + header).read().decode('utf8')
+ d = open(os.path.join(header_path, header)).read().decode('utf8')
build.append(re_depends.sub(lambda x:'\n', d))
build.append('\n')