summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mfluadir/am/mflua.am
blob: 17f27d145c423f9add6cca88e490b7916ab80046 (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
## texk/web2c/mfluadir/am/mflua.am: Makefile fragment for MFLua.
##
## Copyright (C) 2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.

## MFLua
##
if MFLUA
bin_PROGRAMS += mflua
if MFLUAN
bin_PROGRAMS += mflua-nowin
endif MFLUAN
if WIN32
noinst_PROGRAMS += call_mflua
install_exe_links += install-mflua-links
uninstall_exe_links += uninstall-mflua-links
else !WIN32
if !MFLUAN
bin_links += mflua$(EXEEXT):mflua-nowin
endif !MFLUAN
bin_links += mflua$(EXEEXT):inimflua
endif !WIN32
endif MFLUA
EXTRA_PROGRAMS += mflua mflua-nowin
DISTCLEANFILES += mfluatrap.diffs

call_mflua_CPPFLAGS = -DEXEPROG=\"mflua.exe\"
nodist_call_mflua_SOURCES = callexe.c
call_mflua_LDADD =

.PHONY: install-mflua-links uninstall-mflua-links
if WIN32
install-mflua-links: call_mflua$(EXEEXT)
if !MFLUAN
	$(INSTALL_PROGRAM) call_mflua$(EXEEXT) $(DESTDIR)$(bindir)/mflua-nowin$(EXEEXT)
endif !MFLUAN
	$(INSTALL_PROGRAM) call_mflua$(EXEEXT) $(DESTDIR)$(bindir)/inimflua$(EXEEXT)
uninstall-mflua-links:
if !MFLUAN
	rm -f $(DESTDIR)$(bindir)/mflua-nowin$(EXEEXT)
endif !MFLUAN
	rm -f $(DESTDIR)$(bindir)/inimflua$(EXEEXT)
endif WIN32

dist_mflua_SOURCES = mfluadir/mfluaextra.c mfluadir/mfluaextra.h mfluadir/mflua_version.h
mflua_CPPFLAGS = $(AM_CPPFLAGS) $(X_CFLAGS) $(LUA_INCLUDES)
mflua_LDADD = libmflua.a $(LDADD) $(windowlib) $(mf_x_libs) $(LUA_LIBS)
mflua_LDFLAGS = -export-dynamic
nodist_mflua_nowin_SOURCES = $(dist_mflua_SOURCES)
mflua_nowin_CPPFLAGS = $(mflua_CPPFLAGS) -DMFNOWIN $(LUA_INCLUDES)
mflua_nowin_LDADD = libmflua.a $(LDADD) $(windowlib) $(LUA_LIBS)
mflua_nowin_LDFLAGS = -export-dynamic

# We must create mfluad.h and mfluadir/mflua_version.h before compiling mfluaextra.c.
$(mflua_OBJECTS) $(mflua_nowin_OBJECTS): mfluad.h mfluadir/mflua_version.h

## mflua and mflua-nowin compile mfluaextra.c with different CPPFLAGS.
## Automake, however, does not support CPPFLAGS for individual source files.
## To avoid compiling everything twice, the common objects are in a library.
EXTRA_LIBRARIES += libmflua.a

# MFLua C sources
mflua_c_h = mfluaini.c mflua0.c mfluacoerce.h mfluad.h
dist_libmflua_a_SOURCES = luatexdir/lua/lkpselib.c mfluadir/mfluac.c mfluadir/mfluac.h
nodist_libmflua_a_SOURCES = $(mflua_c_h) mflua-pool.c
libmflua_a_CPPFLAGS = $(AM_CPPFLAGS) $(LUA_INCLUDES) -DMF_LUA

# We must create mfluad.h before building the libmflua_a_OBJECTS.
$(libmflua_a_OBJECTS): mfluad.h

$(mflua_c_h): mflua-web2c $(LUA_DEPEND)
	@$(web2c) mflua
mflua-web2c: mflua.p $(web2c_texmf) web2c/cvtmf1.sed web2c/cvtmf2.sed mfluadir/mflua.defines
	@$(web2c) mflua

mflua-pool.c: mflua.pool mfluad.h $(makecpool_stamp)
	$(makecpool) mflua >$@ || rm -f $@

# Tangling MFLua
mflua.p mflua.pool: mflua-tangle
	@$(texmf_tangle) mflua mflua
mflua-tangle: tangle$(EXEEXT) mflua.web mflua.ch tangle-sh
	@$(texmf_tangle) mflua mflua

# Extract mflua version
$(srcdir)/mfluadir/mflua_version.h: @MAINTAINER_MODE_TRUE@ mfluadir/mf-lua.ch
	$(AM_V_GEN)grep '^@d MFLua_version_string==' $(srcdir)/mfluadir/mf-lua.ch \
	  | sed "s/^.*'-/#define MFLUA_VERSION \"/;s/'.*$$/\"/" >$@

# Generate mflua.web
mflua.web: tie$(EXEEXT) $(mflua_web_srcs)
	$(tie_m) $(mflua_web_srcs)
mflua_web_srcs = \
	mf.web \
	mfluadir/mf-lua.ch

# Generate mflua.ch
mflua.ch: tie$(EXEEXT) mflua.web $(mflua_ch_src)
	$(tie_c) mflua.web $(mflua_ch_src)
mflua_ch_src = \
	mf.ch \
	mfluadir/mflua-m.ch \
	mf-binpool.ch
##
EXTRA_DIST += $(mflua_web_srcs) $(mflua_ch_src) mfluadir/mflua.defines

DISTCLEANFILES += $(nodist_libmflua_a_SOURCES) mflua.web mflua.ch mflua-web2c \
	mflua.p mflua.pool mflua-tangle

EXTRA_DIST += \
	mfluadir/ChangeLog

# MFLua tests
#
mflua_tests = mfluadir/mfluatraptest.test
mfluadir/mfluatraptest.log: mflua$(EXEEXT) gftype$(EXEEXT) tftopl$(EXEEXT)
EXTRA_DIST += $(mflua_tests)

if MFLUA
TESTS += $(mflua_tests)
TRIPTRAP += mfluatrap.diffs
TRIPTRAP_CLEAN += mfluatrap-clean
endif MFLUA
DISTCLEANFILES += mfluatrap.diffs

## mfluadir/mfluatraptest
mfluatrap.diffs: mflua$(EXEEXT) gftype$(EXEEXT) tftopl$(EXEEXT)
	$(triptrap_diffs) $@
.PHONY: mfluatrap-clean
mfluatrap-clean:
	rm -rf mfluatrapdir

## Test data 
##
EXTRA_DIST += \
	mfluadir/mfluatrap/begin_program.lua \
	mfluadir/mfluatrap/do_add_to.lua \
	mfluadir/mfluatrap/end_program.lua \
	mfluadir/mfluatrap/fill_envelope.lua \
	mfluadir/mfluatrap/fill_spec.lua \
	mfluadir/mfluatrap/final_cleanup.lua \
	mfluadir/mfluatrap/main_control.lua \
	mfluadir/mfluatrap/make_ellipse.lua \
	mfluadir/mfluatrap/mfluaini.lua \
	mfluadir/mfluatrap/offset_prep.lua \
	mfluadir/mfluatrap/print_edges.lua \
	mfluadir/mfluatrap/print_path.lua \
	mfluadir/mfluatrap/scan_direction.lua \
	mfluadir/mfluatrap/skew_line_edges.lua \
	mfluadir/mfluatrap/start_of_MF.lua \
	mfluadir/mfluatrap/texmf.cnf \
	mfluadir/mfluatrap/mfluatrap.diffs