1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-08-24 22:21:43 +02:00

Merge pull request #44 from TREX-CoE/add-dirs

Restructure TREXIO root directory
This commit is contained in:
Evgeny Posenitskiy 2021-05-03 09:19:57 +02:00 committed by GitHub
commit 6348bacc4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 117 additions and 25 deletions

View File

@ -29,20 +29,29 @@ 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
$(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
@ -53,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)
@ -65,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} 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."

View File

@ -8,7 +8,7 @@ TREX I/O library
4. `cd tools && ./build_trexio.sh && cd ..`
5. `autoreconf`
6. `automake --add-missing --copy`
7. `./configure`
7. `./configure prefix=${PWD}`
8. `make && make check`
Note: The code should be compliant with the C99 [CERT C coding

View File

@ -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 \

2
include/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.h
*.mod

3
lib/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.so
*.la
*.a

View File

@ -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,8 @@ all: libtrexio.so fortran
libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES)
$(CC) -shared $(OBJECT_FILES) -o libtrexio.so
cp libtrexio.so $(libdir) && $(RM) -- libtrexio.so
cp $(HEADER_FILES) $(includedir)
fortran: trexio_f.o
@ -76,6 +78,8 @@ 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
@ -93,31 +97,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 $(libdir)/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_f.f90 trexio.mod
%.o: %.c $(HEADER_FILES)

9
tests/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
libtrexio.so
trexio_f.o
test_c
test_f
*.h5
*/

71
tests/Makefile.in Normal file
View File

@ -0,0 +1,71 @@
# @configure_input@
# Package-specific substitution variables
package = @PACKAGE_NAME@
version = @PACKAGE_VERSION@
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@
# Tool-specific substitution variables
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
FC = @FC@
FCFLAGS = @FCFLAGS@
LIBS = @LIBS@
LDFLAGS = @LDFLAGS@
INSTALL = @INSTALL@
# Temporary solution to obtain compiled TREXIO from src directory
trexio_src = $(PWD)/../src
.PHONY: clean
.POSIX:
check: test_c test_f
$(RM) -r -- trexio_test
$(RM) -r -- trexio_test_fort
./test_c
./test_f
test_c: test.c
$(CC) $(CPPFLAGS) -I$(includedir) $(CFLAGS) -Wl,-rpath,$(libdir) -L$(libdir) test.c $(LDFLAGS) -ltrexio $(LIBS) -o test_c
test_f: trexio_f.o test.f90
$(FC) $(CPPFLAGS) -I$(includedir) $(FCFLAGS) -Wl,-rpath,$(libdir) -L$(libdir) test.f90 trexio_f.o $(LDFLAGS) -ltrexio $(LIBS) -o test_f
clean:
$(RM) -- *.h5 test_f test_c
$(RM) -r -- trexio_test/ trexio_test_fort/
clean-all:
$(RM) -- trexio_f.o libtrexio.so test_*.h5 test_f test_c
$(RM) -r -- trexio_test/ trexio_test_fort/
Makefile: Makefile.in ../config.status
cd .. && ./config.status tests/$@
../config.status: ../configure
cd .. && ./config.status --recheck