make: Add uninstall target

This commit is contained in:
Christian Franke 2018-10-19 09:49:44 +02:00 committed by Daniel Marjamäki
parent 402d0c565f
commit f228897641
2 changed files with 33 additions and 0 deletions

View File

@ -300,6 +300,23 @@ ifdef CFGDIR
install -m 644 cfg/* ${DESTDIR}${CFGDIR} install -m 644 cfg/* ${DESTDIR}${CFGDIR}
endif endif
uninstall:
@if test -d ${BIN}; then \
files="cppcheck cppcheck-htmlreport \
`ls -d addons/*.py addons/*/*.py 2>/dev/null | sed 's,^.*/,,'`"; \
echo '(' cd ${BIN} '&&' rm -f $$files ')'; \
( cd ${BIN} && rm -f $$files ); \
fi
ifdef CFGDIR
@if test -d ${DESTDIR}${CFGDIR}; then \
files="`cd cfg 2>/dev/null && ls`"; \
if test -n "$$files"; then \
echo '(' cd ${DESTDIR}${CFGDIR} '&&' rm -f $$files ')'; \
( cd ${DESTDIR}${CFGDIR} && rm -f $$files ); \
fi; \
fi
endif
# Validation of library files: # Validation of library files:
ConfigFiles := $(wildcard cfg/*.cfg) ConfigFiles := $(wildcard cfg/*.cfg)
ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles)) ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))

View File

@ -400,6 +400,22 @@ int main(int argc, char **argv)
fout << "\tinstall -d ${DESTDIR}${CFGDIR}\n"; fout << "\tinstall -d ${DESTDIR}${CFGDIR}\n";
fout << "\tinstall -m 644 cfg/* ${DESTDIR}${CFGDIR}\n"; fout << "\tinstall -m 644 cfg/* ${DESTDIR}${CFGDIR}\n";
fout << "endif\n\n"; fout << "endif\n\n";
fout << "uninstall:\n";
fout << "\t@if test -d ${BIN}; then \\\n";
fout << "\t files=\"cppcheck cppcheck-htmlreport \\\n";
fout << "\t `ls -d addons/*.py addons/*/*.py 2>/dev/null | sed 's,^.*/,,'`\"; \\\n";
fout << "\t echo '(' cd ${BIN} '&&' rm -f $$files ')'; \\\n";
fout << "\t ( cd ${BIN} && rm -f $$files ); \\\n";
fout << "\tfi\n";
fout << "ifdef CFGDIR \n";
fout << "\t@if test -d ${DESTDIR}${CFGDIR}; then \\\n";
fout << "\t files=\"`cd cfg 2>/dev/null && ls`\"; \\\n";
fout << "\t if test -n \"$$files\"; then \\\n";
fout << "\t echo '(' cd ${DESTDIR}${CFGDIR} '&&' rm -f $$files ')'; \\\n";
fout << "\t ( cd ${DESTDIR}${CFGDIR} && rm -f $$files ); \\\n";
fout << "\t fi; \\\n";
fout << "\tfi\n";
fout << "endif\n\n";
fout << "# Validation of library files:\n"; fout << "# Validation of library files:\n";
fout << "ConfigFiles := $(wildcard cfg/*.cfg)\n"; fout << "ConfigFiles := $(wildcard cfg/*.cfg)\n";
fout << "ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))\n"; fout << "ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))\n";