Protect against error in user home directory computation
[clon.git] / Makefile
bloba094ebe18cf80dfa934ce0bd5feea3ada5810ab4
1 ### Makefile --- Toplevel directory
3 ## Copyright (C) 2010, 2011, 2012 Didier Verna.
5 ## Author: Didier Verna <didier@lrde.epita.fr>
6 ## Maintainer: Didier Verna <didier@lrde.epita.fr>
8 ## This file is part of CLon
10 ## Permission to use, copy, modify, and distribute this software for any
11 ## purpose with or without fee is hereby granted, provided that the above
12 ## copyright notice and this permission notice appear in all copies.
14 ## THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 ## WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 ## MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 ## ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 ## ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 ## OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ### Commentary:
25 ## Contents management by FCM version 0.1.
27 ## Please use GNU Make with this makefile.
30 ### Code:
32 TOP_DIR := .
34 include $(TOP_DIR)/Makefile.cnf
36 hack: all
38 include $(TOP_DIR)/Makefile.inc
39 ifeq ($(LISP),CLISP)
40 include $(TOP_DIR)/clisp.inc
41 endif
42 include $(TOP_DIR)/version.inc
45 SUBDIRS := termio src share doc demos
46 DIST_NAME := $(PROJECT)-$(SHORT_VERSION)
47 TARBALL := $(DIST_NAME).tar.gz
48 SIGNATURE := $(TARBALL).asc
50 all:
51 $(MAKE) gen TARGET=all
52 $(MAKE) INSTALL
54 all-formats dvi ps ref all-formats-ref dvi-ref ps-ref:
55 cd doc && $(MAKE) $@
57 # Needed because we have an INSTALL file which fucks up the gen mechanism
58 # (remember that Mac OSX is case-insensitive).
59 install:
60 $(MAKE) gen TARGET=install
62 uninstall:
63 $(MAKE) gen TARGET=uninstall
65 clean:
66 -rm *~
67 $(MAKE) gen TARGET=clean
69 # #### NOTE: be sure to propagate to the subdirs first, otherwise, version.inc
70 # will keep on being reconstructed.
71 distclean: clean
72 $(MAKE) gen TARGET=distclean
73 ifeq ($(LISP),CLISP)
74 -rm .clisp.cnf
75 endif
76 -rm *.tar.gz *.tar.gz.asc
77 -rm -fr version.inc
78 -rm -fr $($(LISP)_BINLOC)-*
79 -rm -fr "${HOME}"/.cache/common-lisp/$($(LISP)_CACHE)-*"`pwd`"
81 tag:
82 git tag -a -m 'Version $(LONG_VERSION)' 'version-$(SHORT_VERSION)'
84 tar: $(TARBALL)
85 gpg: $(SIGNATURE)
86 dist: tar gpg
88 install-www: dist
89 -install -m 644 $(TARBALL) "$(W3DIR)/attic/"
90 -install -m 644 $(SIGNATURE) "$(W3DIR)/attic/"
91 echo "\
92 <? lref (\"$(PROJECT)/attic/$(PROJECT)-$(SHORT_VERSION).tar.gz\", \
93 contents (\"Dernière version\", \"Latest version\")); ?> \
94 | \
95 <? lref (\"$(PROJECT)/attic/$(PROJECT)-$(SHORT_VERSION).tar.gz.asc\", \
96 contents (\"Signature GPG\", \"GPG Signature\")); ?>" \
97 > "$(W3DIR)/latest.txt"
98 chmod 644 "$(W3DIR)/latest.txt"
99 git push --tags "$(W3DIR)/$(PROJECT).git" :
100 $(MAKE) gen TARGET=install-www
101 cd "$(W3DIR)" \
102 && ln -fs attic/$(TARBALL) latest.tar.gz \
103 && ln -fs attic/$(SIGNATURE) latest.tar.gz.asc
105 update-version:
106 cd doc && $(MAKE) $@
108 gen:
109 @for i in $(SUBDIRS) ; do \
110 echo "making $(TARGET) in $${i} ..." ; \
111 ( cd $${i} && $(MAKE) $(TARGET) ) ; \
112 done
114 INSTALL: doc/$(PROJECT)-user.info
115 info --file=./doc/$(PROJECT)-user.info \
116 -n Installation \
117 -n Configuration \
118 -n 'Non-ANSI Features' \
119 -n 'Supported Platforms' \
120 --output=$@
121 perl -pi -e 's/^File:.*\n//g' $@
123 doc/$(PROJECT)-user.info:
124 cd doc && $(MAKE) $(PROJECT)-user.info
126 $(TARBALL):
127 git archive --format=tar --prefix=$(DIST_NAME)/ \
128 --worktree-attributes HEAD \
129 | gzip -c > $@
131 $(SIGNATURE): $(TARBALL)
132 gpg -b -a $<
134 .DEFAULT:
135 $(MAKE) gen TARGET=$@
137 .PHONY: hack all \
138 all-formats dvi ps ref all-formats-ref dvi-ref ps-ref \
139 install install-ref uninstall \
140 clean distclean \
141 tag tar gpg dist install-www \
142 update-version \
146 ### Makefile ends here