Replace AR by ARCHIVE

This commit is contained in:
Anthony Scemama 2020-12-06 20:48:35 +01:00
parent da3ee8864a
commit 2027274583
2 changed files with 46 additions and 38 deletions

View File

@ -36,9 +36,9 @@ FILENAME_GITIGNORE = ".gitignore"
IRPF90_MAKE = "irpf90.make"
if sys.platform in ["linux", "linux2"]:
AR = "ar crs"
ARCHIVE = "ar crs"
elif sys.platform == "darwin":
AR = "libtool -static -o"
ARCHIVE = "libtool -static -o"
else:
print("Unknown platform. Only Linux and Darwin are supported.")
sys.exit(-1)
@ -58,7 +58,7 @@ def create():
FC = gfortran
FCFLAGS= -O2 -ffree-line-length-none -I .
NINJA = ninja
AR = %s
ARCHIVE= %s
RANLIB = ranlib
SRC=
@ -70,7 +70,7 @@ export
%s: $(filter-out %s%%, $(wildcard */*.irp.f)) $(wildcard *.irp.f) $(wildcard *.inc.f) Makefile
\t$(IRPF90)
"""%(AR,IRPF90_MAKE,IRPF90_MAKE,irpdir)
"""%(ARCHIVE,IRPF90_MAKE,IRPF90_MAKE,irpdir)
file.write(t)
file.close()
create_gitignore()
@ -197,7 +197,7 @@ def run_make():
print(dir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+dir+"$*.o", file=file)
print(dir+"%.irp.F90: "+IRPF90_MAKE+"\n", file=file)
print("move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n", file=file)
print("IRPF90_temp/irpf90.a: $(OBJ) $(OBJ1)\n\t$(AR) IRPF90_temp/irpf90.a $(OBJ1)\n", file=file)
print("IRPF90_temp/irpf90.a: $(OBJ) $(OBJ1)\n\t$(ARCHIVE) IRPF90_temp/irpf90.a $(OBJ1)\n", file=file)
print("clean:\n\trm -rf $(EXE) $(OBJ1) IRPF90_temp/irpf90.a $(ALL_OBJ1) $(ALL)\n", file=file)
print("veryclean:\n\t- $(MAKE) clean\n", file=file)
print("\t- rm -rf "+irpdir+" "+mandir+" "+IRPF90_MAKE+" irpf90_entities dist tags\n", file=file)

View File

@ -39,6 +39,14 @@ cwd = os.getcwd()
PRINT_WIDTH=50
if sys.platform in ["linux", "linux2"]:
AR = "ar crs"
elif sys.platform == "darwin":
AR = "libtool -static -o"
else:
print("Unknown platform. Only Linux and Darwin are supported.")
sys.exit(-1)
def dress(f,in_root=False):
"""
Transfoms the filename f into $PWD/IRPF90_temp/f
@ -271,8 +279,8 @@ def run():
try: FC = os.environ["FC"]
except KeyError: FC="gfortran -ffree-line-length-none"
try: AR = os.environ["AR"]
except KeyError: AR="ar crs"
try: ARCHIVE = os.environ["ARCHIVE"]
except KeyError: ARCHIVE=AR
try: CC = os.environ["CC"]
except KeyError: CC="gcc"
@ -329,14 +337,14 @@ def run():
" description = C++ : $short_in -> $short_out",
"",
"rule link_lib_{id}",
" command = {AR} $out $in" ,
" command = {ARCHIVE} $out $in" ,
" description = Link: $short_out",
"",
"rule link_{id}",
" command = {FC} $in {LIB} -o $out" ,
" description = Link: $short_out"]
output += [ '\n'.join(t).format(id=irp_id, FC=FC, FCFLAGS=FCFLAGS, LIB=LIB, CXX=CXX, CXXFLAGS=CXXFLAGS, CC=CC, CFLAGS=CFLAGS, AR=AR) ]
output += [ '\n'.join(t).format(id=irp_id, FC=FC, FCFLAGS=FCFLAGS, LIB=LIB, CXX=CXX, CXXFLAGS=CXXFLAGS, CC=CC, CFLAGS=CFLAGS, ARCHIVE=ARCHIVE) ]
# All modules : list of Fmodule objects