mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-08-25 06:31:43 +02:00
fixed make install and introduced uninstall targets
This commit is contained in:
parent
15f4e56690
commit
03f58a649e
34
Makefile.in
34
Makefile.in
@ -29,11 +29,11 @@ LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
.PHONY: FORCE all install clean clean-all check dist distcheck
|
||||
.PHONY: FORCE all install uninstall clean clean-all check dist distcheck
|
||||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
all install:
|
||||
all install uninstall:
|
||||
cd src && $(MAKE) $@
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ dist: $(distdir).tar.gz
|
||||
|
||||
$(distdir).tar.gz: $(distdir)
|
||||
tar chof - $(distdir) | gzip -9 -c > $@
|
||||
rm -rf -- $(distdir)
|
||||
$(RM) -r -- $(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
|
||||
@ -61,28 +61,36 @@ $(distdir): FORCE
|
||||
cp $(srcdir)/configure $(distdir)
|
||||
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)
|
||||
mkdir -p $(distdir)/src
|
||||
mkdir -p $(distdir)/tests
|
||||
mkdir -p $(distdir)/include
|
||||
mkdir -p $(distdir)/lib
|
||||
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
|
||||
cp $(srcdir)/tests/Makefile.in $(distdir)/tests
|
||||
cp $(srcdir)/Makefile.in $(distdir)
|
||||
cp $(srcdir)/LICENSE $(distdir)
|
||||
|
||||
|
||||
FORCE:
|
||||
-rm $(distdir).tar.gz >/dev/null 2>&1
|
||||
-rm -rf $(distdir) >/dev/null 2>&1
|
||||
-$(RM) -- $(distdir).tar.gz >/dev/null 2>&1
|
||||
-$(RM) -r -- $(distdir) >/dev/null 2>&1
|
||||
|
||||
|
||||
distcheck: $(distdir).tar.gz
|
||||
gzip -cd $(distdir).tar.gz | tar xvf -
|
||||
cd $(distdir) && \
|
||||
./configure prefix=$${PWD} CC="$(CC)" CFLAGS="$(CFLAGS)" && \
|
||||
$(MAKE) all && \
|
||||
$(MAKE) check && \
|
||||
./configure CC="$(CC)" CFLAGS="$(CFLAGS)" && \
|
||||
$(MAKE) && \
|
||||
$(MAKE) DESTDIR=$${PWD}/_inst install && \
|
||||
$(MAKE) DESTDIR=$${PWD}/_inst check && \
|
||||
$(MAKE) DESTDIR=$${PWD}/_inst uninstall && \
|
||||
$(MAKE) clean
|
||||
rm -rf -- $(distdir)
|
||||
$(RM) -r -- $(distdir)
|
||||
@echo "*** Package $(distdir).tar.gz is ready for distribution."
|
||||
|
||||
|
||||
|
@ -55,8 +55,6 @@ 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
|
||||
|
||||
|
||||
.PHONY: all fortran clean clean-all install
|
||||
@ -69,8 +67,6 @@ 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
|
||||
@ -78,8 +74,6 @@ 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,17 +87,19 @@ cppcheck.out: $(HEADER_FILES) $(SOURCE_FILES)
|
||||
$(CPPFLAGS) $(SOURCE_FILES) 2>$@
|
||||
|
||||
|
||||
trexio.c trexio_f.f90 trexio.h: $(ORG_FILES)
|
||||
cd ../tools && ./build_trexio.sh && cd ../src
|
||||
|
||||
|
||||
# $(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 $(libdir)/libtrexio.so $(DESTDIR)$(libdir)
|
||||
cp libtrexio.so $(DESTDIR)$(libdir)
|
||||
cp trexio*.h $(DESTDIR)$(includedir)
|
||||
cp trexio.mod $(DESTDIR)$(includedir)
|
||||
cp trexio_f.f90 $(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
uninstall:
|
||||
-$(RM) -- $(DESTDIR)$(libdir)/libtrexio.so
|
||||
-$(RM) -- $(DESTDIR)$(includedir)/trexio*.h
|
||||
-$(RM) -- $(DESTDIR)$(includedir)/trexio_f.f90
|
||||
|
||||
|
||||
clean:
|
||||
|
@ -30,8 +30,6 @@ LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
# Temporary solution to obtain compiled TREXIO from src directory
|
||||
trexio_src = $(PWD)/../src
|
||||
|
||||
.PHONY: clean
|
||||
.POSIX:
|
||||
@ -45,21 +43,24 @@ check: 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
|
||||
$(CC) $(CPPFLAGS) -I$(DESTDIR)$(includedir) $(CFLAGS) -Wl,-rpath,$(DESTDIR)$(libdir) -L$(DESTDIR)$(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
|
||||
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
|
||||
|
||||
|
||||
trexio_f.f90:
|
||||
cp $(DESTDIR)$(includedir)/trexio_f.f90 .
|
||||
|
||||
|
||||
clean:
|
||||
$(RM) -- *.h5 test_f test_c
|
||||
$(RM) -- trexio.mod test_f test_c *.h5
|
||||
$(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/
|
||||
clean-all: clean
|
||||
$(RM) -- trexio_f.o
|
||||
|
||||
|
||||
Makefile: Makefile.in ../config.status
|
||||
|
Loading…
Reference in New Issue
Block a user