Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Makefile with the following configured for installing man pages

MANDIR = /usr/share/man/man1

MANPAGES = exec1.1 exec2.1

make install triggers the following:

install: $(MANPAGES) install $(MANPAGES) $(MANDIR)

I want to have a make uninstall which will undo this process.

Effectively, I need to do an rm -rf $(MANDIR)/$(MANPAGE) for each man page

Lots of ways I could probably do this, including loops, etc. Any quick tricks though for having rm -rf delete a list of files from a specified folder?

share|improve this question

1 Answer 1

up vote 1 down vote accepted
uninstall:
        rm -f $(addprefix $(MANDIR), $(MANPAGES))
.PHONY: uninstall

Note: make sure you use a [TAB] instead of eight spaces.

share|improve this answer
    
I'd forgotten about addprefix -- I don't work in make land often enough to remember those tricks. Thanks (and thanks for the TAB reminder). –  BSchlinker May 2 at 19:54
    
@BSchlinker: if it works, would you please up-vote / mark accepted. Thanks! –  JoeNahmias May 2 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.