1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-07-22 10:47:43 +02:00

Fixed configure and install

This commit is contained in:
Anthony Scemama 2021-05-05 11:37:48 +02:00
parent 7316f0e07c
commit f7dea1fd1c
8 changed files with 62 additions and 41 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
aclocal.m4
Makefile
src/Makefile
auto-bugs

View File

@ -7,6 +7,7 @@ tarname = @PACKAGE_TARNAME@
distdir = $(tarname)-$(version)
# Prefix-specific substitution variables
datarootdir = @datarootdir@
prefix = @prefix@
includedir = @includedir@
docdir = @docdir@
@ -29,7 +30,7 @@ LIBS = @LIBS@
LDFLAGS = @LDFLAGS@
INSTALL = @INSTALL@
.PHONY: FORCE all install uninstall clean clean-all check dist distcheck
.PHONY: FORCE all install uninstall clean maintainer-clean check dist distcheck
.POSIX:
.SUFFIXES:
@ -41,7 +42,7 @@ check:
cd tests && $(MAKE) $@
clean clean-all:
clean maintainer-clean:
cd src && $(MAKE) $@
cd tests && $(MAKE) $@
@ -65,9 +66,10 @@ $(distdir): FORCE
mkdir -p $(distdir)/tests
mkdir -p $(distdir)/include
mkdir -p $(distdir)/lib
cp $(srcdir)/include/trexio.h $(distdir)/include
cp $(srcdir)/include/trexio_f.f90 $(distdir)/include
cp $(srcdir)/src/trexio*.c $(distdir)/src
cp $(srcdir)/src/trexio*.h $(distdir)/src
cp $(srcdir)/src/trexio*.f90 $(distdir)/src
cp $(srcdir)/src/Makefile.in $(distdir)/src
cp $(srcdir)/tests/test.c $(distdir)/tests
cp $(srcdir)/tests/test.f90 $(distdir)/tests

View File

@ -14,10 +14,11 @@ TREX library fo efficient I/O.
1. Download the `trexio-<version>.tar.gz` file
2. `gzip -cd trexio-<version>.tar.gz | tar xvf -`
3. `cd trexio-<version>`
3. `cd trexio-<version>`
4. `./configure`
5. `make && sudo make install`
5. `make`
6. `make check`
7. `sudo make install`
**Note: on systems with no `sudo` rights access, one can replace `./configure` with `./configure prefix=${PWD}` in order to execite `make install/uninstall` commands without `sudo`. This will enable the installation in the root directory of the library.**
@ -33,13 +34,14 @@ TREX library fo efficient I/O.
## Installation procedure from the GitHub repo clone (for developers):
1. `git clone https://github.com/TREX-CoE/trexio.git`
2. `cd trexio`
2. `cd trexio`
3. `cd tools && ./build_trexio.sh && cd ..`
4. `autoreconf`
5. `automake --add-missing --copy`
6. `./configure`
7. `make && sudo make install`
7. `make`
8. `make check`
9. `sudo make install`
## Tutorial

View File

