File: Makefile

package info (click to toggle)
whizzytex 1.5.0-0.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,536 kB
  • sloc: lisp: 3,668; sh: 1,768; makefile: 227
file content (170 lines) | stat: -rw-r--r-- 4,860 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
include Makefile.config

# REMOTE INSTALLATION
# The prefix to add in front of all files during installation. 

DESTDIR=


SRC=src
TMP=tmp
INSTALLX=install
INSTALLR=install -m 0644

INSTALLED = whizzytex.installed

what:
	@echo 'make what? [ config all install clean distclean uninstall ]'

Makefile.config: 
	@echo '--- Creating default configuration Makefile.config'
	@echo '--- You may edit it or run "make config" for customization'
	cp $@.in $@

ALL = $(TMP)/whizzytex $(TMP)/whizzytex.el \
	$(patsubst %,$(TMP)/%/whizzytex.elc, $(EMACS) $(XEMACS))

.PHONY: all
all: config.checked $(ALL)

.PHONY: config config.force

config: 
	bash ./configure

config.checked: Makefile.config 
	bash ./checkconfig config.checked

config.force: 
	touch config.checked

$(TMP): 
	rm -f $(TMP)
	mkdir -p $@ 

$(TMP)/whizzytex.el: $(SRC)/whizzytex.el $(TMP) Makefile.config
ifndef ADVI
	sed -e 's|\((defvar whizzy-command-name "\)[^"]*\(".*\)|\1$(BINDIR)/whizzytex\2|' \
	    -e 's|^\( *\)\(("-advi[^)]*")\) *\(("-dvi[^)]*")\)|\1\3 \2|' \
	 <  $< > $@
else
	sed -e 's|\((defvar whizzy-command-name "\)[^"]*\(".*\)|\1$(BINDIR)/whizzytex\2|' \
	 <  $< > $@
endif

ifdef EMACS
$(TMP)/$(EMACS): $(TMP)
	mkdir -p $@

$(TMP)/$(EMACS)/whizzytex.elc: $(TMP)/$(EMACS) 
$(TMP)/$(EMACS)/whizzytex.elc: $(TMP)/whizzytex.el byte-compile.el 
	cd $(TMP)/$(EMACS); cp ../whizzytex.el .; \
	$(EMACS) -batch -q -no-site-file -l ../../byte-compile.el
endif

ifdef XEMACS
$(TMP)/$(XEMACS): $(TMP)
	mkdir -p $@

$(TMP)/$(XEMACS)/whizzytex.elc: $(TMP)/$(XEMACS)
$(TMP)/$(XEMACS)/whizzytex.elc: $(TMP)/whizzytex.el byte-compile.el 
	cd $(TMP)/$(XEMACS); cp ../whizzytex.el .; \
	$(XEMACS) -batch -q -no-site-file -l ../../byte-compile.el
endif

$(TMP)/whizzytex: $(SRC)/whizzytex $(TMP) Makefile.config
	sed -e '1s|^#!/bin/bash *$$|#!$(BASH)|' \
	    -e 's|^PACKAGE=.*|PACKAGE=$(LATEXDIR)/whizzytex.sty|' \
	    -e 's|^MULTIPLE=.*|MULTIPLE=$(MULTIPLE)|' \
	    -e 's|^DVIPS=.*|DVIPS="$(DVIPS)"|' \
	    -e 's|^CONFIGFILE=.*|CONFIGFILE=$(CONFIGFILE)|' \
	    -e 's|^INITEX=.*|INITEX="$(INITEX)"|' \
	    -e 's|^LATEX=.*|LATEX="$(LATEX)"|' \
	    -e 's|^FORMAT=.*|FORMAT="$(FORMAT)"|' \
	    -e 's|^FMT=.*|FMT=$(FMT)|' \
	    -e 's|^BIBTEX=.*|BIBTEX="$(BIBTEX)"|' \
	 <  $< > $@
	chmod +x $@

ifdef EMACSDIR
whizzytex-emacs-init.el: $(SRC)/whizzytex-init.el
	@sed -e 's|^\( *"\)[^ ]*\(" *\)$$|\1$(EMACSDIR)/whizzytex\2|' $<
endif

