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

George Joseph asteriskteam at digium.com
Tue Jul 16 08:17:45 CDT 2019


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11573


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, 25 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/11573/1

diff --git a/Makefile b/Makefile
index 0a83cf1..c6367ac 100644
--- a/Makefile
+++ b/Makefile
@@ -803,6 +803,14 @@
 	fi
 endef
 
+install-headers:
+	$(INSTALL) -m 644 include/asterisk.h "$(DESTDIR)$(includedir)"
+	$(INSTALL) -m 644 -D -t "$(DESTDIR)$(ASTHEADERDIR)" include/asterisk/*.h
+	$(INSTALL) -m 644 -D -t "$(DESTDIR)$(ASTHEADERDIR)/doxygen" include/asterisk/doxygen/*.h
+	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."; \
@@ -992,12 +1000,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"
@@ -1027,7 +1038,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)"
@@ -1121,6 +1132,7 @@
 	@ALEMBIC=$(ALEMBIC) build_tools/make_check_alembic config cdr voicemail >&2
 
 .PHONY: install-configs
+.PHONY: install-headers
 .PHONY: menuselect
 .PHONY: main
 .PHONY: sounds
@@ -1134,6 +1146,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/+/11573
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: Ia7399f3a0203a4825fc4a9f43b9034dae9a2b643
Gerrit-Change-Number: 11573
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190716/531a31ab/attachment.html>


More information about the asterisk-code-review mailing list