@ -3,7 +3,19 @@
AC_PREREQ([2.69])
AC_INIT([TREXIO], [0.2], [https://github.com/TREX-CoE/trexio/issues])
AC_CONFIG_SRCDIR([src/trexio_text.h])
AC_CHECK_FILE(src/trexio_text.h, [have_src=yes], [have_src=no])
if test "x${have_src}" = xno; then
AC_MSG_ERROR([
------------------------------------------
Please run:
cd tools && ./build_trexio.sh && cd ..
before running ./configure
------------------------------------------])
fi
AC_CONFIG_SRCDIR([src/Makefile.in])
AC_CONFIG_HEADERS([config.h])
PKG_PROG_PKG_CONFIG()
# Checks for programs.

5
src/.gitignore vendored
View File

@ -1,19 +1,24 @@
templates_front/*.c
templates_front/*.h
templates_front/*.f90
templates_front/*.dump
templates_front/populated/
templates_hdf5/*.c
templates_hdf5/*.h
templates_hdf5/*.dump
templates_hdf5/populated/
templates_text/*.c
templates_text/*.h
templates_text/*.dump
templates_text/populated/
libtrexio.so
*.o
*.h
*.dump
*.cppcheck
trexio.c
trexio_text.c
trexio_hdf5.c

View File

@ -20,6 +20,15 @@ lispdir = @lispdir@
srcdir = @srcdir@
VPATH = @srcdir@
libtrexio_so=libtrexio.so
libtrexio=$(srcdir)/../lib/$(libtrexio_so)
trexio_f_file=trexio_f.f90
trexio_f=$(srcdir)/../include/$(trexio_f_file)
trexio_h_file=trexio.h
trexio_h=$(srcdir)/../include/$(trexio_h_file)
# Tool-specific substitution variables
CC = @CC@
CFLAGS = @CFLAGS@
@ -54,26 +63,26 @@ 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
HEADER_FILES= $(trexio_h) trexio_text.h trexio_hdf5.h trexio_s.h
.PHONY: all fortran clean clean-all install
.PHONY: all fortran clean maintainer-clean install
.POSIX:
.SUFFIXES:
all: libtrexio.so fortran
all: $(libtrexio) fortran
libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES)
$(CC) -shared $(OBJECT_FILES) -o libtrexio.so
$(libtrexio): $(OBJECT_FILES) $(HEADER_FILES)
$(CC) -shared $(OBJECT_FILES) -o $(libtrexio)
fortran: trexio_f.o
trexio_f.o: libtrexio.so trexio_f.f90
$(FC) $(FCFLAGS) -c trexio_f.f90 -o trexio_f.o
trexio_f.o: $(libtrexio) $(trexio_f)
$(FC) $(FCFLAGS) -c $(trexio_f) -o trexio_f.o
cppcheck: cppcheck.out
@ -91,27 +100,27 @@ cppcheck.out: $(HEADER_FILES) $(SOURCE_FILES)
# 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_f.f90 $(DESTDIR)$(includedir)
cp $(libtrexio) $(DESTDIR)$(libdir)
cp $(trexio_h) $(DESTDIR)$(includedir)
cp $(trexio_f) $(DESTDIR)$(includedir)
uninstall:
-$(RM) -- $(DESTDIR)$(libdir)/libtrexio.so
-$(RM) -- $(DESTDIR)$(includedir)/trexio*.h
-$(RM) -- $(DESTDIR)$(includedir)/trexio_f.f90
-$(RM) -- $(DESTDIR)$(libdir)/$(libtrexio_so)
-$(RM) -- $(DESTDIR)$(includedir)/$(trexio_h_file)
-$(RM) -- $(DESTDIR)$(includedir)/$(trexio_f_file)
clean:
$(RM) -- *.o libtrexio.so trexio.mod
$(RM) -- *.o $(libtrexio) trexio.mod
clean-all:
$(RM) -- *.c *.h *.o libtrexio.so trexio_f.f90 trexio.mod
maintainer-clean:
$(RM) -- *.c *.h *.o $(libtrexio) $(trexio_f) trexio.mod
%.o: %.c $(HEADER_FILES)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c -o $*.o
$(CC) -I$(srcdir)/../include $(CPPFLAGS) $(CFLAGS) -c $*.c -o $*.o
Makefile: Makefile.in ../config.status

View File

@ -7,16 +7,6 @@ tarname = @PACKAGE_TARNAME@
distdir = $(tarname)-$(version)
# Prefix-specific substitution variables
prefix = @prefix@
includedir = @includedir@
docdir = @docdir@
htmldir = @htmldir@
libdir = @libdir@
# Supplementary
exec_prefix = @exec_prefix@
libexecdir = @libexecdir@
lispdir = @lispdir@
# VPATH-specific substitution variables
srcdir = @srcdir@
VPATH = @srcdir@
@ -31,7 +21,7 @@ LDFLAGS = @LDFLAGS@
INSTALL = @INSTALL@
.PHONY: clean
.PHONY: clean maintainer-clean check
.POSIX:
@ -43,15 +33,15 @@ check: test_c test_f
test_c: test.c
$(CC) $(CPPFLAGS) -I$(DESTDIR)$(includedir) $(CFLAGS) -Wl,-rpath,$(DESTDIR)$(libdir) -L$(DESTDIR)$(libdir) test.c $(LDFLAGS) -ltrexio $(LIBS) -o test_c
$(CC) $(CPPFLAGS) -I$(srcdir)/../include $(CFLAGS) -Wl,-rpath,$(srcdir)/../lib -L$(srcdir)/../lib test.c $(LDFLAGS) -ltrexio $(LIBS) -o test_c
test_f: trexio_f.f90 test.f90
$(FC) $(CPPFLAGS) $(FCFLAGS) -Wl,-rpath,$(DESTDIR)$(libdir) -L$(DESTDIR)$(libdir) trexio_f.f90 test.f90 $(LDFLAGS) -ltrexio $(LIBS) -o test_f
$(FC) $(CPPFLAGS) $(FCFLAGS) -Wl,-rpath,$(srcdir)/../lib -L$(srcdir)/../lib trexio_f.f90 test.f90 $(LDFLAGS) -ltrexio $(LIBS) -o test_f
trexio_f.f90:
cp $(DESTDIR)$(includedir)/trexio_f.f90 .
cp $(srcdir)/../include/trexio_f.f90 .
clean:
@ -59,7 +49,7 @@ clean:
$(RM) -r -- trexio_test/ trexio_test_fort/
clean-all: clean
maintainer-clean: clean
$(RM) -- trexio_f.o

View File

@ -77,6 +77,7 @@ cd templates_front
source build.sh
cp trexio* ../
cd ..
mv trexio.h trexio_f.f90 ../include
cd templates_text
source build.sh