1 # $Id: Makefile.in 6449 2008-01-30 14:56:21Z martin $
3 # Makefile for kpathsea. Public domain.
4 version = @KPSEVERSION@
6 # Add -DNO_DEBUG to disable debugging, for vanishingly better performance.
8 kpse_include ../make/paths.mk
9 kpse_include ../make/makevars.mk
10 kpse_include ../make/common.mk
11 kpse_include ../make/library.mk
12 kpse_include ../make/programs.mk
13 kpse_include ../make/texi.mk
15 @MAINT@warn_more = -Wmissing-prototypes -Wwrite-strings -Wshadow
16 @MAINT@MAKEINFO_FLAGS := $(MAKEINFO_FLAGS) --no-split
18 # Install these header files (except acconfig.h).
19 install_headers = *.h $(srcdir)/*.h
21 # Put tex-file.o first, because it's what depends on the paths, and may
22 # reduce frustration if the paths are wrong by doing it first.
24 objects = tex-file.lo absolute.lo atou.lo cnf.lo concat.lo concat3.lo \
25 concatn.lo db.lo debug.lo dir.lo elt-dirs.lo expand.lo extend-fname.lo \
26 file-p.lo find-suffix.lo fn.lo fontmap.lo getopt.lo getopt1.lo hash.lo \
27 kdefault.lo line.lo magstep.lo make-suffix.lo path-elt.lo \
28 pathsearch.lo proginit.lo progname.lo readable.lo rm-suffix.lo \
29 str-list.lo str-llist.lo tex-glyph.lo tex-hush.lo tex-make.lo \
30 tilde.lo truncate.lo uppercasify.lo variable.lo version.lo xbasename.lo \
31 xcalloc.lo xdirname.lo xfopen.lo xfseek.lo xftell.lo xgetcwd.lo xmalloc.lo \
32 xopendir.lo xputenv.lo xrealloc.lo xstat.lo xstrdup.lo $(liblobjs) $(malloc) \
33 error.lo filename.lo home.lo lookcmd.lo string.lo system.lo time.lo user.lo \
35 liblobjs = @LTLIBOBJS@
39 # We want to compile almost everything with libtool ...
40 KPATHSEA_CC = $(LIBTOOL) --mode=compile $(CC)
43 $(KPATHSEA_CC) $(ALL_CFLAGS) -DMAKE_KPSE_DLL -c $<
45 default all: kpsewhich kpsestat kpseaccess kpsereadlink $(library).info manfiles
47 kpsewhich: $(kpathsea) kpsewhich.o
48 $(kpathsea_link) kpsewhich.o $(LOADLIBES)
51 $(link_command) kpsestat.o
54 $(link_command) access.o
56 kpsereadlink: readlink.o
57 $(link_command) readlink.o
59 $(kpathsea): $(objects)
60 $(kpathsea_link) -rpath $(libdir) -version-info 4:0:0 $(objects)
62 # Make variable substitutions for paths.h.
63 texmf.cnf: texmf.in texmf.sed
64 sed -f texmf.sed $(srcdir)/texmf.in >$@
66 # The idea is to turn each var=value into s%@var@%value%g. Seems simpler
67 # to put the substitutions in a file than to play shell quoting games.
72 | sed -e 's/^/s%@/' -e 's/=/@%/' -e 's/$$/%g/' \
74 # Insert $TEXMF in as many of the hardwired paths as possible. We could
75 # use the slightly different rule 's%$(texmf)/%\$$TEXMF/%g' and avoid
76 # the need for the corrections below. But if texmf.in is edited
77 # the heuristic may no longer work.
78 echo 's%$(texmf)%\$$TEXMF%g' >>$@
79 # Now we repair the damage this may have caused. Don't replace the rhs of
80 # the TEXMFMAIN assignment itself, then we'd end up with TEXMFMAIN = $TEXMF
81 # and TEXMF = $TEXMFMAIN. The (commented) assignment of TEXMFLOCAL is
82 # likely to have been mangled as well.
83 echo '/^ *TEXMFMAIN[ =]/s%\$$TEXMF%$(texmf)%' >>$@
84 echo '/^[% ]*TEXMFLOCAL[ =]/s%\$$TEXMF%$(texmf)%' >>$@
85 echo '/^[% ]*TEXMFDIST[ =]/s%\$$TEXMF%$(texmf)%' >>$@
86 echo '/^[% ]*VARTEXMF[ =]/s%\$$TEXMF%$(texmf)%' >>$@
87 echo '/^[% ]*TEXMFSYSVAR[ =]/s%\$$TEXMF%$(texmf)%' >>$@
88 echo '/^[% ]*TEXMFSYSCONFIG[ =]/s%\$$TEXMF%$(texmf)%' >>$@
89 echo '/^[% ]*TEXMFSYSVAR[ =]/s%$(texmf)MAIN%\$$TEXMFMAIN%' >>$@
90 echo '/^[% ]*TEXMFSYSCONFIG[ =]/s%$(texmf)MAIN%\$$TEXMFMAIN%' >>$@
91 echo '/^[% ]*TEXMFVAR[ =]/s%\$$TEXMF%$(texmf)%' >>$@
92 echo '/^[% ]*TEXMFCONFIG[ =]/s%\$$TEXMF%$(texmf)%' >>$@
93 echo '/^[% ]*TEXMFVAR[ =]/s%$(texmf)MAIN%\$$TEXMFMAIN%' >>$@
94 echo '/^[% ]*TEXMFCONFIG[ =]/s%$(texmf)MAIN%\$$TEXMFMAIN%' >>$@
95 echo '/^[% ]*TEXMFCNF[ =]/s%\$$TEXMF%$(texmf)%' >>$@
96 # And fill in the last clause of TEXMFCNF with an absolute path.
97 echo '/^ *TEXMFCNF[ =]/s%@web2c@%$(web2cdir)%' >>$@
99 # First null out comments and leading/trailing whitespace, then remove
100 # lines that define invalid C identifiers, then remove blank lines and
101 # lines that define lowercase values (those are never path values). Each
102 # line remaining looks like
104 # (but = and surrounding spaces are optional, hence can't remove all spaces).
105 # Change this to #ifndef DEFAULT_name@#define DEFAULT_name "value"@#endif,
106 # then change the @'s to newlines (sed isn't good at multiline replacements).
108 # No backslash-newline escapes in the long sed replacement because that
109 # will turn into a space in the output.
111 # Without the $TEXMF/prefix/etc. substitutions, if the cnf file was
112 # not found, the compile-time paths would be of little use, since TEXMF
113 # (etc.) wouldn't be defined. Alternatively, we could have a way to
114 # specify compile-time default values for variables in general, but I
115 # think it's better to keep the last-resort paths as simple as possible.
117 # The definition of DEFAULT_TEXMF (and other variables)
118 # that winds up in the final paths.h will not be used.
120 # We don't want to rewrite paths.h when we have only changed comments
121 # in texmf.in that have no effect on paths.h, since that would cause
122 # almost everything to be rebuilt.
124 # We also replace all semicolons with colons in the paths. Ultimately
125 # the path-splitting code should be changed to understand both.
126 $(kpathsea_dir)/paths.h: stamp-paths
127 stamp-paths: texmf.cnf
128 echo "/* paths.h: Generated from texmf.cnf. */" >paths.tmp
129 sed -e 's/%.*//' -e 's/^[ ]*//' -e 's/[ ]*$$//' texmf.cnf \
130 | grep '^[ ]*[A-Z0-9_]*[ =]' \
132 | sed 's/^\([^ =]*\)[ ]*=*[ ]*\(.*\)/#ifndef DEFAULT_\1%#define DEFAULT_\1 "\2"%#endif/' \
134 | sed -e 's%\$$TEXMFMAIN%$(texmf)%g' \
135 -e 's%\$$TEXMF%$(texmf)%g' \
136 -e 's%\$$VARTEXFONTS%$(vartexfonts)%g' \
137 -e 's%\$$web2cdir%$(web2cdir)%g' \
138 -e 's%\$$prefix%$(prefix)%g' \
141 @if cmp -s paths.h paths.tmp 2>/dev/null; then \
142 echo "paths.h is unchanged"; \
144 echo "cp paths.tmp paths.h"; \
145 cp paths.tmp paths.h; \
150 # Need an extra definition for this. Dependencies included below.
152 $(KPATHSEA_CC) -DDEFAULT_FONT_SIZES='\"$(default_texsizes)\"' $(srcdir)/tex-file.c
155 ./kpsewhich -expand-var '$$TEXMF'
157 install: install-exec install-data
158 uninstall: uninstall-exec uninstall-data
160 install-exec: kpsewhich
161 $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir) \
162 $(libdir) $(web2cdir)
163 if grep 'original mktexpk --' $(scriptdir)/mktexpk >/dev/null 2>&1\
164 || test ! -r $(scriptdir)/mktexpk; then \
165 $(INSTALL_SCRIPT) $(srcdir)/mktexpk $(scriptdir)/mktexpk; \
167 if grep 'original mktexmf --' $(scriptdir)/mktexmf >/dev/null 2>&1\
168 || test ! -r $(scriptdir)/mktexmf; then \
169 $(INSTALL_SCRIPT) $(srcdir)/mktexmf $(scriptdir)/mktexmf; \
171 if grep 'original mktextfm --' $(scriptdir)/mktextfm >/dev/null 2>&1\
172 || test ! -r $(scriptdir)/mktextfm; then \
173 $(INSTALL_SCRIPT) $(srcdir)/mktextfm $(scriptdir)/mktextfm; \
175 if grep 'original mktexlsr --' $(scriptdir)/mktexlsr >/dev/null 2>&1\
176 || test ! -r $(scriptdir)/mktexlsr; then \
177 $(INSTALL_SCRIPT) $(srcdir)/mktexlsr $(scriptdir)/mktexlsr; \
179 # if grep 'original mktexfmt --' $(scriptdir)/mktexfmt > /dev/null 2>&1\
180 # || test ! -r $(scriptdir)/mktexfmt; then \
181 # $(INSTALL_SCRIPT) $(srcdir)/mktexfmt $(scriptdir)/mktexfmt; \
183 $(INSTALL_DATA) $(srcdir)/mktex.opt $(web2cdir)/mktex.opt
184 $(INSTALL_SCRIPT) $(srcdir)/mktexdir $(web2cdir)/mktexdir
185 $(INSTALL_DATA) $(srcdir)/mktexdir.opt $(web2cdir)/mktexdir.opt
186 $(INSTALL_SCRIPT) $(srcdir)/mktexnam $(web2cdir)/mktexnam
187 $(INSTALL_DATA) $(srcdir)/mktexnam.opt $(web2cdir)/mktexnam.opt
188 $(INSTALL_SCRIPT) $(srcdir)/mktexupd $(web2cdir)/mktexupd
189 $(INSTALL_LIBTOOL_LIBS) lib$(library).la $(libdir)
190 $(INSTALL_LIBTOOL_PROG) kpsewhich $(bindir)
191 $(INSTALL_PROGRAM) kpsestat $(bindir)
192 $(INSTALL_PROGRAM) kpseaccess $(bindir)
193 $(INSTALL_PROGRAM) kpsereadlink $(bindir)
195 $(UNINSTALL_LIBTOOL_LIBS) $(libdir)/lib$(library).la
196 $(UNINSTALL_LIBTOOL_PROG) $(bindir)/kpsewhich
197 $(UNINSTALL_PROGRAM) $(bindir)/kpsestat
198 $(UNINSTALL_PROGRAM) $(bindir)/kpseaccess
199 $(UNINSTALL_PROGRAM) $(bindir)/kpsereadlink
201 install-data: texmf.cnf kpathsea.info install-man
202 $(SHELL) $(top_srcdir)/../mkinstalldirs $(texmf) $(infodir) $(web2cdir)
203 if grep 'original texmf.cnf --' $(web2cdir)/texmf.cnf >/dev/null 2>&1 \
204 || test ! -r $(web2cdir)/texmf.cnf; then \
205 $(INSTALL_DATA) texmf.cnf $(web2cdir)/texmf.cnf; \
207 test -r ./kpathsea.info || cd $(srcdir) && for i in kpathsea.i*; do \
208 $(INSTALL_DATA) $$i $(infodir)/$$i; done
209 # Should we install the headers? They are not just system-dependent,
210 # which is bad enough, but even compiler-dependent.
211 $(SHELL) $(top_srcdir)/../mkinstalldirs $(includedir)/kpathsea
212 for f in $(install_headers); do \
213 $(INSTALL_DATA) $$f $(includedir)/kpathsea/; done
214 rm -f $(includedir)/kpathsea/acconfig.h
216 test -r $(infodir)/dir || $(INSTALL_DATA) $(top_srcdir)/../dir $(infodir)
217 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
218 install-info --info-dir=$(infodir) $(infodir)/kpathsea.info; \
223 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
224 install-info --delete --info-dir=$(infodir) $(infodir)/kpathsea.info; \
227 rm -f $(infodir)/kpathsea.i*
228 # for f in $(install_headers); do rm -f $(includedir)/`basename $$f`; done
230 # distdir is used by other distributions; they define $(distdir).
231 distdir: doc $(library).dvi $(library).h
234 ln $(ln_files) $(distdir)
236 ln mktex* *.info* *.texi *.ftp $(library).aux $(library).cps $(distdir)
237 rm -f $(distdir)/*.1 $(distdir)/*.man
239 ln BUGS README.CONFIGURE HIER PROJECTS *.ac $(distdir)
240 touch kpathsea.h # to avoid .cps.h rule on Solaris
241 cd $(distdir) && rm -f paths.h
243 # I don't use this, but other programmers want it. acconfig.h is an
244 # autoheader input file, not an includable C header. Bad name.
247 echo '/* This is a generated file */' >$@
248 echo '/* collecting all kpathsea headers. */' >>$@
249 echo '#include <kpathsea/config.h>' >>$@
251 | grep -v '\(acconfig\|config\|kpathsea\|win32lib\)\.h' \
252 | sed -e 's,^,#include <kpathsea/,' -e s',$$,>,' >>$@
253 touch -r `ls -1t *.h | tail +2 | head -1` $@
257 kpse_include ../make/config.mk
259 info: $(library).info
262 $(library).info: bugs.texi hier.texi install.texi unixtex.texi
264 @MAINT@INSTALL: install.texi
265 @MAINT@ $(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
266 @MAINT@ $(top_srcdir)/../add-info-toc $@
267 @MAINT@BUGS: bugs.texi
268 @MAINT@ $(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
269 @MAINT@ $(top_srcdir)/../add-info-toc $@
270 @MAINT@HIER: hier.texi
271 @MAINT@ $(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
272 @MAINT@unixtex.ftp: unixtex.texi
273 @MAINT@ $(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
274 @MAINT@doc: info HIER BUGS INSTALL unixtex.ftp
276 kpse_include ../make/clean.mk
279 rm -f kpsewhich kpsestat kpseaccess kpsereadlink *.lo
280 $(LIBTOOL) --mode=clean $(RM) lib$(library).la
282 rm -f paths.h texmf.cnf texmf.sed stamp-paths
285 manfiles = kpseaccess.1 kpsestat.1 kpsewhich.1 kpsereadlink.1 \
286 mktexlsr.1 mktexmf.1 mktextfm.1 mktexpk.1
288 kpse_include ../make/man.mk
290 kpse_include ../make/rdepend.mk
291 kpse_include depend.mk