| 1 |
## $Id: Makefile.am 75766 2025-07-13 16:30:15Z karl $ |
| 2 |
## Makefile.am for the TeX Live subdirectory texk/kpathsea/ |
| 3 |
## |
| 4 |
## Copyright 2015-2024 Karl Berry <[email protected]> |
| 5 |
## Copyright 2009-2015 Peter Breitenlohner <[email protected]> |
| 6 |
## You may freely use, modify and/or distribute this file. |
| 7 |
|
| 8 |
SUBDIRS = . doc man |
| 9 |
|
| 10 |
EXTRA_DIST = COPYING.LESSERv2 PROJECTS |
| 11 |
|
| 12 |
AM_CPPFLAGS = -I$(top_builddir)/.. -I$(top_srcdir)/.. |
| 13 |
AM_CFLAGS = $(WARNING_CFLAGS) |
| 14 |
|
| 15 |
lib_LTLIBRARIES = libkpathsea.la |
| 16 |
|
| 17 |
libkpathsea_la_CPPFLAGS = $(AM_CPPFLAGS) -DMAKE_KPSE_DLL |
| 18 |
if have_EXEEXT |
| 19 |
libkpathsea_la_CPPFLAGS += -DEXEEXT=\"$(EXEEXT)\" |
| 20 |
endif have_EXEEXT |
| 21 |
|
| 22 |
libkpathsea_la_LDFLAGS = -bindir @bindir@ -no-undefined -version-info $(KPSE_LT_VERSINFO) |
| 23 |
|
| 24 |
libkpathsea_la_LIBADD = $(LTLIBOBJS) |
| 25 |
|
| 26 |
BUILT_SOURCES = paths.h |
| 27 |
|
| 28 |
## Put tex-file.c first, because it's what depends on the paths, and may |
| 29 |
## reduce frustration if the paths are wrong by doing it first. |
| 30 |
libkpathsea_la_SOURCES = \ |
| 31 |
tex-file.c \ |
| 32 |
absolute.c \ |
| 33 |
atou.c \ |
| 34 |
cnf.c \ |
| 35 |
concat.c \ |
| 36 |
concat3.c \ |
| 37 |
concatn.c \ |
| 38 |
db.c \ |
| 39 |
debug.c \ |
| 40 |
dir.c \ |
| 41 |
elt-dirs.c \ |
| 42 |
expand.c \ |
| 43 |
extend-fname.c \ |
| 44 |
file-p.c \ |
| 45 |
find-suffix.c \ |
| 46 |
fn.c \ |
| 47 |
fontmap.c \ |
| 48 |
hash.c \ |
| 49 |
kdefault.c \ |
| 50 |
kpathsea.c \ |
| 51 |
line.c \ |
| 52 |
magstep.c \ |
| 53 |
make-suffix.c \ |
| 54 |
path-elt.c \ |
| 55 |
pathsearch.c \ |
| 56 |
proginit.c \ |
| 57 |
progname.c \ |
| 58 |
readable.c \ |
| 59 |
rm-suffix.c \ |
| 60 |
str-list.c \ |
| 61 |
str-llist.c \ |
| 62 |
tex-glyph.c \ |
| 63 |
tex-hush.c \ |
| 64 |
tex-make.c \ |
| 65 |
tilde.c \ |
| 66 |
uppercasify.c \ |
| 67 |
variable.c \ |
| 68 |
version.c \ |
| 69 |
xbasename.c \ |
| 70 |
xcalloc.c \ |
| 71 |
xdirname.c \ |
| 72 |
xfopen.c \ |
| 73 |
xfseek.c \ |
| 74 |
xftell.c \ |
| 75 |
xgetcwd.c \ |
| 76 |
xmalloc.c \ |
| 77 |
xopendir.c \ |
| 78 |
xputenv.c \ |
| 79 |
xrealloc.c \ |
| 80 |
xstat.c \ |
| 81 |
xstrdup.c |
| 82 |
|
| 83 |
if !MINGW32 |
| 84 |
libkpathsea_la_SOURCES += \ |
| 85 |
getopt.c \ |
| 86 |
getopt1.c |
| 87 |
endif !MINGW32 |
| 88 |
|
| 89 |
if WIN32 |
| 90 |
if MINGW32 |
| 91 |
libkpathsea_la_SOURCES += \ |
| 92 |
mingw32.c \ |
| 93 |
xfseeko.c \ |
| 94 |
xftello.c |
| 95 |
else !MINGW32 |
| 96 |
libkpathsea_la_SOURCES += \ |
| 97 |
win32lib.c |
| 98 |
endif !MINGW32 |
| 99 |
libkpathsea_la_SOURCES += \ |
| 100 |
knj.c |
| 101 |
SUBDIRS += win32 |
| 102 |
else !WIN32 |
| 103 |
libkpathsea_la_SOURCES += \ |
| 104 |
xfseeko.c \ |
| 105 |
xftello.c |
| 106 |
endif !WIN32 |
| 107 |
|
| 108 |
$(libkpathsea_la_OBJECTS): paths.h kpathsea.h |
| 109 |
|
| 110 |
EXTRA_DIST += \ |
| 111 |
putenv.c |
| 112 |
|
| 113 |
kpseincludedir = ${includedir}/kpathsea |
| 114 |
|
| 115 |
nodist_kpseinclude_HEADERS = \ |
| 116 |
c-auto.h \ |
| 117 |
kpathsea.h \ |
| 118 |
paths.h |
| 119 |
|
| 120 |
kpseinclude_HEADERS = config.h $(direct_headers) $(indirect_headers) |
| 121 |
|
| 122 |
# Headers included directly into kpathsea.h |
| 123 |
# |
| 124 |
direct_headers = \ |
| 125 |
absolute.h \ |
| 126 |
c-dir.h \ |
| 127 |
c-fopen.h \ |
| 128 |
c-namemx.h \ |
| 129 |
c-pathch.h \ |
| 130 |
c-pathmx.h \ |
| 131 |
c-stat.h \ |
| 132 |
cnf.h \ |
| 133 |
concatn.h \ |
| 134 |
expand.h \ |
| 135 |
getopt.h \ |
| 136 |
line.h \ |
| 137 |
magstep.h \ |
| 138 |
pathsearch.h \ |
| 139 |
proginit.h \ |
| 140 |
readable.h \ |
| 141 |
tex-glyph.h \ |
| 142 |
tex-hush.h \ |
| 143 |
tex-make.h \ |
| 144 |
variable.h \ |
| 145 |
version.h |
| 146 |
|
| 147 |
# Headers included indirectly into kpathsea.h |
| 148 |
# |
| 149 |
indirect_headers = \ |
| 150 |
c-ctype.h \ |
| 151 |
c-errno.h \ |
| 152 |
c-limits.h \ |
| 153 |
c-memstr.h \ |
| 154 |
c-minmax.h \ |
| 155 |
c-proto.h \ |
| 156 |
c-std.h \ |
| 157 |
c-unistd.h \ |
| 158 |
debug.h \ |
| 159 |
hash.h \ |
| 160 |
knj.h \ |
| 161 |
lib.h \ |
| 162 |
mingw32.h \ |
| 163 |
progname.h \ |
| 164 |
simpletypes.h \ |
| 165 |
str-list.h \ |
| 166 |
str-llist.h \ |
| 167 |
systypes.h \ |
| 168 |
tex-file.h \ |
| 169 |
types.h \ |
| 170 |
win32lib.h |
| 171 |
|
| 172 |
noinst_HEADERS = \ |
| 173 |
db.h \ |
| 174 |
default.h \ |
| 175 |
fn.h \ |
| 176 |
fontmap.h \ |
| 177 |
tilde.h \ |
| 178 |
xopendir.h \ |
| 179 |
xstat.h |
| 180 |
|
| 181 |
pkgconfigdir = ${libdir}/pkgconfig |
| 182 |
|
| 183 |
pkgconfig_DATA = kpathsea.pc |
| 184 |
|
| 185 |
## Handle backslash continuations, then null out comments and |
| 186 |
## leading/trailing whitespace. An awk script does the rest. |
| 187 |
## |
| 188 |
## We don't want to rewrite paths.h when we have only changed comments |
| 189 |
## in texmf.cnf that have no effect on paths.h, since that would cause |
| 190 |
## almost everything to be rebuilt. |
| 191 |
## |
| 192 |
paths.h: stamp-paths |
| 193 |
stamp-paths: texmf.cnf bsnl.awk cnf-to-paths.awk |
| 194 |
# ensure grep is not completely broken, e.g., from GREP_OPTIONS. |
| 195 |
echo a | grep -v b >/dev/null || { echo "*** grep broken, goodbye."; exit 1; } |
| 196 |
# |
| 197 |
# generate paths.h without build machine directories. |
| 198 |
echo "/* paths.h: Generated from texmf.cnf. */" >paths.tmp |
| 199 |
$(AWK) -f $(srcdir)/bsnl.awk $(srcdir)/texmf.cnf \ |
| 200 |
| sed -e 's/%.*//' -e 's/^[ ]*//' -e 's/[ ]*$$//' \ |
| 201 |
| $(AWK) -f $(srcdir)/cnf-to-paths.awk \ |
| 202 |
>>paths.tmp |
| 203 |
@if cmp -s paths.h paths.tmp 2>/dev/null; then \ |
| 204 |
echo "paths.h is unchanged"; \ |
| 205 |
else \ |
| 206 |
echo "cp paths.tmp paths.h"; \ |
| 207 |
cp paths.tmp paths.h; \ |
| 208 |
fi |
| 209 |
rm -f paths.tmp |
| 210 |
date >$@ |
| 211 |
|
| 212 |
## Similarly we don't want to rewrite kpathsea.h when only Makefile has |
| 213 |
## been remade but kpathsea.h remains the same. |
| 214 |
## |
| 215 |
kpathsea.h: stamp-kpathsea |
| 216 |
stamp-kpathsea: Makefile paths.h |
| 217 |
$(AM_V_GEN)rm -f $@; \ |
| 218 |
( echo '/* This is a generated file */'; \ |
| 219 |
echo '/* collecting all public kpathsea headers. */'; \ |
| 220 |
for f in config.h paths.h $(direct_headers); do \ |
| 221 |
echo "#include <kpathsea/$$f>"; \ |
| 222 |
done ) >kpathsea.tmp && \ |
| 223 |
if cmp -s kpathsea.h kpathsea.tmp 2>/dev/null; then \ |
| 224 |
echo "kpathsea.h is unchanged"; \ |
| 225 |
else \ |
| 226 |
echo "generated kpathsea.h"; \ |
| 227 |
cp kpathsea.tmp kpathsea.h; \ |
| 228 |
fi && rm -f kpathsea.tmp && date >$@ |
| 229 |
|
| 230 |
EXTRA_DIST += bsnl.awk cnf-to-paths.awk |
| 231 |
|
| 232 |
DISTCLEANFILES = paths.h stamp-paths kpathsea.h |
| 233 |
|
| 234 |
## The programs |
| 235 |
bin_PROGRAMS = kpseaccess kpsereadlink kpsestat kpsewhich |
| 236 |
|
| 237 |
kpseaccess_SOURCES = access.c |
| 238 |
|
| 239 |
kpsereadlink_SOURCES = readlink.c |
| 240 |
|
| 241 |
kpsewhich_LDADD = libkpathsea.la |
| 242 |
|
| 243 |
EXTRA_PROGRAMS = progname-test xdirtest |
| 244 |
|
| 245 |
progname_test_CPPFLAGS = $(AM_CPPFLAGS) -DMAKE_KPSE_DLL -DTEST |
| 246 |
progname_test_SOURCES = progname.c |
| 247 |
progname_test_LDADD = libkpathsea.la |
| 248 |
|
| 249 |
xdirtest_LDADD = libkpathsea.la |
| 250 |
|
| 251 |
## The scripts and their data |
| 252 |
web2cdir = $(datarootdir)/texmf-dist/web2c |
| 253 |
|
| 254 |
dist_noinst_DATA = texmf.cnf |
| 255 |
|
| 256 |
install-data-local: installdirs-am |
| 257 |
$(MKDIR_P) '$(DESTDIR)$(web2cdir)' |
| 258 |
@for f in $(dist_noinst_DATA); do \ |
| 259 |
if grep "original $$f --" "$(DESTDIR)$(web2cdir)/$$f" >/dev/null 2>&1 \ |
| 260 |
|| test ! -r "$(DESTDIR)$(web2cdir)/$$f"; then \ |
| 261 |
echo " $(INSTALL_DATA) '$(srcdir)/$$f' '$(DESTDIR)$(web2cdir)/$$f'"; \ |
| 262 |
$(INSTALL_DATA) "$(srcdir)/$$f" "$(DESTDIR)$(web2cdir)/$$f"; \ |
| 263 |
else :; fi; \ |
| 264 |
done |
| 265 |
|
| 266 |
uninstall-local: |
| 267 |
@for f in $(dist_noinst_DATA); do \ |
| 268 |
if grep "original $$f --" "$(DESTDIR)$(web2cdir)/$$f" >/dev/null 2>&1; then \ |
| 269 |
echo " rm -f '$(DESTDIR)$(web2cdir)/$$f'"; \ |
| 270 |
rm -f "$(DESTDIR)$(web2cdir)/$$f"; \ |
| 271 |
else :; fi; \ |
| 272 |
done |
| 273 |
|
| 274 |
## Tests |
| 275 |
AM_TESTS_ENVIRONMENT = LN_S='$(LN_S)'; export LN_S; |
| 276 |
AM_TESTS_ENVIRONMENT += LT_OBJDIR='$(LT_OBJDIR)'; export LT_OBJDIR; |
| 277 |
# |
| 278 |
TESTS = tests/cnfline.test tests/cnfnewline.test tests/cnfnlink.test |
| 279 |
TESTS += tests/cnfnull.test tests/cnfprog.test |
| 280 |
TESTS += tests/kpseaccess.test |
| 281 |
TESTS += tests/kpsereadlink.test |
| 282 |
TESTS += tests/kpsesafe.test tests/kpsestat.test tests/kpsewhich.test |
| 283 |
# |
| 284 |
tests/cnfline.log tests/cnfnewline.log tests/cnfnull.log tests/cnfprog.log \ |
| 285 |
tests/kpsesafe.log tests/kpsewhich.log: kpsewhich$(EXEEXT) |
| 286 |
tests/kpseaccess.log: kpseaccess$(EXEEXT) |
| 287 |
tests/kpsereadlink.log: kpsereadlink$(EXEEXT) |
| 288 |
tests/kpsestat.log: kpsestat$(EXEEXT) |
| 289 |
# |
| 290 |
EXTRA_DIST += $(TESTS) |
| 291 |
EXTRA_DIST += tests/cnfline/texmf.cnf |
| 292 |
EXTRA_DIST += tests/cnfnewline/texmf.cnf |
| 293 |
EXTRA_DIST += tests/cnfprog/texmf.cnf |
| 294 |
|
| 295 |
# Rebuild |
| 296 |
rebuild_prereq = |
| 297 |
rebuild_target = all-am |
| 298 |
CLEANFILES = |
| 299 |
|
| 300 |
include $(srcdir)/../../am/rebuild.am |