1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-01-11 05:28:33 +01:00

adapt for fortran

This commit is contained in:
q-posev 2021-03-22 16:15:37 +01:00
parent 7f3dc0879c
commit baa50bdbe2
2 changed files with 12 additions and 5 deletions

View File

@ -6,7 +6,10 @@ ifeq ($(COMPILER),GNU)
CC=gcc -g
CFLAGS=-fPIC -fexceptions -Wall -Werror -Wpedantic -Wextra
LIBS= -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -lz -lm -lhdf5 -lhdf5_hl #-lgfortran
FS=gfortran -g
FFLAGS=-fPIC -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan
LIBS= -L/usr/lib/x86_64-linux-gnu/hdf5/serial/ -lz -lm -lhdf5 -lhdf5_hl -lgfortran
INCLUDE = -I/usr/include/hdf5/serial
endif
@ -35,18 +38,22 @@ endif
OBJECT_FILES= trexio.o trexio_text.o trexio_hdf5.o
HEADER_FILES= trexio.h trexio_text.h trexio_hdf5.h trexio_s.h
export CC CFLAGS LIBS
export CC CFLAGS FC FFLAGS LIBS
.PHONY: clean
libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES)
$(CC) -shared $(OBJECT_FILES) -o libtrexio.so
test: libtrexio.so test.c
fortran: libtrexio.so trexio_f.f90
$(FC) $(FFLAGS) -c trexio_f.f90 -o trexio_f.o
test: libtrexio.so test.c test.f90 trexio_f.o
$(CC) $(CFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. test.c -ltrexio $(LIBS) -o test
$(CC) $(CFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. trexio_f.o test.f90 -ltrexio $(LIBS) -o test_f
clean:
rm -f *.o libtrexio.so test test_*.h5
rm -f *.o libtrexio.so test test_*.h5 test_f
rm -r trexio_test/
%.o: %.c $(HEADER_FILES)

View File

@ -17,7 +17,7 @@ mkdir -p templates_hdf5/populated
# not options. It is safer.
echo "remove existing templates"
rm -f -- templates_front/*.{c,h}
rm -f -- templates_front/*.{c,h,f90}
rm -f -- templates_text/*.{c,h}
rm -f -- templates_hdf5/*.{c,h}