Browse code

Makefile: added uninstall target

- it prints hints and commands to perform uninstall when installation is
done from sources

Daniel-Constantin Mierla authored on 17/10/2012 10:52:34
Showing 1 changed files
... ...
@@ -1210,3 +1210,48 @@ printvar:
1210 1210
 	@echo "Content of <$(v)> is:"
1211 1211
 	@echo -n $($(v))
1212 1212
 	@echo
1213
+
1214
+.PHONY: uninstall
1215
+uninstall:
1216
+	@echo "-Installation details:"
1217
+	@echo " *PREFIX Path is: ${PREFIX}"
1218
+	@echo " *BINDIR Path is: ${bin_prefix}/${bin_dir}"
1219
+	@echo " *CFGDIR Path is: ${cfg_prefix}/${cfg_dir}"
1220
+	@echo " *DOCDIR Path is: ${doc_prefix}/${doc_dir}"
1221
+	@echo " *LIBDIR Path is: ${lib_prefix}/${lib_dir}"
1222
+	@echo " *MANDIR Path is: ${man_prefix}/${man_dir}"
1223
+	@echo " *SHRDIR Path is: ${share_prefix}/${share_dir}"
1224
+	@if [ "${PREFIX}" != "/usr/local" ] ; then \
1225
+		echo "-Custom PREFIX Path" ; \
1226
+		if [ "${PREFIX}" = "/" -o "${PREFIX}" = "/usr" ] ; then \
1227
+			echo "-Custom installation in a system folder" ; \
1228
+			echo "-This is advanced installation" ; \
1229
+			echo "-You seem to be in control of what files were deployed" ; \
1230
+			echo "-Folders listed above should give hints about what to delete" ; \
1231
+		else \
1232
+			echo "-Uninstall should be just removal of the folder: ${PREFIX}" ; \
1233
+			echo "-WARNING: before deleting, be sure ${PREFIX} is not a system directory" ; \
1234
+		fi ; \
1235
+	else \
1236
+		echo "-Run following commands to uninstall:" ; \
1237
+		echo ; \
1238
+		echo "rm ${bin_prefix}/${bin_dir}${MAIN_NAME}" ; \
1239
+		if [ "${FLAVOUR}" = "kamailio" ] ; then \
1240
+			echo "rm ${bin_prefix}/${bin_dir}kamctl" ; \
1241
+			echo "rm ${bin_prefix}/${bin_dir}kamdbctl" ; \
1242
+		fi ; \
1243
+		echo "rm ${bin_prefix}/${bin_dir}sercmd" ; \
1244
+		echo "rm ${man_prefix}/${man_dir}man5/$(MAIN_NAME).cfg.5" ; \
1245
+		echo "rm ${man_prefix}/${man_dir}man8/$(MAIN_NAME).8" ; \
1246
+		if [ "${FLAVOUR}" = "kamailio" ] ; then \
1247
+			echo "rm ${man_prefix}/${man_dir}kamctl.8" ; \
1248
+			echo "rm ${man_prefix}/${man_dir}kamdbctl.8" ; \
1249
+		fi ; \
1250
+		echo "rm -rf ${cfg_prefix}/${cfg_dir}" ; \
1251
+		echo "rm -rf ${doc_prefix}/${doc_dir}" ; \
1252
+		echo "rm -rf ${lib_prefix}/${lib_dir}" ; \
1253
+		echo "rm -rf ${share_prefix}/${share_dir}" ; \
1254
+		echo ; \
1255
+		echo "-WARNING: before running the commands, be sure they don't delete any system directory or file" ; \
1256
+	fi ;
1257
+	@echo