From 4578fb1a2b7f882c8144d087b144b346226b7bc9 Mon Sep 17 00:00:00 2001 From: q-posev Date: Fri, 30 Apr 2021 19:04:43 +0200 Subject: [PATCH] adapt rules for new structure of the root directory --- Makefile.in | 9 ++++++--- src/Makefile.in | 8 +++++--- tests/Makefile.in | 14 ++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0c92e63..3684b48 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,7 +51,7 @@ dist: $(distdir).tar.gz $(distdir).tar.gz: $(distdir) tar chof - $(distdir) | gzip -9 -c > $@ - rm -rf $(distdir) + rm -rf -- $(distdir) # for now copy entire src/ directory into $(distdir) in order for distcheck rule to work # later on can be changed to ship only files like *.c *.h *.f90 *.so *.mod @@ -62,6 +62,9 @@ $(distdir): FORCE cp $(srcdir)/config.h.in $(distdir) cp $(srcdir)/install-sh $(distdir) cp -r $(srcdir)/src $(distdir) + cp -r $(srcdir)/tests $(distdir) + cp -r $(srcdir)/lib $(distdir) + cp -r $(srcdir)/include $(distdir) cp $(srcdir)/Makefile.in $(distdir) cp $(srcdir)/LICENSE $(distdir) @@ -74,12 +77,12 @@ FORCE: distcheck: $(distdir).tar.gz gzip -cd $(distdir).tar.gz | tar xvf - cd $(distdir) && \ - ./configure CC="$(CC)" CFLAGS="$(CFLAGS)" && \ + ./configure prefix=$${PWD}/$(distdir) CC="$(CC)" CFLAGS="$(CFLAGS)" && \ $(MAKE) all && \ $(MAKE) check && \ $(MAKE) DESTDIR=$${PWD}/_inst install && \ $(MAKE) clean - rm -rf $(distdir) + rm -rf -- $(distdir) @echo "*** Package $(distdir).tar.gz is ready for distribution." diff --git a/src/Makefile.in b/src/Makefile.in index d25a40f..a29f1da 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -69,7 +69,8 @@ all: libtrexio.so fortran libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES) $(CC) -shared $(OBJECT_FILES) -o libtrexio.so - cp -- $(HEADER_FILES) $(includedir) + cp libtrexio.so $(libdir) + cp $(HEADER_FILES) $(includedir) fortran: trexio_f.o @@ -78,6 +79,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) + cp -- trexio_f.o ../tests cppcheck: cppcheck.out @@ -101,7 +103,7 @@ install: $(INSTALL) -d $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) cp libtrexio.so $(DESTDIR)$(libdir) cp trexio*.h $(DESTDIR)$(includedir) -# cp trexio.mod $(DESTDIR)$(includedir) + cp trexio.mod $(DESTDIR)$(includedir) clean: @@ -109,7 +111,7 @@ clean: clean-all: - $(RM) -- *.c *.h *.o libtrexio.so trexio.mod + $(RM) -- *.c *.h *.o libtrexio.so trexio_f.f90 trexio.mod %.o: %.c $(HEADER_FILES) diff --git a/tests/Makefile.in b/tests/Makefile.in index 759bfad..a50ee38 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -44,18 +44,12 @@ check: test_c test_f ./test_f -test_c: upd_trexio test.c - $(CC) $(CPPFLAGS) -I$(includedir) $(CFLAGS) -Wl,-rpath,$(PWD) -L. test.c -ltrexio $(LDFLAGS) $(LIBS) -o test_c +test_c: test.c + $(CC) $(CPPFLAGS) -I$(includedir) $(CFLAGS) test.c $(LDFLAGS) -ltrexio $(LIBS) -o test_c -test_f: upd_trexio test.f90 - $(FC) $(CPPFLAGS) -I$(includedir) $(FCFLAGS) -Wl,-rpath,$(PWD) -L. test.f90 trexio_f.o -ltrexio $(LDFLAGS) $(LIBS) -o test_f - - -upd_trexio: $(trexio_src)/libtrexio.so $(trexio_src)/trexio_f.o - cp $(trexio_src)/libtrexio.so . - cp $(trexio_src)/trexio_f.o . - cp $(trexio_src)/trexio.mod $(includedir) +test_f: trexio_f.o test.f90 + $(FC) $(CPPFLAGS) -I$(includedir) $(FCFLAGS) test.f90 trexio_f.o $(LDFLAGS) -ltrexio $(LIBS) -o test_f clean: