如何在QT5中从qmake“进行卸载”期间运行自定义命令
How to run custom commands during `make uninstall` from qmake in QT5?
我有一个QT项目,在运行make install
时为系统安装一个服务。.pro
文件的相关部分如下:
init.path = /etc/init.d/
init.files = myservicename
updaterc.path = /etc/init.d/
updaterc.extra = chmod 755 $$init.files;
update-rc.d $$init.files defaults 97 03;
service $$init.files start
INSTALLS += target ... init updaterc
正确安装服务,然后启动它。
当我执行make uninstall
命令时,虽然正确删除了已安装的文件,但服务仍然安装并运行。我希望在运行make uninstall
时停止并卸载服务。
停止和卸载服务的命令如下:
sudo service myservicename stop
sudo update-rc.d -f myservicename remove
但是我不知道如何将以上命令整合到.pro
文件中,以便qmake
能够理解并在Makefile中创建相关规则。
我找到的关于这个主题的唯一文档是:http://doc.qt.io/qt-5/qmake-advanced-usage.html,但是它没有说任何关于卸载的内容
尝试使用。uninstall命令。
mytarget2.path = ~/Documents/inst
mytarget2.target = test.txt
mytarget2.commands = @echo "custom command"
mytarget2.uninstall = @echo "uninstall"
INSTALLS += mytarget2
它将生成以下makefile:
####### Install
install_mytarget2: first FORCE
@test -d $(INSTALL_ROOT)/Users/mac/Documents/inst || mkdir -p $(INSTALL_ROOT)/Users/mac/Documents/inst
@echo custom command
uninstall_mytarget2: FORCE
@echo uninstall
-$(DEL_DIR) $(INSTALL_ROOT)/Users/mac/Documents/inst/
install: install_mytarget2 FORCE
uninstall: uninstall_mytarget2 FORCE
FORCE:
相关文章:
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 如何用RISC-V GD32VF103CBT6开发板卸载精确的ADC过采样
- 无法使用加载库卸载注入的 dll (C++)
- std::thread 增加 DLL 引用计数,从而防止卸载 DLL
- 为什么有些延迟加载 DLL 会立即使用 FFMPEG 卸载?
- 如何根据 DLL 端的请求卸载 DLL 模块以卸载它?
- 通知 Windows 系统应用程序字体已被卸载/删除
- 如何从目标进程卸载 DLL?
- 用于 OpenMP 4.5 卸载到 (GPU) 设备的 NVPTX GCC (9.0.0/trunk) 找不到 libg
- 卸载共享对象(.so 文件)在 C++ 中用 dlopen() 打开
- 按名称问题获取卸载应用程序路径
- 英特尔C++编译器 19.0 测试版中删除了对英特尔®图形技术的卸载支持
- libcoi_device.so.0 未找到英特尔 19.0.4 OpenMP 5.0 卸载编译错误
- OpenMP卸载到Nvidia错误还原
- 如何在C/C++中从运行时卸载内存偏移量计算
- 为什么我的MFC应用程序在打开/运行时也不显示消息就被卸载了
- 无法从 C# 运行 C++ clr dll - Dll 已卸载?
- 如果在WM/CE平台中用于卸载,DMProcessConfigXML将关闭正在运行的应用程序
- 如何在QT5中从qmake“进行卸载”期间运行自定义命令