mirror of
https://github.com/pfloos/quack
synced 2025-01-03 01:56:09 +01:00
detect py version for Makefile
This commit is contained in:
parent
f7a0b7580a
commit
d8daed6ad4
@ -193,10 +193,10 @@ lib_dirs = list(filter(lambda x: os.path.isdir(x) and \
|
|||||||
|
|
||||||
def create_makefile_in_pydir(directory):
|
def create_makefile_in_pydir(directory):
|
||||||
|
|
||||||
PYTHON_VERSION = "3.9"
|
PYTHON_VERSION = "{}.{}".format(sys.version_info.major, sys.version_info.minor)
|
||||||
CC = "gcc"
|
CC = "gcc"
|
||||||
CCFLAGS = "$(shell python$(PYTHON_VERSION)-config --includes)"
|
CCFLAGS = "$(shell python$(PYTHON_VERSION)-config --includes)"
|
||||||
LDFLAGS = "-shared -fPIC -L$(LDIR) -Wl,-rpath=$(LDIR) $(shell python$(PYTHON_VERSION)-config --ldflags) -lpython3"
|
LDFLAGS = "-shared -fPIC -L$(LDIR) -Wl,-rpath=$(LDIR) $(shell python$(PYTHON_VERSION)-config --ldflags)"
|
||||||
|
|
||||||
lib_pydir = "lib{}_wrapper.so".format(directory)
|
lib_pydir = "lib{}_wrapper.so".format(directory)
|
||||||
c_pydir = "{}_wrapper.c".format(directory)
|
c_pydir = "{}_wrapper.c".format(directory)
|
||||||
@ -219,7 +219,7 @@ def create_makefile_in_pydir(directory):
|
|||||||
f.write("all: $(TARGETS)\n\n")
|
f.write("all: $(TARGETS)\n\n")
|
||||||
|
|
||||||
f.write("$(LDIR)/{}: {}\n".format(lib_pydir, c_pydir))
|
f.write("$(LDIR)/{}: {}\n".format(lib_pydir, c_pydir))
|
||||||
f.write("\t$(CC) $(CCFLAGS) $(LDFLAGS) {} -o $(LDIR)/{}\n\n".format(c_pydir, lib_pydir))
|
f.write("\t$(CC) $(CCFLAGS) {} -o $(LDIR)/{} $(LDFLAGS)\n\n".format(c_pydir, lib_pydir))
|
||||||
|
|
||||||
f.write("{}_module.o: {}_module.f90\n".format(directory, directory))
|
f.write("{}_module.o: {}_module.f90\n".format(directory, directory))
|
||||||
f.write("\tgfortran -c {}_module.f90 -o {}_module.o -J.\n\n".format(directory, directory))
|
f.write("\tgfortran -c {}_module.f90 -o {}_module.o -J.\n\n".format(directory, directory))
|
||||||
|
Loading…
Reference in New Issue
Block a user