summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/Makefile.am
blob: ebb2c5f2cc8844008064d7c7928b7c57eb2e5cde (plain)
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
## $Id$
## Makefile.am for the TeX Live subdirectory texk/kpathsea/
##
## Copyright 2015-2019 Karl Berry <tex-live@tug.org>
## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.

SUBDIRS = . doc man

EXTRA_DIST = PROJECTS

AM_CPPFLAGS = -I$(top_builddir)/.. -I$(top_srcdir)/..
AM_CFLAGS = $(WARNING_CFLAGS)

lib_LTLIBRARIES = libkpathsea.la

libkpathsea_la_CPPFLAGS = $(AM_CPPFLAGS) -DMAKE_KPSE_DLL
if have_EXEEXT
libkpathsea_la_CPPFLAGS += -DEXEEXT=\"$(EXEEXT)\"
endif have_EXEEXT

libkpathsea_la_LDFLAGS = -bindir @bindir@ -no-undefined -version-info $(KPSE_LT_VERSINFO)

libkpathsea_la_LIBADD = $(LTLIBOBJS)

BUILT_SOURCES = paths.h

## Put tex-file.c first, because it's what depends on the paths, and may
## reduce frustration if the paths are wrong by doing it first.
libkpathsea_la_SOURCES = \
	tex-file.c \
	absolute.c \
	atou.c \
	cnf.c \
	concat.c \
	concat3.c \
	concatn.c \
	db.c \
	debug.c \
	dir.c \
	elt-dirs.c \
	expand.c \
	extend-fname.c \
	file-p.c \
	find-suffix.c \
	fn.c \
	fontmap.c \
	hash.c \
	kdefault.c \
	kpathsea.c \
	line.c \
	magstep.c \
	make-suffix.c \
	path-elt.c \
	pathsearch.c \
	proginit.c \
	progname.c \
	readable.c \
	rm-suffix.c \
	str-list.c \
	str-llist.c \
	tex-glyph.c \
	tex-hush.c \
	tex-make.c \
	tilde.c \
	uppercasify.c \
	variable.c \
	version.c \
	xbasename.c \
	xcalloc.c \
	xdirname.c \
	xfopen.c \
	xfseek.c \
	xftell.c \
	xgetcwd.c \
	xmalloc.c \
	xopendir.c \
	xputenv.c \
	xrealloc.c \
	xstat.c \
	xstrdup.c

if !MINGW32
libkpathsea_la_SOURCES += \
	getopt.c \
	getopt1.c
endif !MINGW32

if WIN32
if MINGW32
libkpathsea_la_SOURCES += \
	mingw32.c \
	xfseeko.c \
	xftello.c
else !MINGW32
libkpathsea_la_SOURCES += \
	win32lib.c
endif !MINGW32
libkpathsea_la_SOURCES += \
	knj.c
SUBDIRS += win32
else !WIN32
libkpathsea_la_SOURCES += \
	xfseeko.c \
	xftello.c
endif !WIN32

$(libkpathsea_la_OBJECTS): paths.h kpathsea.h

EXTRA_DIST += \
	putenv.c

kpseincludedir = ${includedir}/kpathsea

nodist_kpseinclude_HEADERS = \
	c-auto.h \
	kpathsea.h \
	paths.h

kpseinclude_HEADERS = config.h $(direct_headers) $(indirect_headers)

# Headers included directly into kpathsea.h
#
direct_headers = \
	absolute.h \
	c-dir.h \
	c-fopen.h \
	c-namemx.h \
	c-pathch.h \
	c-pathmx.h \
	c-stat.h \
	cnf.h \
	concatn.h \
	expand.h \
	getopt.h \
	line.h \
	magstep.h \
	pathsearch.h \
	proginit.h \
	readable.h \
	tex-glyph.h \
	tex-hush.h \
	tex-make.h \
	variable.h \
	version.h

# Headers included indirectly into kpathsea.h
#
indirect_headers = \
	c-ctype.h \
	c-errno.h \
	c-limits.h \
	c-memstr.h \
	c-minmax.h \
	c-proto.h \
	c-std.h \
	c-unistd.h \
	debug.h \
	hash.h \
	knj.h \
	lib.h \
	mingw32.h \
	progname.h \
	simpletypes.h \
	str-list.h \
	str-llist.h \
	systypes.h \
	tex-file.h \
	types.h \
	win32lib.h

noinst_HEADERS = \
	db.h \
	default.h \
	fn.h \
	fontmap.h \
	tilde.h \
	xopendir.h \
	xstat.h

pkgconfigdir = ${libdir}/pkgconfig

pkgconfig_DATA = kpathsea.pc

## Handle backslash continuations, then null out comments and
## leading/trailing whitespace.  An awk script does the rest.
## 
## We don't want to rewrite paths.h when we have only changed comments
## in texmf.cnf that have no effect on paths.h, since that would cause
## almost everything to be rebuilt.
##
paths.h: stamp-paths
stamp-paths: texmf.cnf bsnl.awk cnf-to-paths.awk
# ensure grep is not completely broken, e.g., from GREP_OPTIONS.
	echo a | grep -v b >/dev/null || { echo "*** grep broken, goodbye."; exit 1; }
