mirror of
https://gitlab.com/scemama/EZFIO.git
synced 2024-12-22 04:13:34 +01:00
commit
52bce849bb
2
Makefile
2
Makefile
@ -28,7 +28,7 @@ include make.config
|
||||
.PHONY: default clean veryclean archive configure
|
||||
|
||||
default: make.config
|
||||
$(MAKE) -C $$PWD/src
|
||||
cd src && $(MAKE)
|
||||
|
||||
clean:
|
||||
- bash -c "[[ -f lib/libezfio.a ]] && rm $$PWD/lib/*"
|
||||
|
@ -6,7 +6,7 @@ rule build_generated_ninja
|
||||
generator = 1
|
||||
|
||||
rule run_ninja
|
||||
command = bash -c 'source make.config ; bash -c "$$NINJA -f $in"'
|
||||
command = bash -c 'source .make.config.sh ; exec bash -c "$$NINJA -f $in"'
|
||||
description = Building Fortran library
|
||||
|
||||
rule build_archive
|
||||
@ -14,11 +14,11 @@ rule build_archive
|
||||
description = Building archive
|
||||
|
||||
rule clean_all
|
||||
command = bash -c 'source make.config ; bash -c "$$NINJA -f $in -t clean ; $$NINJA -t clean" ; rm -rf src/IRPF90_{temp,man} src/*.pyc'
|
||||
command = bash -c 'source .make.config.sh ; bash -c "$$NINJA -f $in -t clean ; $$NINJA -t clean" ; rm -rf src/IRPF90_{temp,man} src/*.pyc'
|
||||
description = Cleaning directory
|
||||
|
||||
|
||||
build make.config generated.ninja: build_generated_ninja configure.py
|
||||
build make.config .make.config.sh generated.ninja: build_generated_ninja configure.py
|
||||
|
||||
build all: run_ninja generated.ninja
|
||||
default all
|
||||
|
27
configure.py
27
configure.py
@ -19,18 +19,16 @@ d_default = {
|
||||
|
||||
def create_make_config():
|
||||
|
||||
if sys.argv[-1] == 'ninja':
|
||||
fmt = '{0}="{1}"\n'
|
||||
else:
|
||||
fmt = '{0}={1}\n'
|
||||
|
||||
with open("make.config",'w') as out:
|
||||
for var,default in d_default.iteritems():
|
||||
try:
|
||||
cur = os.environ[var]
|
||||
except KeyError:
|
||||
cur = default
|
||||
out.write(fmt.format(var,cur))
|
||||
fmt = { "make.config" :'{0}={1}\n' ,
|
||||
".make.config.sh": '{0}="{1}"\n' }
|
||||
for filename in fmt:
|
||||
with open(filename,'w') as out:
|
||||
for var,default in d_default.iteritems():
|
||||
try:
|
||||
cur = os.environ[var]
|
||||
except KeyError:
|
||||
cur = default
|
||||
out.write(fmt[filename].format(var,cur))
|
||||
|
||||
|
||||
def read_make_config():
|
||||
@ -39,8 +37,6 @@ def read_make_config():
|
||||
for line in f.readlines():
|
||||
try:
|
||||
key, value = line.strip().split('=',1)
|
||||
if value.startswith('"') and value.endswith('"'):
|
||||
value = value[1:-1]
|
||||
except:
|
||||
print "Error in make.config:"
|
||||
print line
|
||||
@ -51,8 +47,7 @@ def read_make_config():
|
||||
|
||||
def create_build_ninja():
|
||||
|
||||
if "make.config" not in os.listdir(os.getcwd()):
|
||||
create_make_config()
|
||||
create_make_config()
|
||||
|
||||
d = read_make_config()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user