diff --git a/src/Makefile b/src/Makefile index b42545f..abdcb68 100644 --- a/src/Makefile +++ b/src/Makefile @@ -37,29 +37,48 @@ endif OBJECT_FILES= trexio.o trexio_text.o trexio_hdf5.o SOURCE_FILES= test.c trexio.c trexio_hdf5.c trexio_text.c HEADER_FILES= trexio.h trexio_text.h trexio_hdf5.h trexio_s.h +ORG_FILES= templates_front/templator_front.org templates_text/templator_text.org \ + templates_hdf5/templator_hdf5.org + export CC CFLAGS FC FFLAGS LIBS .PHONY: clean -libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES) cppcheck.out + +libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES) $(CC) -shared $(OBJECT_FILES) -o libtrexio.so -fortran: libtrexio.so trexio_f.f90 + +fortran: trexio_f.o + + +trexio_f.o: libtrexio.so trexio_f.f90 $(FC) $(FFLAGS) -c trexio_f.f90 -o trexio_f.o + +check: cppcheck.out + cat cppcheck.out + cppcheck.out: $(HEADER_FILES) $(SOURCE_FILES) cppcheck --addon=cert -q --error-exitcode=0 \ --enable=warning,performance,portability,missingInclude,information \ --language=c --std=c99 -rp --platform=unix64 \ $(INCLUDE) $(SOURCE_FILES) 2>$@ + +trexio.c trexio_f.f90 trexio.h: $(ORG_FILES) + ./build_trex.sh + + test_c: libtrexio.so test.c $(CC) $(CFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. test.c -ltrexio $(LIBS) -o test_c -test_f: libtrexio.so test.f90 trexio_f.o + +test_f: libtrexio.so test.f90 trexio_f.o $(FC) $(FFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. test.f90 trexio_f.o -ltrexio $(LIBS) -o test_f + test: test_c test_f $(RM) -r trexio_test $(RM) -r trexio_test_fort @@ -70,6 +89,7 @@ clean: $(RM) *.o libtrexio.so test_*.h5 test_f test_c $(RM) -r trexio_test/ trexio_test_fort/ + %.o: %.c $(HEADER_FILES) $(CC) $(CFLAGS) $(INCLUDE) -c $*.c -o $*.o