mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 11:53:32 +01:00
Improved makefile
Version:1.1.50
This commit is contained in:
parent
c5ce9e88fd
commit
ed77fd8bde
@ -78,6 +78,11 @@ def run():
|
|||||||
result += " %s%s.irp.o"%(irpdir,m.name[:-4])
|
result += " %s%s.irp.o"%(irpdir,m.name[:-4])
|
||||||
print >>file, result
|
print >>file, result
|
||||||
|
|
||||||
|
result = "MODULES += %sirp_stack.irp.module"%(irpdir)
|
||||||
|
for m in mod:
|
||||||
|
result += " %s%s.irp.module"%(irpdir,m.name[:-4])
|
||||||
|
print >>file, result
|
||||||
|
|
||||||
print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ))) %sirp_touches.irp.o"%(irpdir,irpdir)
|
print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ))) %sirp_touches.irp.o"%(irpdir,irpdir)
|
||||||
|
|
||||||
all = filter(lambda x: modules[x].is_main, modules)
|
all = filter(lambda x: modules[x].is_main, modules)
|
||||||
@ -87,14 +92,11 @@ def run():
|
|||||||
print >>file, "ALL_OBJ = %s"%(" ".join(all_o))
|
print >>file, "ALL_OBJ = %s"%(" ".join(all_o))
|
||||||
print >>file, "ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir)
|
print >>file, "ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir)
|
||||||
print >>file, "all:$(ALL)"
|
print >>file, "all:$(ALL)"
|
||||||
print >>file, "\t@make -s move"
|
|
||||||
for m in mod:
|
for m in mod:
|
||||||
if m.is_main:
|
if m.is_main:
|
||||||
exe = m.name[:-4]
|
exe = m.name[:-4]
|
||||||
print >>file, "%s: %s%s.irp.o $(OBJ1)"%(exe,irpdir,exe)
|
print >>file, "%s: %s%s.irp.o $(OBJ1)"%(exe,irpdir,exe)
|
||||||
print >>file, "\t@echo Linking %s"%(exe)
|
print >>file, "\t$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir)
|
||||||
print >>file, "\t@$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir)
|
|
||||||
print >>file, "\t@make -s move"
|
|
||||||
|
|
||||||
buffer = ""
|
buffer = ""
|
||||||
for m in mod:
|
for m in mod:
|
||||||
@ -102,7 +104,7 @@ def run():
|
|||||||
mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules)
|
mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules)
|
||||||
print >>file, filename+" ".join(mds)
|
print >>file, filename+" ".join(mds)
|
||||||
for m in mod:
|
for m in mod:
|
||||||
filename = "%s%s.irp.o:"%(irpdir,m.name[:-4])
|
filename = "%s%s.irp.o: %s%s.irp.F90 %s%s.irp.module"%(irpdir,m.name[:-4],irpdir,m.name[:-4],irpdir,m.name[:-4])
|
||||||
mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules)
|
mds = map (lambda x: " %s%s.irp.module"%(irpdir,x[:-4]),m.needed_modules)
|
||||||
print >>file, filename+" ".join(mds)
|
print >>file, filename+" ".join(mds)
|
||||||
if not m.is_main:
|
if not m.is_main:
|
||||||
@ -111,10 +113,10 @@ def run():
|
|||||||
mds = filter(lambda x: not x.is_main,mod)
|
mds = filter(lambda x: not x.is_main,mod)
|
||||||
mds = map(lambda x: " %s%s.irp.module"%(irpdir,x.name[:-4]),mds)
|
mds = map(lambda x: " %s%s.irp.module"%(irpdir,x.name[:-4]),mds)
|
||||||
print >>file," ".join(mds)
|
print >>file," ".join(mds)
|
||||||
print >>file, "%sirp_touches.irp.o:"%(irpdir),
|
# print >>file, "%sirp_touches.irp.o:"%(irpdir),
|
||||||
mds = filter(lambda x: not x.is_main,mod)
|
# mds = filter(lambda x: not x.is_main,mod)
|
||||||
mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds)
|
# mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds)
|
||||||
print >>file," ".join(mds)
|
# print >>file," ".join(mds)
|
||||||
|
|
||||||
|
|
||||||
print >>file, "%sdist_Makefile:"%(irpdir)
|
print >>file, "%sdist_Makefile:"%(irpdir)
|
||||||
@ -145,22 +147,20 @@ def run():
|
|||||||
print >>file, "\t- cd dist ; tar -zcvf ../$*.tar.gz $*\n"
|
print >>file, "\t- cd dist ; tar -zcvf ../$*.tar.gz $*\n"
|
||||||
|
|
||||||
print >>file, irpdir+"%.irp.module: "+irpdir+"%.irp.F90"
|
print >>file, irpdir+"%.irp.module: "+irpdir+"%.irp.F90"
|
||||||
print >>file, "\t@echo Creating $* module"
|
print >>file, "\t$(FC) -O0 -c "+irpdir+"$*.irp.F90 -o /dev/null && \\"
|
||||||
print >>file, "\t@$(FC) -O0 -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o"
|
print >>file, "\ttouch "+irpdir+"$*.irp.module"
|
||||||
print >>file, "\t@rm "+irpdir+"$*.irp.o"
|
print >>file, irpdir+"%.irp.o: IRPF90_temp/%.irp.F90 IRPF90_temp/modules"
|
||||||
print >>file, "\t@touch "+irpdir+"$*.irp.module"
|
print >>file, "\t$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o"
|
||||||
print >>file, irpdir+"%.irp.o: "+irpdir+"%.irp.module"
|
|
||||||
print >>file, "\t@echo Compiling $*"
|
|
||||||
print >>file, "\t@$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o"
|
|
||||||
print >>file, irpdir+"%.o: %.F90"
|
print >>file, irpdir+"%.o: %.F90"
|
||||||
print >>file, "\t@echo Compiling $*"
|
print >>file, "\t$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o"
|
||||||
print >>file, "\t@$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o"
|
|
||||||
print >>file, irpdir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+irpdir+"$*.o"
|
print >>file, irpdir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+irpdir+"$*.o"
|
||||||
print >>file, irpdir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+irpdir+"$*.o"
|
print >>file, irpdir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+irpdir+"$*.o"
|
||||||
print >>file, irpdir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+irpdir+"$*.o"
|
print >>file, irpdir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+irpdir+"$*.o"
|
||||||
print >>file, irpdir+"%.irp.F90: irpf90.make\n"
|
print >>file, irpdir+"%.irp.F90: irpf90.make\n"
|
||||||
print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n\t@touch IRPF90_temp/*\n"
|
print >>file, "modules: IRPF90_temp/modules"
|
||||||
print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL)\n"
|
print >>file, "IRPF90_temp/modules: $(MODULES)"
|
||||||
|
print >>file, "\ttouch IRPF90_temp/modules"
|
||||||
|
print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL) $(MODULES) IRPF90_temp/modules\n"
|
||||||
print >>file, "veryclean:\n\t- make clean\n"
|
print >>file, "veryclean:\n\t- make clean\n"
|
||||||
print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n"
|
print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n"
|
||||||
|
|
||||||
|
@ -42,14 +42,15 @@ def find_variables_in_line(line):
|
|||||||
assert isinstance(line,Line)
|
assert isinstance(line,Line)
|
||||||
result = []
|
result = []
|
||||||
sub_done = False
|
sub_done = False
|
||||||
buffer = line.text.lower()
|
buffer = line.lower
|
||||||
|
ap = result.append
|
||||||
for v,same_as,regexp in vtuple:
|
for v,same_as,regexp in vtuple:
|
||||||
if v in buffer:
|
if v in buffer:
|
||||||
if not sub_done:
|
if not sub_done:
|
||||||
buffer = regexps_re_string_sub('',buffer)
|
buffer = regexps_re_string_sub('',buffer)
|
||||||
sub_done = True
|
sub_done = True
|
||||||
if regexp.search(buffer) is not None:
|
if regexp.search(buffer) is not None:
|
||||||
result.append(same_as)
|
ap(same_as)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def find_funcs_in_line(line):
|
def find_funcs_in_line(line):
|
||||||
@ -57,7 +58,7 @@ def find_funcs_in_line(line):
|
|||||||
result = []
|
result = []
|
||||||
append = result.append
|
append = result.append
|
||||||
sub_done = False
|
sub_done = False
|
||||||
buffer = line.text.lower()
|
buffer = line.lower
|
||||||
for s,regexp in stuple:
|
for s,regexp in stuple:
|
||||||
if s in buffer:
|
if s in buffer:
|
||||||
if regexp.search(buffer) is not None:
|
if regexp.search(buffer) is not None:
|
||||||
@ -118,7 +119,7 @@ def get_parsed_text():
|
|||||||
varlist = []
|
varlist = []
|
||||||
append( ([],line) )
|
append( ([],line) )
|
||||||
elif isinstance(line,Provide):
|
elif isinstance(line,Provide):
|
||||||
l = line.text.lower().split()[1:]
|
l = line.lower.split()[1:]
|
||||||
l = filter(lambda x: x not in varlist, l)
|
l = filter(lambda x: x not in varlist, l)
|
||||||
for v in l:
|
for v in l:
|
||||||
if v not in variables.keys():
|
if v not in variables.keys():
|
||||||
@ -190,9 +191,9 @@ def get_parsed_text():
|
|||||||
elif type(line) in [ Begin_provider, Cont_provider ]:
|
elif type(line) in [ Begin_provider, Cont_provider ]:
|
||||||
if isinstance(line,Begin_provider):
|
if isinstance(line,Begin_provider):
|
||||||
varlist = []
|
varlist = []
|
||||||
buffer = map(strip,line.text.replace(']','').split(','))
|
buffer = map(strip,line.lower.replace(']','').split(','))
|
||||||
assert len(buffer) > 1
|
assert len(buffer) > 1
|
||||||
v = buffer[1].lower()
|
v = buffer[1]
|
||||||
varlist.append(v)
|
varlist.append(v)
|
||||||
variable_list = find_variables_in_line(line)
|
variable_list = find_variables_in_line(line)
|
||||||
try:
|
try:
|
||||||
@ -379,8 +380,8 @@ def build_needs():
|
|||||||
var = None
|
var = None
|
||||||
for vars,line in text:
|
for vars,line in text:
|
||||||
if isinstance(line,Begin_provider):
|
if isinstance(line,Begin_provider):
|
||||||
buffer = map(strip,line.text.replace(']',',').split(','))
|
buffer = map(strip,line.lower.replace(']',',').split(','))
|
||||||
var = variables[buffer[1].lower()]
|
var = variables[buffer[1]]
|
||||||
var.needs = []
|
var.needs = []
|
||||||
var.to_provide = vars
|
var.to_provide = vars
|
||||||
elif isinstance(line,End_provider):
|
elif isinstance(line,End_provider):
|
||||||
|
@ -539,12 +539,12 @@ def irp_simple_statements(text):
|
|||||||
|
|
||||||
def process_begin_provider(line):
|
def process_begin_provider(line):
|
||||||
assert isinstance(line,Begin_provider)
|
assert isinstance(line,Begin_provider)
|
||||||
buffer = line.text.replace('['," ")
|
buffer = line.lower.replace('['," ")
|
||||||
buffer = buffer.replace(']',"")
|
buffer = buffer.replace(']',"")
|
||||||
buffer = buffer.split(',')
|
buffer = buffer.split(',')
|
||||||
if len(buffer) < 2:
|
if len(buffer) < 2:
|
||||||
error.fail(line,"Error in Begin_provider statement")
|
error.fail(line,"Error in Begin_provider statement")
|
||||||
varname = buffer[1].strip().lower()
|
varname = buffer[1].strip()
|
||||||
length = len(varname)
|
length = len(varname)
|
||||||
i = line.i
|
i = line.i
|
||||||
f = line.filename
|
f = line.filename
|
||||||
@ -558,12 +558,12 @@ def irp_simple_statements(text):
|
|||||||
|
|
||||||
def process_cont_provider(line):
|
def process_cont_provider(line):
|
||||||
assert isinstance(line,Cont_provider)
|
assert isinstance(line,Cont_provider)
|
||||||
buffer = line.text.replace('['," ")
|
buffer = line.lower.replace('['," ")
|
||||||
buffer = buffer.replace(']',"")
|
buffer = buffer.replace(']',"")
|
||||||
buffer = buffer.split(',')
|
buffer = buffer.split(',')
|
||||||
if len(buffer) < 2:
|
if len(buffer) < 2:
|
||||||
error.fail(line,"Error in Cont_provider statement")
|
error.fail(line,"Error in Cont_provider statement")
|
||||||
varname = buffer[1].strip().lower()
|
varname = buffer[1].strip()
|
||||||
i = line.i
|
i = line.i
|
||||||
f = line.filename
|
f = line.filename
|
||||||
return [ Cont_provider(i,line.text,(f,varname)) ]
|
return [ Cont_provider(i,line.text,(f,varname)) ]
|
||||||
@ -600,7 +600,7 @@ def irp_simple_statements(text):
|
|||||||
|
|
||||||
def process_program(line):
|
def process_program(line):
|
||||||
assert isinstance(line,Program)
|
assert isinstance(line,Program)
|
||||||
program_name = line.text.split()[1].lower()
|
program_name = line.lower.split()[1]
|
||||||
result = [ Program(0,"",program_name) ] + \
|
result = [ Program(0,"",program_name) ] + \
|
||||||
process_subroutine( Subroutine(line.i,"subroutine %s"%(program_name,),line.filename) )
|
process_subroutine( Subroutine(line.i,"subroutine %s"%(program_name,),line.filename) )
|
||||||
return result
|
return result
|
||||||
@ -692,7 +692,7 @@ endif'''
|
|||||||
result = []
|
result = []
|
||||||
for line in text:
|
for line in text:
|
||||||
if isinstance(line,If):
|
if isinstance(line,If):
|
||||||
if line.text.lower().endswith("then"):
|
if line.lower.endswith("then"):
|
||||||
result.append(line)
|
result.append(line)
|
||||||
else:
|
else:
|
||||||
buffer = line.text
|
buffer = line.text
|
||||||
|
@ -49,7 +49,7 @@ class Sub(object):
|
|||||||
############################################################
|
############################################################
|
||||||
def is_function(self):
|
def is_function(self):
|
||||||
if '_is_function' not in self.__dict__:
|
if '_is_function' not in self.__dict__:
|
||||||
self._is_function = "function" in self.line.text.lower()
|
self._is_function = "function" in self.line.lower
|
||||||
return self._is_function
|
return self._is_function
|
||||||
is_function = property(is_function)
|
is_function = property(is_function)
|
||||||
|
|
||||||
|
@ -67,11 +67,11 @@ def build_dim_colons(v):
|
|||||||
|
|
||||||
import error
|
import error
|
||||||
def find_subname(line):
|
def find_subname(line):
|
||||||
buffer = line.text
|
buffer = line.lower
|
||||||
if not buffer.endswith(')'):
|
if not buffer.endswith(')'):
|
||||||
buffer += "()"
|
buffer += "()"
|
||||||
buffer = buffer.split('(')
|
buffer = buffer.split('(')
|
||||||
buffer = buffer[0].lower().split()
|
buffer = buffer[0].split()
|
||||||
if len(buffer) < 2:
|
if len(buffer) < 2:
|
||||||
error.fail(line,"Syntax Error")
|
error.fail(line,"Syntax Error")
|
||||||
return buffer[-1]
|
return buffer[-1]
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.1.49"
|
version = "1.1.50"
|
||||||
|
Loading…
Reference in New Issue
Block a user