[Asterisk-code-review] Build: Add separate header install/uninstall targets (...asterisk[16])

Joshua Colp asteriskteam at digium.com
Fri Jul 19 07:42:39 CDT 2019


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11574 )

Change subject: Build: Add separate header install/uninstall targets
......................................................................

Build: Add separate header install/uninstall targets

Two new Makefile targets have been added... "install-headers" and
"uninstall-headers" to separately control header installation.
The existing behavior has not changed so "make install" and
"make uninstall" will continue to also install/uninstall the headers.
The new targets were added for forward compatibility with Asterisk 17
in which the headers are no longer installed/uninstalled with the
"install" and "uninstall" targets.

Also corrects an issue where /usr/include/asterisk.h was never
being removed at all.

Change-Id: Ia7399f3a0203a4825fc4a9f43b9034dae9a2b643
---
M Makefile
A doc/CHANGES-staging/install_headers.txt
2 files changed, 28 insertions(+), 11 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Joshua Colp: Approved for Submit



diff --git a/Makefile b/Makefile
index 8911c6a..36b7ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -555,7 +555,6 @@
 	"$(ASTSPOOLDIR)" "$(ASTSPOOLDIR)/dictate" "$(ASTSPOOLDIR)/meetme" \
 	"$(ASTSPOOLDIR)/monitor" "$(ASTSPOOLDIR)/system" "$(ASTSPOOLDIR)/tmp" \
 	"$(ASTSPOOLDIR)/voicemail" "$(ASTSPOOLDIR)/recording" \
-	"$(ASTHEADERDIR)" "$(ASTHEADERDIR)/doxygen" \
 	"$(ASTLOGDIR)" "$(ASTLOGDIR)/cdr-csv" "$(ASTLOGDIR)/cdr-custom" \
 	"$(ASTLOGDIR)/cel-custom" "$(ASTDATADIR)" "$(ASTDATADIR)/documentation" \
 	"$(ASTDATADIR)/documentation/thirdparty" "$(ASTDATADIR)/firmware" \
@@ -574,19 +573,13 @@
 main-bininstall:
 	+ at DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main bininstall
 
-bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall
+bininstall: _all installdirs $(SUBDIRS_INSTALL) main-bininstall install-headers
 	$(INSTALL) -m 755 contrib/scripts/astversion "$(DESTDIR)$(ASTSBINDIR)/"
 	$(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/"
 	$(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/"
 	if [ ! -f /sbin/launchd ]; then \
 		./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; \
 	fi
-	$(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
-	$(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
-	$(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
-	if [ -n "$(OLDHEADERS)" ]; then \
-		for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
-	fi
 
 ifneq ($(DISABLE_XMLDOC),yes)
 	$(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation"
@@ -799,6 +792,16 @@
 	fi
 endef
 
+install-headers:
+# Will create all components of "$(DESTDIR)$(ASTHEADERDIR)/doxygen" including "$(DESTDIR)$(includedir)"
+	$(INSTALL) -d "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
+	$(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
+	$(INSTALL) -m 644 include/asterisk/*.h "$(DESTDIR)$(ASTHEADERDIR)"
+	$(INSTALL) -m 644 include/asterisk/doxygen/*.h "$(DESTDIR)$(ASTHEADERDIR)/doxygen"
+	if [ -n "$(OLDHEADERS)" ]; then \
+		for h in $(OLDHEADERS); do rm -f "$(DESTDIR)$(ASTHEADERDIR)/$$h"; done \
+	fi
+
 install-configs:
 	@if test -z "$(CONFIG_SRC)" -o ! -d "$(CONFIG_SRC)"; then \
 		>&2 echo "CONFIG_SRC must be set to a directory."; \
@@ -988,12 +991,15 @@
 main-binuninstall:
 	+ at DESTDIR="$(DESTDIR)" ASTSBINDIR="$(ASTSBINDIR)" ASTLIBDIR="$(ASTLIBDIR)" $(SUBMAKE) -C main binuninstall
 
-_uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall
+uninstall-headers:
+	rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
+	rm -f "$(DESTDIR)$(includedir)/asterisk.h"
+
+_uninstall: $(SUBDIRS_UNINSTALL) main-binuninstall uninstall-headers
 	rm -f "$(DESTDIR)$(ASTMODDIR)/"*
 	test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -f "$(_oldmoddir)/"* || :
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/astgenkey"
 	rm -f "$(DESTDIR)$(ASTSBINDIR)/autosupport"
-	rm -rf "$(DESTDIR)$(ASTHEADERDIR)"
 	rm -rf "$(DESTDIR)$(ASTDATADIR)/firmware"
 	rm -f "$(DESTDIR)$(ASTMANDIR)/man8/asterisk.8"
 	rm -f "$(DESTDIR)$(ASTMANDIR)/man8/astgenkey.8"
@@ -1023,7 +1029,7 @@
 	@echo " +            $(mK) uninstall-all            +"
 	@echo " +-------------------------------------------+"
 
-uninstall-all: _uninstall
+uninstall-all: _uninstall uninstall-headers
 	rm -rf "$(DESTDIR)$(ASTMODDIR)"
 	test -n "$(_oldmoddir)" -a -d "$(_oldmoddir)" && rm -rf "$(_oldmoddir)" || :
 	rm -rf "$(DESTDIR)$(ASTVARLIBDIR)"
@@ -1117,6 +1123,7 @@
 	@ALEMBIC=$(ALEMBIC) build_tools/make_check_alembic config cdr voicemail >&2
 
 .PHONY: install-configs
+.PHONY: install-headers
 .PHONY: menuselect
 .PHONY: main
 .PHONY: sounds
@@ -1130,6 +1137,7 @@
 .PHONY: uninstall
 .PHONY: _uninstall
 .PHONY: uninstall-all
+.PHONY: uninstall-headers
 .PHONY: badshell
 .PHONY: installdirs
 .PHONY: validate-docs
diff --git a/doc/CHANGES-staging/install_headers.txt b/doc/CHANGES-staging/install_headers.txt
new file mode 100644
index 0000000..0957193
--- /dev/null
+++ b/doc/CHANGES-staging/install_headers.txt
@@ -0,0 +1,9 @@
+Subject: Build
+
+Two new Makefile targets have been added... "install-headers" and
+"uninstall-headers" to separately control header installation.
+The existing behavior has not changed so "make install" and
+"make uninstall" will continue to also install/uninstall the headers.
+The new targets were added for forward compatibility with Asterisk 17
+in which the headers are no longer installed/uninstalled with the
+"install" and "uninstall" targets.

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11574
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ia7399f3a0203a4825fc4a9f43b9034dae9a2b643
Gerrit-Change-Number: 11574
Gerrit-PatchSet: 4
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190719/1d920bc8/attachment-0001.html>


More information about the asterisk-code-review mailing list