From 1fbd9e9c84194f5e113433ff629776bb6936a3eb Mon Sep 17 00:00:00 2001 From: Attila Kovacs Date: Tue, 12 Nov 2024 23:02:07 +0100 Subject: [PATCH] Makefile: install only what was built --- .github/workflows/install.yml | 12 ++++++++++ Makefile | 44 ++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 67ff729..714737b 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -63,15 +63,27 @@ jobs: with: repository: Smithsonian/smax-clib path: smax-clib + + - name: Build xchange dependency + run: make -C xchange shared - name: Install xchange dependency run: sudo make -C xchange install + + - name: Build RedisX dependency + run: make -C redisx shared - name: Install RedisX dependency run: sudo make -C redisx install + + - name: Build smax-clib dependency + run: make -C smax-clib shared - name: Install smax-clib dependency run: sudo make -C smax-clib install + + - name: Build smax-postgres distro + run: make distro - name: Install smax-postgres in default location run: sudo make install diff --git a/Makefile b/Makefile index 6961cb9..8ee1ba4 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,6 @@ CONFIG := "cfg/smax-postgres.cfg" install-sma: CONFIG := "cfg/smax-postgres.cfg.sma" install-sma: install - .PHONY: install install: install-bin install-cfg install-systemd install-doc @@ -112,23 +111,25 @@ install-bin: app @install -m 755 $(BIN)/smax-postgres $(bindir)/ .PHONY: install-cfg - @if [ ! -e $(sysconfdir)/smax-postgres.cfg ] ; then \ - echo "installing configuration file under $(sysconfdir)." ; \ - install -d $(sysconfdir) ; \ - install -m 644 cfg/smax-postgres.cfg $(sysconfdir)/smax-postgres.cfg ; \ - fi +ifeq ($(wildcard $(sysconfdir)/smax-postgres.cfg,) + @echo "installing configuration file under $(sysconfdir)." + install -d $(sysconfdir) + install -m 644 cfg/smax-postgres.cfg $(sysconfdir)/smax-postgres.cfg +else + @echo "WARNING! Will not override existing $(sysconfdir)/smax-postgres.cfg" +endif .PHONY: install-systemd install-systemd: - @if [ $(SYSTEMD) -ne 0 ] ; then \ - echo "installing systemd unit file under $(systemddir)." ; \ - mkdir -p $(systemddir) ; \ - install -m 644 smax-postgres.service $(systemddir) ; \ - sed -i "s:/usr/:$(prefix):g" $(systemddir)/smax-postgres.service ; \ - fi +ifneq ($(SYSTEMD), 0) + @echo "installing systemd unit file under $(systemddir)." + mkdir -p $(systemddir) + install -m 644 smax-postgres.service $(systemddir) + sed -i "s:/usr/:$(prefix):g" $(systemddir)/smax-postgres.service +endif .PHONY: install-doc -install-doc: install-apidoc $(DOC_TARGETS) +install-doc: install-apidoc @echo "installing docs under $(docdir)." @install -d $(docdir) @install -m 644 LICENSE $(docdir) @@ -136,14 +137,15 @@ install-doc: install-apidoc $(DOC_TARGETS) @install -m 644 CHANGELOG.md $(docdir) .PHONY: install-apidoc -install-apidoc: $(DOC_TARGETS) - @if [ -e apidoc/html/index.html ] ; then \ - echo "installing API docs under $(htmldir)." ; \ - install -d $(htmldir)/search ; \ - install -m 644 -D apidoc/html/* $(htmldir)/smax-postgres/ ; \ - install -m 644 -D apidoc/html/search/* $(htmldir)/search/ ; \ - fi - +install-apidoc: +ifneq ($(wildcard apidoc/html/search/*,) + @echo "installing API docs under $(htmldir)." + install -d $(htmldir)/search + install -m 644 -D apidoc/html/* $(htmldir)/smax-postgres/ + install -m 644 -D apidoc/html/search/* $(htmldir)/search/ +else + @echo "WARNING! Skipping apidoc install: needs doxygen and 'local-dox'" +endif # Built-in help screen for `make help` .PHONY: help