ifdef XEMACSDIR
whizzytex-xemacs-init.el: $(SRC)/whizzytex-init.el
	@sed -e 's|^\( *"\)[^ ]*\(" *\)$$|\1$(XEMACSDIR)/whizzytex\2|' $<
endif

.PHONY: install
install: all
	@[ -f config.checked ] || ( \
	echo 'Warning!' && \
	echo '  Your Makefile.config has not been checked.' && \
	echo '  Run "make config.checked" (or "make all") to check it,' && \
	echo '  or  "make config.force"  to accept it as is.' && \
	false)
ifdef EMACSDIR
	rm -f $(INSTALLED)
	mkdir -p $(DESTDIR)$(EMACSDIR)
	$(INSTALLR) $(TMP)/whizzytex.el $(DESTDIR)$(EMACSDIR)
	echo $(DESTDIR)$(EMACSDIR)/whizzytex.el >> $(INSTALLED)
	rm -f $(DESTDIR)$(EMACSDIR)/whizzytex.elc
ifdef EMACS
	$(INSTALLR) $(TMP)/$(EMACS)/whizzytex.elc $(DESTDIR)$(EMACSDIR)
	echo $(DESTDIR)$(EMACSDIR)/whizzytex.elc >> $(INSTALLED)
endif
endif
ifdef XEMACSDIR
	mkdir -p $(DESTDIR)$(XEMACSDIR)
	$(INSTALLR) $(TMP)/whizzytex.el $(DESTDIR)$(XEMACSDIR)
	echo $(DESTDIR)$(XEMACSDIR)/whizzytex.el >> $(INSTALLED)
	rm -f $(DESTDIR)$(XEMACSDIR)/whizzytex.elc
ifdef XEMACS
	cp $(TMP)/$(XEMACS)/whizzytex.elc $(DESTDIR)$(XEMACSDIR)
	echo $(DESTDIR)$(XEMACSDIR)/whizzytex.elc >> $(INSTALLED)
endif
endif
	mkdir -p $(DESTDIR)$(BINDIR)
	$(INSTALLX) $(TMP)/whizzytex $(DESTDIR)$(BINDIR)
	echo $(DESTDIR)$(BINDIR)/whizzytex >> $(INSTALLED)
	mkdir -p $(DESTDIR)$(LATEXDIR) 
	$(INSTALLR) $(SRC)/whizzytex.sty $(DESTDIR)$(LATEXDIR)
	echo $(DESTDIR)$(LATEXDIR)/whizzytex.sty >> $(INSTALLED)
	mkdir -p $(DESTDIR)$(DOCDIR) 
	$(INSTALLR) doc/whizzytex.html doc/whizzytex00[1-3].png COPYING GPL INSTALL $(DESTDIR)$(DOCDIR)
	for i in doc/whizzytex.html doc/whizzytex00[1-3].png COPYING GPL INSTALL; \
	 do echo $(DOCDIR)/$$i; done >> $(INSTALLED)

where:
ifdef EMACSDIR
	@echo 'Emacs Lisp in EMACSDIR=$(DESTDIR)$(EMACSDIR)'
ifdef EMACS
	@echo 'Byte-compiled Emacs Lisp in EMACSDIR=$(DESTDIR)$(EMACSDIR)'
endif
endif
ifdef XEMACSDIR
	@echo 'XEmacs Lisp in XEMACSDIR=$(XEMACSDIR)'
ifdef XEMACS
	@echo 'Byte-compiled XEmacs Lisp  in XEMACSDIR=$(DESTDIR)$(XEMACSDIR)'
endif
endif
	@echo 'Script  in BINDIR=$(DESTDIR)$(BINDIR)'
	@echo 'Latex macros  in LATEXDIR=$(DESTDIR)$(LATEXDIR)'
	@echo 'Documentation  in DOCDIR=$(DESTDIR)$(DOCDIR)'

.PHONY: uninstall
uninstall: $(INSTALLED)
	rm -f `cat $(INSTALLED)`
	rm -f $(INSTALLED)


clean::
	rm -rf $(TMP)
	rm -f latex.fmt initex.log latex.log dvips.log
	rm -f dummy.{tex,fmt,log,aux,dvi,ps}
	rm -f config.error config.sed
	cd examples; make clean

distclean:: clean
	rm -f Makefile.config config.checked