#
# generate paths.h without build machine directories.
	echo "/* paths.h: Generated from texmf.cnf. */" >paths.tmp
	$(AWK) -f $(srcdir)/bsnl.awk $(srcdir)/texmf.cnf \
	| sed -e 's/%.*//' -e 's/^[ 	]*//' -e 's/[ 	]*$$//' \
	| $(AWK) -f $(srcdir)/cnf-to-paths.awk \
	>>paths.tmp
	@if cmp -s paths.h paths.tmp 2>/dev/null; then \
	  echo "paths.h is unchanged"; \
	else \
	  echo "cp paths.tmp paths.h"; \
	  cp paths.tmp paths.h; \
	fi
	rm -f paths.tmp
	date >$@

## Similarly we don't want to rewrite kpathsea.h when only Makefile has
## been remade but kpathsea.h remains the same.
##
kpathsea.h: stamp-kpathsea
stamp-kpathsea: Makefile paths.h
	$(AM_V_GEN)rm -f $@; \
	( echo '/* This is a generated file */'; \
	  echo '/* collecting all public kpathsea headers. */'; \
	  for f in config.h paths.h $(direct_headers); do \
	    echo "#include <kpathsea/$$f>"; \
	  done ) >kpathsea.tmp && \
	if cmp -s kpathsea.h kpathsea.tmp 2>/dev/null; then \
	  echo "kpathsea.h is unchanged"; \
	else \
	  echo "generated kpathsea.h"; \
	  cp kpathsea.tmp kpathsea.h; \
	fi && rm -f kpathsea.tmp && date >$@

EXTRA_DIST += bsnl.awk cnf-to-paths.awk

DISTCLEANFILES = paths.h stamp-paths kpathsea.h

## The programs
bin_PROGRAMS = kpseaccess kpsereadlink kpsestat kpsewhich

kpseaccess_SOURCES = access.c

kpsereadlink_SOURCES = readlink.c

kpsewhich_LDADD = libkpathsea.la

EXTRA_PROGRAMS = progname-test xdirtest

progname_test_CPPFLAGS = $(AM_CPPFLAGS) -DMAKE_KPSE_DLL -DTEST
progname_test_SOURCES = progname.c
progname_test_LDADD = libkpathsea.la

xdirtest_LDADD = libkpathsea.la

## The scripts and their data
web2cdir = $(datarootdir)/texmf-dist/web2c

dist_noinst_DATA = texmf.cnf

install-data-local: installdirs-am
	$(MKDIR_P) '$(DESTDIR)$(web2cdir)'
	@for f in $(dist_noinst_DATA); do \
	  if grep "original $$f --" "$(DESTDIR)$(web2cdir)/$$f" >/dev/null 2>&1 \
	      || test ! -r "$(DESTDIR)$(web2cdir)/$$f"; then \
	    echo " $(INSTALL_DATA) '$(srcdir)/$$f' '$(DESTDIR)$(web2cdir)/$$f'"; \
	    $(INSTALL_DATA) "$(srcdir)/$$f" "$(DESTDIR)$(web2cdir)/$$f"; \
	  else :; fi; \
	done

uninstall-local:
	@for f in $(dist_noinst_DATA); do \
	  if grep "original $$f --" "$(DESTDIR)$(web2cdir)/$$f" >/dev/null 2>&1; then \
	    echo " rm -f '$(DESTDIR)$(web2cdir)/$$f'"; \
	    rm -f "$(DESTDIR)$(web2cdir)/$$f"; \
	  else :; fi; \
	done

## Tests
AM_TESTS_ENVIRONMENT  = LN_S='$(LN_S)'; export LN_S;
AM_TESTS_ENVIRONMENT += LT_OBJDIR='$(LT_OBJDIR)'; export LT_OBJDIR;
#
TESTS  = tests/cnfline.test tests/cnfnewline.test tests/cnfprog.test
TESTS += tests/kpseaccess.test
TESTS += tests/kpsereadlink.test tests/kpsestat.test tests/kpsewhich.test
#
tests/cnfline.log tests/cnfnewline.log tests/cnfprog.log \
  tests/kpsewhich.log: kpsewhich$(EXEEXT)
tests/kpseaccess.log: kpseaccess$(EXEEXT)
tests/kpsereadlink.log: kpsereadlink$(EXEEXT)
tests/kpsestat.log: kpsestat$(EXEEXT)
#
EXTRA_DIST += $(TESTS)
EXTRA_DIST += tests/cnfline/texmf.cnf
EXTRA_DIST += tests/cnfnewline/texmf.cnf
EXTRA_DIST += tests/cnfprog/texmf.cnf

# Rebuild
rebuild_prereq =
rebuild_target = all-am
CLEANFILES =

include $(srcdir)/../../am/rebuild.am