Skip to content

Commit

Permalink
DESTDIR support and standard install variables
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Nov 17, 2024
1 parent 1884fff commit a56ca45
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,35 +111,39 @@ mydatadir ?= $(datadir)/redisx
docdir ?= $(datarootdir)/doc/redisx
htmldir ?= $(docdir)/html

# Standard install commands
INSTALL_PROGRAM ?= install
INSTALL_DATA ?= install -m 644

.PHONY: install
install: install-libs install-headers install-apidoc

.PHONY: install-libs
install-libs:
ifneq ($(wildcard $(LIB)/*),)
@echo "installing libraries to $(libdir)"
install -d $(libdir)
install -m 755 -D $(LIB)/lib*.so* $(libdir)/
@echo "installing libraries to $(DESTDIR)$(libdir)"
install -d $(DESTDIR)$(libdir)
$(INSTALL_PROGRAM) -D $(LIB)/lib*.so* $(DESTDIR)$(libdir)/
else
@echo "WARNING! Skipping libs install: needs 'shared' and/or 'static'"
endif

.PHONY: install-headers
install-headers:
@echo "installing headers to $(includedir)"
install -d $(includedir)
install -m 644 -D include/* $(includedir)/
@echo "installing headers to $(DESTDIR)$(includedir)"
install -d $(DESTDIR)$(includedir)
$(INSTALL_DATA) -D include/* $(DESTDIR)$(includedir)/

.PHONY: install-apidoc
install-apidoc:
ifneq ($(wildcard apidoc/html/search/*),)
@echo "installing API documentation to $(htmldir)"
install -d $(htmldir)/search
install -m 644 -D apidoc/html/search/* $(htmldir)/search/
install -m 644 -D apidoc/html/*.* $(htmldir)/
@echo "installing Doxygen tag file to $(docdir)"
install -d $(docdir)
install -m 644 -D apidoc/*.tag $(docdir)/
@echo "installing API documentation to $(DESTDIR)$(htmldir)"
install -d $(DESTDIR)$(htmldir)/search
$(INSTALL_DATA) -D apidoc/html/search/* $(DESTDIR)$(htmldir)/search/
$(INSTALL_DATA) -D apidoc/html/*.* $(DESTDIR)$(htmldir)/
@echo "installing Doxygen tag file to $(DESTDIR)$(docdir)"
install -d $(DESTDIR)$(docdir)
$(INSTALL_DATA) -D apidoc/*.tag $(DESTDIR)$(docdir)/
else
@echo "WARNING! Skipping apidoc install: needs doxygen and 'local-dox'"
endif
Expand Down

0 comments on commit a56ca45

Please sign in to comment.