diff --git a/Makefile b/Makefile index b0824cf..d461b1d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,11 @@ + +all: code site + + site: python3 site_gen.py -.PHONY: site +code: + python3 code_gen.py + +.PHONY: site code diff --git a/code_gen.py b/code_gen.py new file mode 100755 index 0000000..e69de29 diff --git a/site_gen.py b/site_gen.py index 16cb92a..94c944e 100755 --- a/site_gen.py +++ b/site_gen.py @@ -41,15 +41,16 @@ def path_dict(files): di[x].append(y) return di -prefix = [] -if os.path.exists('PREFIX.md'): - with open('PREFIX.md') as p: - prefix = p.readlines() - -files = sorted([i[2:] for i in get_mds('.') if i != './README' and i != './PREFIX']) - -with open('README.md', 'w') as f: - to_write = mkformat(files) - to_write = [i + '\n' for i in to_write] - to_write = prefix + to_write - f.writelines(to_write) +if __name__=='__main__': + prefix = [] + if os.path.exists('PREFIX.md'): + with open('PREFIX.md') as p: + prefix = p.readlines() + + files = sorted([i[2:] for i in get_mds('.') if i != './README' and i != './PREFIX']) + + with open('README.md', 'w') as f: + to_write = mkformat(files) + to_write = [i + '\n' for i in to_write] + to_write = prefix + to_write + f.writelines(to_write)