summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mplibdir/am/mplib.am
blob: 0cfdec7ac3103e2fb44cf161172b9fc878181bd7 (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
## texk/web2c/mplibdir/am/mplib.am: Makefile fragment for MetaPost.
##
## Copyright 2017-2021 Luigi Scarso <tex-live@tug.org>
## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.

## MetaPost
##
if MP
bin_PROGRAMS += mpost
if WIN32
noinst_PROGRAMS += call_mpost
install_exe_links += install-mpost-links
uninstall_exe_links += uninstall-mpost-links
else !WIN32
bin_links += mpost$(EXEEXT):dvitomp mpost$(EXEEXT):mfplain
bin_links += mpost$(EXEEXT):r-mpost
endif !WIN32
endif MP
EXTRA_PROGRAMS += mpost

mpost_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) -I$(srcdir)/mplibdir
mpost_LDADD = libmplibcore.a libmplibextramath.a libmplibbackends.a  $(KPATHSEA_LIBS) $(MPFR_LIBS) $(GMP_LIBS) \
	$(CAIRO_LIBS) $(PIXMAN_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) libmputil.a



call_mpost_CPPFLAGS = -DEXEPROG=\"mpost.exe\"
nodist_call_mpost_SOURCES = callexe.c
call_mpost_LDADD =

.PHONY: install-mpost-links uninstall-mpost-links
if WIN32
install-mpost-links: call_mpost$(EXEEXT)
	$(INSTALL_PROGRAM) call_mpost$(EXEEXT) $(DESTDIR)$(bindir)/dvitomp$(EXEEXT)
	$(INSTALL_PROGRAM) call_mpost$(EXEEXT) $(DESTDIR)$(bindir)/mfplain$(EXEEXT)
uninstall-mpost-links:
	rm -f $(DESTDIR)$(bindir)/dvitomp$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/mfplain$(EXEEXT)
endif WIN32

# Creating one file: just one rule
mp_ctangle = $(ctangle_silent)CWEBINPUTS=$(srcdir)/mplibdir $(ctangle)
# Creating several files: need stamp file and two rules with identical recipes
mp_ctangle_sh = CWEBINPUTS=$(srcdir)/mplibdir AM_V_P=$(AM_V_P) $(SHELL) ./tangle-sh $@ $(CTANGLE)

## MetaPost C sources
nodist_mpost_SOURCES = mpost.c $(mpxout_c_h)
mpxout_c_h = mpxout.c mpxout.h

mpost.c: ctangle$(EXEEXT) mplibdir/mpost.w
	$(mp_ctangle) mpost.w

$(mpxout_c_h): mpxout-tangle
	@$(mp_ctangle_sh) mpxout
mpxout-tangle: ctangle$(EXEEXT) mplibdir/mpxout.w tangle-sh
	@$(mp_ctangle_sh) mpxout

## MetaPost CWeb sources
mpost_web = mplibdir/mpost.w mplibdir/mpxout.w

#$(mpost_OBJECTS): $(nodist_mpost_SOURCES) libmplib.a $(LIBPNG_DEPEND)
$(mpost_OBJECTS): $(nodist_mpost_SOURCES) libmplibcore.a libmplibextramath.a libmplibbackends.a $(LIBPNG_DEPEND)

EXTRA_DIST += mplibdir/ChangeLog $(mpost_web)

DISTCLEANFILES += $(nodist_mpost_SOURCES) mpxout-tangle

## MetaPost Tests
##
mp_tests = mplibdir/dvitomp.test mplibdir/mptraptest.test
mplibdir/dvitomp.log: mpost$(EXEEXT)
mplibdir/mptraptest.log: mpost$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)

EXTRA_DIST += $(mp_tests)

if MP
TESTS += $(mp_tests)
TRIPTRAP += mptrap.diffs
TRIPTRAP_CLEAN += mptrap-clean
endif MP
DISTCLEANFILES += mptrap.diffs

## mplibdir/dvitomp.test
DISTCLEANFILES += ptmr.mpx tests/xptmr.mpx tests/xstory.mpx
## mplibdir/mptraptest
mptrap.diffs: mpost$(EXEEXT) pltotf$(EXEEXT) tftopl$(EXEEXT)
	$(triptrap_diffs) $@
.PHONY: mptrap-clean
mptrap-clean:
	rm -rf mptrapdir