[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
makefile uninstall somewhat aggressive?
From: |
Hugh Sasse |
Subject: |
makefile uninstall somewhat aggressive? |
Date: |
Fri, 3 Mar 2006 19:40:38 +0000 (WET) |
The makefile for lout has an uninstall step that is somewhat aggressive
in that it removes everything in the $(LIBDIR). May I suggest the
following patch which simplifies some other things, too?
Hugh
--- lout-3.31/makefile 2005-08-24 00:45:25.000000000 +0100
+++ lout-3.31/makefile.new 2006-03-03 19:36:07.370896000 +0000
@@ -271,6 +271,14 @@
LIBHYPH = hyph
LIBLOCA = locale
+# Frequently used compound 'words'...
+INCLDIR = $(LIBDIR)/$(LIBINCL)
+DATADIR = $(LIBDIR)/$(LIBDATA)
+HYPHDIR = $(LIBDIR)/$(LIBHYPH)
+FONTDIR = $(LIBDIR)/$(LIBFONT)
+MAPSDIR = $(LIBDIR)/$(LIBMAPS)
+LOCADIR = $(LIBDIR)/$(LIBLOCA)
+
CHARIN = 1
CHAROUT = 0
@@ -333,7 +341,19 @@
$(CC) $(COPTS) -o prg2lout prg2lout.c
chmod a+x prg2lout
-install: lout prg2lout
+$(LIBDIR):
+ mkdir -p $@
+ chmod 755 $@
+
+# For any of these targets do the smae thing.
+$(INCLDIR) $(DATADIR) $(HYPHDIR) $(FONTDIR) $(MAPSDIR) $(LOCADIR): $(LIBDIR)
+ -mkdir $@
+ chmod 755 $@
+
+# Changed the commands below so only the files we've copied get treated
+# by chmod.
+install: lout prg2lout $(INCLDIR) $(DATADIR) $(HYPHDIR) $(FONTDIR) $(MAPSDIR) \
+ $(LOCADIR)
@echo ""
@echo "(a) Installing lout and prg2lout binaries into BINDIR $(BINDIR)"
cp lout $(BINDIR)/lout
@@ -342,43 +362,39 @@
chmod 755 $(BINDIR)/prg2lout
@echo ""
@echo "(b) Installing library files into LIBDIR $(LIBDIR)"
- mkdir $(LIBDIR)
- chmod 755 $(LIBDIR)
@echo ""
- mkdir $(LIBDIR)/$(LIBINCL)
- chmod 755 $(LIBDIR)/$(LIBINCL)
- cp include/* $(LIBDIR)/$(LIBINCL)
- chmod 644 $(LIBDIR)/$(LIBINCL)/*
- @echo ""
- mkdir $(LIBDIR)/$(LIBDATA)
- chmod 755 $(LIBDIR)/$(LIBDATA)
- cp data/* $(LIBDIR)/$(LIBDATA)
- chmod 644 $(LIBDIR)/$(LIBDATA)/*
- @echo ""
- mkdir $(LIBDIR)/$(LIBHYPH)
- chmod 755 $(LIBDIR)/$(LIBHYPH)
- cp hyph/* $(LIBDIR)/$(LIBHYPH)
- chmod 644 $(LIBDIR)/$(LIBHYPH)/*
- @echo ""
- mkdir $(LIBDIR)/$(LIBFONT)
- chmod 755 $(LIBDIR)/$(LIBFONT)
- cp font/* $(LIBDIR)/$(LIBFONT)
- chmod 644 $(LIBDIR)/$(LIBFONT)/*
- @echo ""
- mkdir $(LIBDIR)/$(LIBMAPS)
- chmod 755 $(LIBDIR)/$(LIBMAPS)
- cp maps/* $(LIBDIR)/$(LIBMAPS)
- chmod 644 $(LIBDIR)/$(LIBMAPS)/*
+ for i in include/* ; do \
+ cp $$i $(INCLDIR); \
+ chmod 644 $(INCLDIR)/`basename $$i`; \
+ done
+ @echo ""
+ for i in data/* ; do \
+ cp $$i $(DATADIR); \
+ chmod 644 $(DATADIR)/`basename $$i`; \
+ done
+ @echo ""
+ for i in hyph/* ; do \
+ cp $$i $(HYPHDIR); \
+ chmod 644 $(HYPHDIR)/`basename $$i`; \
+ done
+ @echo ""
+ for i in font/* ; do \
+ cp $$i $(FONTDIR); \
+ chmod 644 $(FONTDIR)/`basename $$i`; \
+ done
+ @echo ""
+ for i in maps/* ; do \
+ cp $$i $(MAPSDIR); \
+ chmod 644 $(MAPSDIR)/`basename $$i`; \
+ done
@echo ""
- mkdir $(LIBDIR)/$(LIBLOCA)
- chmod 755 $(LIBDIR)/$(LIBLOCA)
@echo ""
@echo "(c) Initializing run (should be silent, no errors expected)"
- $(BINDIR)/lout -x -s $(LIBDIR)/$(LIBINCL)/init
+ $(BINDIR)/lout -x -s $(INCLDIR)/init
@echo ""
@echo "(d) Changing mode of files just created by initializing run"
- chmod 644 $(LIBDIR)/$(LIBDATA)/*
- chmod 644 $(LIBDIR)/$(LIBHYPH)/*
+ chmod 644 $(DATADIR)/*
+ chmod 644 $(HYPHDIR)/*
installman:
@echo ""
@@ -400,31 +416,41 @@
installfr:
@echo ""
- @echo "Putting French error messages into
$(LIBDIR)/$(LIBLOCA)/$(LOC_FR)"
- mkdir $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)
- chmod 755 $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)
- mkdir $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)/LC_MESSAGES
- chmod 755 $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)/LC_MESSAGES
- cp locale/msgs.fr
$(LIBDIR)/$(LIBLOCA)/$(LOC_FR)/LC_MESSAGES/msgs.$(LOC_FR)
- gencat $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)/LC_MESSAGES/errors.$(LOC_FR)
\
- $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)/LC_MESSAGES/msgs.$(LOC_FR)
- chmod 644 $(LIBDIR)/$(LIBLOCA)/$(LOC_FR)/LC_MESSAGES/*
+ @echo "Putting French error messages into $(LOCADIR)/$(LOC_FR)"
+ mkdir $(LOCADIR)/$(LOC_FR)
+ chmod 755 $(LOCADIR)/$(LOC_FR)
+ mkdir $(LOCADIR)/$(LOC_FR)/LC_MESSAGES
+ chmod 755 $(LOCADIR)/$(LOC_FR)/LC_MESSAGES
+ cp locale/msgs.fr $(LOCADIR)/$(LOC_FR)/LC_MESSAGES/msgs.$(LOC_FR)
+ gencat $(LOCADIR)/$(LOC_FR)/LC_MESSAGES/errors.$(LOC_FR) \
+ $(LOCADIR)/$(LOC_FR)/LC_MESSAGES/msgs.$(LOC_FR)
+ chmod 644 $(LOCADIR)/$(LOC_FR)/LC_MESSAGES/*
installde:
@echo ""
- @echo "Putting German error messages into
$(LIBDIR)/$(LIBLOCA)/$(LOC_DE)"
- mkdir $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)
- chmod 755 $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)
- mkdir $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)/LC_MESSAGES
- chmod 755 $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)/LC_MESSAGES
- cp locale/msgs.de
$(LIBDIR)/$(LIBLOCA)/$(LOC_DE)/LC_MESSAGES/msgs.$(LOC_DE)
- gencat $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)/LC_MESSAGES/errors.$(LOC_DE)
\
- $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)/LC_MESSAGES/msgs.$(LOC_DE)
- chmod 644 $(LIBDIR)/$(LIBLOCA)/$(LOC_DE)/LC_MESSAGES/*
-
+ @echo "Putting German error messages into $(LOCADIR)/$(LOC_DE)"
+ mkdir $(LOCADIR)/$(LOC_DE) || true
+ chmod 755 $(LOCADIR)/$(LOC_DE)
+ mkdir $(LOCADIR)/$(LOC_DE)/LC_MESSAGES || true
+ chmod 755 $(LOCADIR)/$(LOC_DE)/LC_MESSAGES
+ cp locale/msgs.de $(LOCADIR)/$(LOC_DE)/LC_MESSAGES/msgs.$(LOC_DE)
+ gencat $(LOCADIR)/$(LOC_DE)/LC_MESSAGES/errors.$(LOC_DE) \
+ $(LOCADIR)/$(LOC_DE)/LC_MESSAGES/msgs.$(LOC_DE)
+ chmod 644 $(LOCADIR)/$(LOC_DE)/LC_MESSAGES/*
+
+# Note, remove the subdirectories of libdir we have created, but
+# don't clobber the library directory as a whole because other
+# things may live there. If it is empty then we can. If they'd
+# installed it in /usr/lib for example...
uninstall:
-rm -f $(BINDIR)/lout $(BINDIR)/prg2lout
- -rm -fr $(LIBDIR)
+ -rm -fr $(INCLDIR)
+ -rm -fr $(DATADIR)
+ -rm -fr $(HYPHDIR)
+ -rm -fr $(FONTDIR)
+ -rm -fr $(MAPSDIR)
+ -rm -fr $(LOCADIR)
+ -rmdir $(LIBDIR)
-rm -fr $(DOCDIR)
-rm -f $(MANDIR)/lout.1 $(MANDIR)/prg2lout.1
- makefile uninstall somewhat aggressive?,
Hugh Sasse <=
- Re: makefile uninstall somewhat aggressive?, Jeff Kingston, 2006/03/03
- Re: makefile uninstall somewhat aggressive?, Hugh Sasse, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Hugh Sasse, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Michael Piotrowski, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Hugh Sasse, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Andreas Kahari, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Hugh Sasse, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Michael Piotrowski, 2006/03/06
- Re: makefile uninstall somewhat aggressive?, Hugh Sasse, 2006/03/06
Re: makefile uninstall somewhat aggressive?, Jeff Kingston, 2006/03/06