1 ## Makefile.am for the TeX Live subdirectory texk/kpathsea/
3 ## Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org>
4 ## You may freely use, modify and/or distribute this file.
10 AM_CPPFLAGS = -I$(top_builddir)/.. -I$(top_srcdir)/..
11 AM_CFLAGS = $(WARNING_CFLAGS)
13 lib_LTLIBRARIES = libkpathsea.la
15 libkpathsea_la_CPPFLAGS = $(AM_CPPFLAGS) -DMAKE_KPSE_DLL
17 libkpathsea_la_CPPFLAGS += -DEXEEXT=\"$(EXEEXT)\"
20 libkpathsea_la_LDFLAGS = -bindir @bindir@ -no-undefined -version-info $(KPSE_LT_VERSINFO)
22 libkpathsea_la_LIBADD = $(LTLIBOBJS)
24 BUILT_SOURCES = paths.h
26 ## Put tex-file.c first, because it's what depends on the paths, and may
27 ## reduce frustration if the paths are wrong by doing it first.
28 libkpathsea_la_SOURCES = \
82 libkpathsea_la_SOURCES += \
89 libkpathsea_la_SOURCES += \
94 libkpathsea_la_SOURCES += \
97 libkpathsea_la_SOURCES += \
101 libkpathsea_la_SOURCES += \
106 $(libkpathsea_la_OBJECTS): paths.h kpathsea.h
111 kpseincludedir = ${includedir}/kpathsea
113 nodist_kpseinclude_HEADERS = \
117 kpseinclude_HEADERS = config.h $(direct_headers) $(indirect_headers)
119 kpselibdir = ${libdir}/kpathsea
121 nodist_kpselib_HEADERS = \
124 # Headers included directly into kpathsea.h
149 # Headers included indirectly into kpathsea.h
183 pkgconfigdir = ${libdir}/pkgconfig
185 pkgconfig_DATA = kpathsea.pc
187 ## Handle backslash continuations, then null out comments and
188 ## leading/trailing whitespace. An awk script does the rest.
190 ## We don't want to rewrite paths.h when we have only changed comments
191 ## in texmf.cnf that have no effect on paths.h, since that would cause
192 ## almost everything to be rebuilt.
195 stamp-paths: texmf.cnf bsnl.awk cnf-to-paths.awk
196 # ensure grep is not completely broken, e.g., from GREP_OPTIONS.
197 echo a | grep -v b >/dev/null || { echo "*** grep broken, goodbye."; exit 1; }
199 # generate paths.h without build machine directories.
200 echo "/* paths.h: Generated from texmf.cnf. */" >paths.tmp
201 $(AWK) -f $(srcdir)/bsnl.awk $(srcdir)/texmf.cnf \
202 | sed -e 's/%.*//' -e 's/^[ ]*//' -e 's/[ ]*$$//' \
203 | $(AWK) -f $(srcdir)/cnf-to-paths.awk \
205 @if cmp -s paths.h paths.tmp 2>/dev/null; then \
206 echo "paths.h is unchanged"; \
208 echo "cp paths.tmp paths.h"; \
209 cp paths.tmp paths.h; \
214 ## Similarly we don't want to rewrite kpathsea.h when only Makefile has
215 ## been remade but kpathsea.h remains the same.
217 kpathsea.h: stamp-kpathsea
218 stamp-kpathsea: Makefile paths.h
219 $(AM_V_GEN)rm -f $@; \
220 ( echo '/* This is a generated file */'; \
221 echo '/* collecting all public kpathsea headers. */'; \
222 for f in config.h paths.h $(direct_headers); do \
223 echo "#include <kpathsea/$$f>"; \
224 done ) >kpathsea.tmp && \
225 if cmp -s kpathsea.h kpathsea.tmp 2>/dev/null; then \
226 echo "kpathsea.h is unchanged"; \
228 echo "generated kpathsea.h"; \
229 cp kpathsea.tmp kpathsea.h; \
230 fi && rm -f kpathsea.tmp && date >$@
232 EXTRA_DIST += bsnl.awk cnf-to-paths.awk
234 DISTCLEANFILES = paths.h stamp-paths kpathsea.h
237 bin_PROGRAMS = kpseaccess kpsereadlink kpsestat kpsewhich
239 kpseaccess_SOURCES = access.c
241 kpsereadlink_SOURCES = readlink.c
243 kpsewhich_LDADD = libkpathsea.la
245 EXTRA_PROGRAMS = progname-test xdirtest
247 progname_test_CPPFLAGS = $(AM_CPPFLAGS) -DMAKE_KPSE_DLL -DTEST
248 progname_test_SOURCES = progname.c
249 progname_test_LDADD = libkpathsea.la
251 xdirtest_LDADD = libkpathsea.la
253 ## The scripts and their data
254 web2cdir = $(datarootdir)/texmf-dist/web2c
256 dist_web2c_SCRIPTS = mktexdir mktexnam mktexupd
258 dist_web2c_DATA = mktex.opt mktexdir.opt mktexnam.opt
260 dist_noinst_SCRIPTS = mktexlsr mktexmf mktexpk mktextfm
262 dist_noinst_DATA = texmf.cnf
264 install-exec-local: installdirs-am
266 @for f in $(dist_noinst_SCRIPTS); do \
267 if grep "original $$f --" "$(DESTDIR)$(bindir)/$$f" >/dev/null 2>&1 \
268 || test ! -r "$(DESTDIR)$(bindir)/$$f"; then \
269 echo " $(INSTALL_SCRIPT) '$(srcdir)/$$f' '$(DESTDIR)$(bindir)/$$f'"; \
270 $(INSTALL_SCRIPT) "$(srcdir)/$$f" "$(DESTDIR)$(bindir)/$$f"; \
275 install-data-local: installdirs-am
276 @for f in $(dist_noinst_DATA); do \
277 if grep "original $$f --" "$(DESTDIR)$(web2cdir)/$$f" >/dev/null 2>&1 \
278 || test ! -r "$(DESTDIR)$(web2cdir)/$$f"; then \
279 echo " $(INSTALL_DATA) '$(srcdir)/$$f' '$(DESTDIR)$(web2cdir)/$$f'"; \
280 $(INSTALL_DATA) "$(srcdir)/$$f" "$(DESTDIR)$(web2cdir)/$$f"; \
286 @for f in $(dist_noinst_SCRIPTS); do \
287 if grep "original $$f --" "$(DESTDIR)$(bindir)/$$f" >/dev/null 2>&1; then \
288 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
289 rm -f "$(DESTDIR)$(bindir)/$$f"; \
293 @for f in $(dist_noinst_DATA); do \
294 if grep "original $$f --" "$(DESTDIR)$(web2cdir)/$$f" >/dev/null 2>&1; then \
295 echo " rm -f '$(DESTDIR)$(web2cdir)/$$f'"; \
296 rm -f "$(DESTDIR)$(web2cdir)/$$f"; \
300 bin_links = mktexlsr:texhash
302 include $(top_srcdir)/../../am/bin_links.am
304 install-exec-hook: install-bin-links
306 uninstall-hook: uninstall-bin-links
309 TESTS = tests/cnfnewline.test tests/kpseaccess.test
310 TESTS += tests/kpsereadlink.test tests/kpsestat.test tests/kpsewhich.test
311 TESTS_ENVIRONMENT = LN_S='$(LN_S)' LT_OBJDIR='$(LT_OBJDIR)'
312 tests/cnfnewline.log tests/kpsewhich.log: kpsewhich$(EXEEXT)
313 tests/kpseaccess.log: kpseaccess$(EXEEXT)
314 tests/kpsereadlink.log: kpsereadlink$(EXEEXT)
315 tests/kpsestat.log: kpsestat$(EXEEXT)
316 EXTRA_DIST += $(TESTS)
317 EXTRA_DIST += tests/cnfnewline/texmf.cnf
321 rebuild_target = all-am
324 include $(srcdir)/../../am/rebuild.am
328 EXTRA_DIST += mktex.cnf