diff --git a/Makefile.in b/Makefile.in index 9597a1d..0c92e63 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,14 +29,23 @@ LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ INSTALL = @INSTALL@ -.PHONY: FORCE all install clean check dist distcheck +.PHONY: FORCE all install clean clean-all check dist distcheck .POSIX: .SUFFIXES: -all install clean check: +all install: cd src && $(MAKE) $@ +check: + cd tests && $(MAKE) $@ + + +clean clean-all: + cd src && $(MAKE) $@ + cd tests && $(MAKE) $@ + + dist: $(distdir).tar.gz diff --git a/configure.ac b/configure.ac index 823f07d..a490995 100644 --- a/configure.ac +++ b/configure.ac @@ -123,7 +123,8 @@ AC_FUNC_MALLOC AC_CHECK_FUNCS([memset mkdir strerror]) AC_CONFIG_FILES([Makefile - src/Makefile]) + src/Makefile + tests/Makefile]) AC_OUTPUT echo \ diff --git a/src/Makefile.in b/src/Makefile.in index 7cec99f..d25a40f 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -59,7 +59,7 @@ ORG_FILES= templates_front/templator_front.org templates_text/templator_text.or templates_hdf5/templator_hdf5.org -.PHONY: all fortran clean install +.PHONY: all fortran clean clean-all install .POSIX: .SUFFIXES: @@ -69,6 +69,7 @@ all: libtrexio.so fortran libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES) $(CC) -shared $(OBJECT_FILES) -o libtrexio.so + cp -- $(HEADER_FILES) $(includedir) fortran: trexio_f.o @@ -76,6 +77,7 @@ fortran: trexio_f.o trexio_f.o: libtrexio.so trexio_f.f90 $(FC) $(FCFLAGS) -c trexio_f.f90 -o trexio_f.o + cp -- trexio.mod $(includedir) cppcheck: cppcheck.out @@ -93,31 +95,21 @@ trexio.c trexio_f.f90 trexio.h: $(ORG_FILES) cd ../tools && ./build_trexio.sh && cd ../src -test_c: libtrexio.so test.c - $(CC) $(CPPFLAGS) $(CFLAGS) -Wl,-rpath,$(PWD) -L. test.c -ltrexio $(LDFLAGS) $(LIBS) -o test_c - - -test_f: libtrexio.so trexio_f.o test.f90 - $(FC) $(CPPFLAGS) $(FCFLAGS) -Wl,-rpath,$(PWD) -L. test.f90 trexio_f.o -ltrexio $(LDFLAGS) $(LIBS) -o test_f - - -check: test_c test_f - $(RM) -r trexio_test - $(RM) -r trexio_test_fort - ./test_c - ./test_f - # $(DESTDIR) is needed for future support of package managers # install should avoid build target due to possible conflict when prefix overriden install: $(INSTALL) -d $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) cp libtrexio.so $(DESTDIR)$(libdir) cp trexio*.h $(DESTDIR)$(includedir) +# cp trexio.mod $(DESTDIR)$(includedir) clean: - $(RM) *.o libtrexio.so test_*.h5 test_f test_c - $(RM) -r trexio_test/ trexio_test_fort/ + $(RM) -- *.o libtrexio.so trexio.mod + + +clean-all: + $(RM) -- *.c *.h *.o libtrexio.so trexio.mod %.o: %.c $(HEADER_FILES)