1# Makefile.am for XS modules
2#
3# Copyright 2015-2020 Free Software Foundation, Inc.
4#
5# This file is free software; as a special exception the author gives
6# unlimited permission to copy and/or distribute it, with or without
7# modifications, as long as this notice is preserved.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12#
13AUTOMAKE_OPTIONS=foreign subdir-objects
14
15EXTRA_DIST=
16
17######################## Gnulib ################################
18
19AM_CPPFLAGS =                \
20  -I$(srcdir)                \
21  -I$(srcdir)/gnulib/lib     \
22  -I$(builddir)/gnulib/lib
23
24ACLOCAL_AMFLAGS = -I gnulib/m4
25
26SUBDIRS=gnulib/lib
27
28EXTRA_DIST+=gnulib/m4/gnulib-cache.m4
29
30################### End Gnulib section #########################
31
32AM_CPPFLAGS += -DDATADIR=\"$(datadir)\"
33
34xsdir = $(pkglibdir)
35
36PERL_INC = $(PERL_CONF_archlibexp)/CORE
37
38XSUBPPARGS = -typemap $(PERL_CONF_privlibexp)/ExtUtils/typemap
39
40.xs.c:
41	$(XSUBPP) $(XSUBPPARGS) $< > $*.xsc && mv $*.xsc $(srcdir)/$*.c
42
43EXTRA_DIST += TestXS.pm
44
45# -------------------------------------------------------
46
47CLEANFILES =
48
49xs_LTLIBRARIES = XSParagraph.la TestXS.la
50XSParagraph_la_SOURCES = XSParagraph.c xspara.c xspara.h \
51			 text.c text.h ppport.h
52TestXS_la_SOURCES = TestXS.c ppport.h
53
54xs_LTLIBRARIES += MiscXS.la
55MiscXS_la_SOURCES = MiscXS.c misc.c miscxs.h ppport.h
56
57
58# TestXS.la has to be included in xs_LIBRARIES, and not noinst_LIBRARIES,
59# otherwise dynamic libraries aren't built (a libtool bug).  Work around
60# this by deleting it after it's installed.
61install-data-hook:
62	rm -f $(DESTDIR)$(xsdir)/TestXS*
63
64EXTRA_DIST += TestXS.xs XSParagraph.xs MiscXS.xs
65
66
67AM_CFLAGS = $(PERL_CONF_ccflags) $(PERL_CONF_optimize)
68AM_CFLAGS += -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(VERSION)\"
69AM_CFLAGS += -I$(PERL_INC)
70
71if HOST_NEEDS_NO_UNDEFINED
72  PLATFORM_LDFLAGS = -no-undefined -L$(PERL_INC) $(PERL_CONF_libperl)
73  # The -no-undefined flag is for MS-Windows.  See info node
74  # `(gnulib)Libtool and Windows'.  The -L and -l options after it show
75  # where to find the undefined symbols.
76else
77  PLATFORM_LDFLAGS =
78endif
79
80AM_LDFLAGS = -avoid-version -module $(PERL_CONF_ccdlflags)
81AM_LDFLAGS += $(PLATFORM_LDFLAGS)
82
83XSParagraph_la_LIBADD = $(builddir)/gnulib/lib/libgnu.la
84XSParagraph_la_LDFLAGS = $(AM_LDFLAGS) $(LTLIBINTL) $(LTLIBICONV)
85
86
87
88########################## parsetexi
89
90p=parsetexi
91
92modulesdir = $(pkgdatadir)/Texinfo/XS/parsetexi
93dist_modules_DATA = $(p)/Parsetexi.pm
94
95if HAVE_ICONV
96xs_LTLIBRARIES += Parsetexi.la
97endif
98
99Parsetexi_la_SOURCES= parsetexi/Parsetexi.c \
100                      parsetexi/api.c \
101		      parsetexi/api.h \
102		      parsetexi/parser.c \
103		      parsetexi/parser.h \
104		      parsetexi/tree_types.h \
105		      parsetexi/element_types.c \
106		      parsetexi/element_types.h \
107		      parsetexi/commands.c \
108		      parsetexi/commands.h \
109		      parsetexi/command_ids.h \
110		      parsetexi/input.c \
111		      parsetexi/input.h \
112		      parsetexi/tree.c \
113		      parsetexi/tree.h \
114		      parsetexi/close.c \
115		      parsetexi/text.c \
116		      parsetexi/text.h \
117		      parsetexi/conf.c \
118		      parsetexi/conf.h \
119		      parsetexi/context_stack.c \
120		      parsetexi/context_stack.h \
121		      parsetexi/debug.c \
122		      parsetexi/convert.c \
123		      parsetexi/convert.h \
124		      parsetexi/end_line.c \
125		      parsetexi/separator.c \
126		      parsetexi/multitable.c \
127		      parsetexi/indices.c \
128		      parsetexi/indices.h \
129		      parsetexi/macro.c \
130		      parsetexi/macro.h \
131		      parsetexi/handle_commands.c \
132		      parsetexi/handle_commands.h \
133		      parsetexi/def.c \
134		      parsetexi/def.h \
135		      parsetexi/extra.c \
136		      parsetexi/menus.c \
137		      parsetexi/labels.c \
138		      parsetexi/labels.h \
139		      parsetexi/errors.c \
140		      parsetexi/errors.h \
141		      parsetexi/counter.c \
142		      parsetexi/counter.h
143EXTRA_DIST += $(p)/command_data.c
144
145EXTRA_DIST += $(p)/Parsetexi.xs
146
147Parsetexi_la_LIBADD = $(top_builddir)/gnulib/lib/libgnu.la
148Parsetexi_la_LDFLAGS = $(AM_LDFLAGS) $(LTLIBINTL) $(LTLIBICONV)
149
150# To locate include files under out-of-source builds.
151Parsetexi_la_CPPFLAGS = -I$(srcdir)/parsetexi $(AM_CPPFLAGS)
152
153BUILT_SOURCES=parsetexi/element_types.c \
154              parsetexi/element_types.h \
155              parsetexi/command_data.c \
156	      parsetexi/command_ids.h
157
158# Need to be distributed
159EXTRA_DIST+=$(p)/element_types.txt $(p)/element_types.awk \
160	   $(p)/command_data.txt $(p)/command_data.awk
161
162$(srcdir)/$(p)/element_types.c $(srcdir)/$(p)/element_types.h: $(p)/element_types.txt $(p)/element_types.awk
163	$(GAWK) -v srcdir=$(srcdir)/$(p) -f $(srcdir)/$(p)/element_types.awk \
164	     $(srcdir)/$(p)/element_types.txt
165
166$(srcdir)/$(p)/command_data.c $(srcdir)/$(p)/command_ids.h: $(p)/command_data.txt $(p)/command_data.awk
167	$(GAWK) -v srcdir=$(srcdir)/$(p) -f $(srcdir)/$(p)/command_data.awk \
168	     $(srcdir)/$(p)/command_data.txt
169
170