new beta-0.90.0
[luatex.git] / source / texk / kpathsea / Makefile.am
blob72dc25f1113db11edbfae39136725745298dffce
1 ## Makefile.am for the TeX Live subdirectory texk/kpathsea/
2 ##
3 ## Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org>
4 ## You may freely use, modify and/or distribute this file.
5 ##
6 SUBDIRS = . doc man
8 EXTRA_DIST = PROJECTS
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
16 if have_EXEEXT
17 libkpathsea_la_CPPFLAGS += -DEXEEXT=\"$(EXEEXT)\"
18 endif have_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 = \
29         tex-file.c \
30         absolute.c \
31         atou.c \
32         cnf.c \
33         concat.c \
34         concat3.c \
35         concatn.c \
36         db.c \
37         debug.c \
38         dir.c \
39         elt-dirs.c \
40         expand.c \
41         extend-fname.c \
42         file-p.c \
43         find-suffix.c \
44         fn.c \
45         fontmap.c \
46         hash.c \
47         kdefault.c \
48         kpathsea.c \
49         line.c \
50         magstep.c \
51         make-suffix.c \
52         path-elt.c \
53         pathsearch.c \
54         proginit.c \
55         progname.c \
56         readable.c \
57         rm-suffix.c \
58         str-list.c \
59         str-llist.c \
60         tex-glyph.c \
61         tex-hush.c \
62         tex-make.c \
63         tilde.c \
64         uppercasify.c \
65         variable.c \
66         version.c \
67         xbasename.c \
68         xcalloc.c \
69         xdirname.c \
70         xfopen.c \
71         xfseek.c \
72         xftell.c \
73         xgetcwd.c \
74         xmalloc.c \
75         xopendir.c \
76         xputenv.c \
77         xrealloc.c \
78         xstat.c \
79         xstrdup.c
81 if !MINGW32
82 libkpathsea_la_SOURCES += \
83         getopt.c \
84         getopt1.c
85 endif !MINGW32
87 if WIN32
88 if MINGW32
89 libkpathsea_la_SOURCES += \
90         mingw32.c \
91         xfseeko.c \
92         xftello.c
93 else !MINGW32
94 libkpathsea_la_SOURCES += \
95         win32lib.c
96 endif !MINGW32
97 libkpathsea_la_SOURCES += \
98         knj.c
99 SUBDIRS += win32
100 else !WIN32
101 libkpathsea_la_SOURCES += \
102         xfseeko.c \
103         xftello.c
104 endif !WIN32
106 $(libkpathsea_la_OBJECTS): paths.h kpathsea.h
108 EXTRA_DIST += \
109         putenv.c
111 kpseincludedir = ${includedir}/kpathsea
113 nodist_kpseinclude_HEADERS = \
114         kpathsea.h \
115         paths.h
117 kpseinclude_HEADERS = config.h $(direct_headers) $(indirect_headers)
119 kpselibdir = ${libdir}/kpathsea
121 nodist_kpselib_HEADERS = \
122         c-auto.h
124 # Headers included directly into kpathsea.h
126 direct_headers = \
127         absolute.h \
128         c-dir.h \
129         c-fopen.h \
130         c-namemx.h \
131         c-pathch.h \
132         c-pathmx.h \
133         c-stat.h \
134         cnf.h \
135         concatn.h \
136         expand.h \
137         getopt.h \
138         line.h \
139         magstep.h \
140         pathsearch.h \
141         proginit.h \
142         readable.h \
143         tex-glyph.h \
144         tex-hush.h \
145         tex-make.h \
146         variable.h \
147         version.h
149 # Headers included indirectly into kpathsea.h
151 indirect_headers = \
152         c-ctype.h \
153         c-errno.h \
154         c-limits.h \
155         c-memstr.h \
156         c-minmax.h \
157         c-proto.h \
158         c-std.h \
159         c-unistd.h \
160         debug.h \
161         hash.h \
162         knj.h \
163         lib.h \
164         mingw32.h \
165         progname.h \
166         simpletypes.h \
167         str-list.h \
168         str-llist.h \
169         systypes.h \
170         tex-file.h \
171         types.h \
172         win32lib.h
174 noinst_HEADERS = \
175         db.h \
176         default.h \
177         fn.h \
178         fontmap.h \
179         tilde.h \
180         xopendir.h \
181         xstat.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.
189 ## 
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.
194 paths.h: stamp-paths
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 \
204         >>paths.tmp
205         @if cmp -s paths.h paths.tmp 2>/dev/null; then \
206           echo "paths.h is unchanged"; \
207         else \
208           echo "cp paths.tmp paths.h"; \
209           cp paths.tmp paths.h; \
210         fi
211         rm -f paths.tmp
212         date >$@
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"; \
227         else \
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
236 ## The programs
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
265 if !WIN32
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"; \
271           else :; fi; \
272         done
273 endif !WIN32
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"; \
281           else :; fi; \
282         done
284 uninstall-local:
285 if !WIN32
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"; \
290           else :; fi; \
291         done
292 endif !WIN32
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"; \
297           else :; fi; \
298         done
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
308 ## The tests
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
319 # Rebuild
320 rebuild_prereq =
321 rebuild_target = all-am
322 CLEANFILES =
324 include $(srcdir)/../../am/rebuild.am
326 ## Not used
328 EXTRA_DIST += mktex.cnf