Skip to content

Commit f228897

Browse files
chrfrankedanmar
authored andcommitted
make: Add uninstall target
1 parent 402d0c5 commit f228897

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,23 @@ ifdef CFGDIR
300300
install -m 644 cfg/* ${DESTDIR}${CFGDIR}
301301
endif
302302

303+
uninstall:
304+
@if test -d ${BIN}; then \
305+
files="cppcheck cppcheck-htmlreport \
306+
`ls -d addons/*.py addons/*/*.py 2>/dev/null | sed 's,^.*/,,'`"; \
307+
echo '(' cd ${BIN} '&&' rm -f $$files ')'; \
308+
( cd ${BIN} && rm -f $$files ); \
309+
fi
310+
ifdef CFGDIR
311+
@if test -d ${DESTDIR}${CFGDIR}; then \
312+
files="`cd cfg 2>/dev/null && ls`"; \
313+
if test -n "$$files"; then \
314+
echo '(' cd ${DESTDIR}${CFGDIR} '&&' rm -f $$files ')'; \
315+
( cd ${DESTDIR}${CFGDIR} && rm -f $$files ); \
316+
fi; \
317+
fi
318+
endif
319+
303320
# Validation of library files:
304321
ConfigFiles := $(wildcard cfg/*.cfg)
305322
ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))

tools/dmake.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,22 @@ int main(int argc, char **argv)
400400
fout << "\tinstall -d ${DESTDIR}${CFGDIR}\n";
401401
fout << "\tinstall -m 644 cfg/* ${DESTDIR}${CFGDIR}\n";
402402
fout << "endif\n\n";
403+
fout << "uninstall:\n";
404+
fout << "\t@if test -d ${BIN}; then \\\n";
405+
fout << "\t files=\"cppcheck cppcheck-htmlreport \\\n";
406+
fout << "\t `ls -d addons/*.py addons/*/*.py 2>/dev/null | sed 's,^.*/,,'`\"; \\\n";
407+
fout << "\t echo '(' cd ${BIN} '&&' rm -f $$files ')'; \\\n";
408+
fout << "\t ( cd ${BIN} && rm -f $$files ); \\\n";
409+
fout << "\tfi\n";
410+
fout << "ifdef CFGDIR \n";
411+
fout << "\t@if test -d ${DESTDIR}${CFGDIR}; then \\\n";
412+
fout << "\t files=\"`cd cfg 2>/dev/null && ls`\"; \\\n";
413+
fout << "\t if test -n \"$$files\"; then \\\n";
414+
fout << "\t echo '(' cd ${DESTDIR}${CFGDIR} '&&' rm -f $$files ')'; \\\n";
415+
fout << "\t ( cd ${DESTDIR}${CFGDIR} && rm -f $$files ); \\\n";
416+
fout << "\t fi; \\\n";
417+
fout << "\tfi\n";
418+
fout << "endif\n\n";
403419
fout << "# Validation of library files:\n";
404420
fout << "ConfigFiles := $(wildcard cfg/*.cfg)\n";
405421
fout << "ConfigFilesCHECKED := $(patsubst %.cfg,%.checked,$(ConfigFiles))\n";

0 commit comments

Comments
 (0)