| 1 | DESTDIR ?= |
| 2 | prefix ?= /usr/local |
| 3 | docdir ?= $(prefix)/share/doc/RackTables |
| 4 | datadir ?= $(prefix)/share |
| 5 | # Default values reproduce the layout present in tar.gz, which concurs with |
| 6 | # the default values of $racktables_gwdir and $racktables_staticdir. But |
| 7 | # once the latter are patched for a shared deploy, it is enough to execute |
| 8 | # "make install" with appropriate arguments to split the filesystem. |
| 9 | staticdir ?= $(datadir)/RackTables/wwwroot |
| 10 | applibdir ?= $(datadir)/RackTables/wwwroot/inc |
| 11 | indexdir ?= $(datadir)/RackTables/wwwroot |
| 12 | scriptdir ?= $(datadir)/RackTables |
| 13 | |
| 14 | INSTALL := install |
| 15 | INSTALL_DATA := $(INSTALL) -m 644 |
| 16 | INSTALL_DIR := $(INSTALL) -m 755 -d |
| 17 | INSTALL_PROGRAM := $(INSTALL) -m 755 |
| 18 | |
| 19 | install-docs: COPYING ChangeLog LICENSE README |
| 20 | $(INSTALL_DIR) $(DESTDIR)$(docdir) |
| 21 | $(INSTALL_DATA) $^ $(DESTDIR)$(docdir) |
| 22 | |
| 23 | install-helpers: scripts gateways |
| 24 | $(INSTALL_DIR) $(DESTDIR)$(scriptdir) |
| 25 | cp -r $^ $(DESTDIR)$(scriptdir) |
| 26 | find $(DESTDIR)$(scriptdir)/scripts -type d -a -name '.svn' -exec rm -rf \{\} \; -prune |
| 27 | find $(DESTDIR)$(scriptdir)/gateways -type d -a -name '.svn' -exec rm -rf \{\} \; -prune |
| 28 | |
| 29 | install-static: wwwroot/css wwwroot/js wwwroot/pix |
| 30 | $(INSTALL_DIR) $(DESTDIR)$(staticdir) |
| 31 | cp -r $^ $(DESTDIR)$(staticdir) |
| 32 | find $(DESTDIR)$(staticdir) -type d -a -name '.svn' -exec rm -rf \{\} \; -prune |
| 33 | |
| 34 | install-applib: wwwroot/inc |
| 35 | $(INSTALL_DIR) $(DESTDIR)$(applibdir)/inc |
| 36 | $(INSTALL_DATA) wwwroot/inc/*.php $(DESTDIR)$(applibdir) |
| 37 | |
| 38 | install-index: wwwroot/index.php |
| 39 | $(INSTALL_DIR) $(DESTDIR)$(indexdir) |
| 40 | $(INSTALL_DATA) wwwroot/index.php $(DESTDIR)$(indexdir) |
| 41 | |
| 42 | install: install-helpers install-static install-applib install-index |