* lib/am/texi-vers.am, lib/am/subdirs.am, lib/am/scripts.am,
[platform/upstream/automake.git] / lib / am / lisp.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003
3 ## Free Software Foundation, Inc.
4
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA.
19
20
21 ## ---------- ##
22 ## Building.  ##
23 ## ---------- ##
24
25 elc-stamp: $(am__ELFILES)
26         @echo 'WARNING: Warnings can be ignored. :-)'
27         if test $(EMACS) != no; then \
28 ## Make sure "$@" isn't empty initialy.
29           set x; \
30 ## Populate "$@" whith elisp files (found in the current directory
31 ## or in $srcdir).
32           list='$(am__ELFILES)'; for p in $$list; do \
33             if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
34             set x "$$@" "$$d$$p"; shift; \
35           done; \
36 ## Finally call elisp-comp for all files.
37           shift; \
38           EMACS=$(EMACS) $(SHELL) $(elisp_comp) "$$@" || exit 1; \
39         else : ; fi
40         touch $@
41
42 .el.elc:
43 ## Recover from the removal of $@
44         @if test ! -f $@; then \
45           rm -f elc-stamp; \
46           $(MAKE) $(AM_MAKEFLAGS) elc-stamp; \
47         else : ; fi
48
49 ## ------------ ##
50 ## Installing.  ##
51 ## ------------ ##
52
53 if %?INSTALL%
54 am__installdirs += $(DESTDIR)$(%NDIR%dir)
55 ?BASE?%DIR%LISP_INSTALL = $(INSTALL_DATA)
56 ?!BASE?%DIR%LISP_INSTALL = $(install_sh_DATA)
57 ?EXEC?.PHONY install-exec-am: install-%DIR%LISP
58 ?!EXEC?.PHONY install-data-am: install-%DIR%LISP
59 install-%DIR%LISP: $(%DIR%_LISP) $(ELCFILES)
60         @$(NORMAL_INSTALL)
61 ## lispdir might not be defined.
62         @if test -n "$(lispdir)"; then \
63           $(mkinstalldirs) $(DESTDIR)$(%NDIR%dir); \
64 ## Funny invocation because Makefile variable can be empty, leading to
65 ## a syntax error in sh.
66           list='$(%DIR%_LISP)'; for p in $$list; do \
67 ## A lisp file can be in the source directory or the build directory.
68             if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
69 ?BASE?      f="`echo $$p | sed -e 's|^.*/||'`"; \
70 ?!BASE?     f="$$p"; \
71             echo " $(%DIR%LISP_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
72             $(%DIR%LISP_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
73 ## Only install .elc file if it exists.
74             if test -f $${p}c; then \
75               echo " $(%DIR%LISP_INSTALL) $${p}c $(DESTDIR)$(%NDIR%dir)/$${f}c"; \
76               $(%DIR%LISP_INSTALL) $${p}c $(DESTDIR)$(%NDIR%dir)/$${f}c; \
77             else : ; fi; \
78           done; \
79         else : ; fi
80 endif %?INSTALL%
81
82
83 ## -------------- ##
84 ## Uninstalling.  ##
85 ## -------------- ##
86
87 if %?INSTALL%
88 .PHONY uninstall-am: uninstall-%DIR%LISP
89 uninstall-%DIR%LISP:
90         @$(NORMAL_UNINSTALL)
91 ## lispdir might not be defined.
92         @if test -n "$(lispdir)"; then \
93           list='$(%DIR%_LISP)'; for p in $$list; do \
94 ?BASE?      f="`echo $$p | sed -e 's|^.*/||'`"; \
95 ?!BASE?     f="$$p"; \
96             echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f $(DESTDIR)$(%NDIR%dir)/$${f}c"; \
97             rm -f $(DESTDIR)$(%NDIR%dir)/$$f $(DESTDIR)$(%NDIR%dir)/$${f}c; \
98           done; \
99         else : ; fi
100 endif %?INSTALL%
101
102
103 ## ---------- ##
104 ## Cleaning.  ##
105 ## ---------- ##
106
107 .PHONY clean-am: clean-lisp
108 clean-lisp:
109         -rm -f elc-stamp $(ELCFILES)
110
111
112 ## -------------- ##
113 ## Distributing.  ##
114 ## -------------- ##
115
116 if %?DIST%
117 DIST_COMMON += $(%DIR%_LISP)
118 endif %?DIST%