/usr/share/pyshared/adios/skel_makefile.py is in libadios-dev 1.5.0-1ubuntu7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | #!/usr/bin/env python
# from __future__ import absolute_import, division, print_function, unicode_literals
from __future__ import print_function
import argparse
import os
import sys
import adios
import skelconf
import skel_settings
def generate_makefiles (params, config):
lang = config.get_host_language()
if "C" == lang or "c" == lang:
generate_makefiles_c (params)
else:
generate_makefiles_fortran (params)
def generate_makefiles_fortran (params):
platform = params.get_target()
settings = skel_settings.skel_settings()
makefile = open ('Makefile', 'w')
# Makefile generation no longer depends on the target, just using default here.
#makefile_template_name = '~/.skel/templates/Makefile.' + platform + '.tpl'
makefile_template_name = '~/.skel/templates/Makefile.default.tpl'
makefile_template = open(os.path.expanduser(makefile_template_name), 'r')
include_statement = '/etc/adios/skel/compiler_fragment.mk'
for template_line in makefile_template:
# Fill in any replacement vars in this line...
template_line = template_line.replace ('$$APP$$', params.get_application () )
template_line = template_line.replace ('$$INCLUDE$$', include_statement)
template_line = template_line.replace ('$$TARGET$$', platform)
template_line = template_line.replace ('$$DEPLOY_DIR$$', settings.get_deploy_dir())
template_line = template_line.replace ('$$CORES_USED$$', '%d'%params.get_batches()[0].get_cores())
if '$$CTESTS$$' in template_line:
template_line = template_line.replace ('$$CTESTS$$', '')
if '$$FTESTS$$' in template_line:
test_string = ''
test_set = set()
for batch in params.get_batches():
for test in batch.get_tests():
test_set.add (params.get_application() + '_skel_' + test.get_group_name() + '_' + test.get_type() + ' ')
for t in test_set:
test_string = test_string + t
template_line = template_line.replace ('$$FTESTS$$', test_string)
makefile.write (template_line)
def generate_makefiles_c (params):
platform = params.get_target()
settings = skel_settings.skel_settings()
makefile = open ('Makefile', 'w')
# Makefile generation no longer depends on the target, just using default here.
#makefile_template_name = os.path.dirname (sys.argv[0]) + '/../etc/skel/templates/Makefile.' + platform + '.tpl'
makefile_template_name = '/etc/adios/skel/templates/Makefile.default.tpl'
makefile_template = open(os.path.expanduser(makefile_template_name), 'r')
include_statement = "" + '/etc/adios/skel/compiler_fragment.mk'
for template_line in makefile_template:
# Fill in any replacement vars in this line...
template_line = template_line.replace ('$$APP$$', params.get_application () )
template_line = template_line.replace ('$$INCLUDE$$', include_statement)
template_line = template_line.replace ('$$TARGET$$', platform)
template_line = template_line.replace ('$$DEPLOY_DIR$$', settings.get_deploy_dir())
template_line = template_line.replace ('$$CORES_USED$$', '%d'%params.get_batches()[0].get_cores())
if '$$FTESTS$$' in template_line:
template_line = template_line.replace ('$$FTESTS$$', '')
if '$$CTESTS$$' in template_line:
test_string = ''
test_set = set()
for batch in params.get_batches():
for test in batch.get_tests():
test_set.add (params.get_application() + '_skel_' + test.get_group_name() + '_' + test.get_type() + ' ')
for t in test_set:
test_string = test_string + t
template_line = template_line.replace ('$$CTESTS$$', test_string)
makefile.write (template_line)
def parse_command_line():
parser = argparse.ArgumentParser (description='Create a Makefile for the given skel project')
parser.add_argument ('project', metavar='project', help='Name of the skel project')
return parser.parse_args()
def main(argv=None):
skel_settings.create_settings_dir_if_needed()
args = parse_command_line()
config = adios.adiosConfig (args.project + '_skel.xml')
params = skelconf.skelConfig (args.project + '_params.xml')
lang = config.get_host_language ()
if 'c' == lang or 'C' == lang:
print('generating C flavored Makefile')
generate_makefiles_c (params)
else:
print('generating fortran flavored Makefile')
generate_makefiles_fortran (params)
if __name__ == "__main__":
main()
|