aboutsummaryrefslogtreecommitdiffhomepage
path: root/contrib/scintilla.am
blob: 46159c18da73d68a1725f40b85539881a187dad2 (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
# We use the existing Scintilla/Lexilla Makefile build system to
# avoid redundancies and maintainance overhead.
# These build systems produce static libraries (*.a).
# This however has the following disadvantages:
#
# * We cannot add plain static libraries to libtool convenience
#   libraries using LIBADD.
#   Therefore, we cannot wrap Scintilla and Lexilla into a convenience
#   library.
#   That's why this file must instead be included everywhere where
#   scintilla.a and liblexilla.a are referenced and they must be added
#   to programs using LDADD.

LIBSCINTILLA = @abs_top_builddir@/contrib/scintilla/bin/scintilla.a

if INTERFACE_GTK
MAKE_SCINTILLA = $(MAKE) -C @top_builddir@/contrib/scintilla/bin \
                 -f @SCINTILLA_PATH@/gtk/makefile \
                 srcdir=@SCINTILLA_PATH@/gtk \
                 COMPLIB=$(LIBSCINTILLA) \
                 GTK3=yes CONFIGFLAGS='@LIBGTK_CFLAGS@' \
                 CXXFLAGS='@SCINTILLA_CXXFLAGS@'
else
MAKE_SCINTILLA = $(MAKE) -C @top_builddir@/contrib/scintilla/bin \
                 -f @SCINTERM_PATH@/Makefile \
                 srcdir=@SCINTERM_PATH@ basedir=@SCINTILLA_PATH@ \
                 scintilla=$(LIBSCINTILLA) \
                 CXXFLAGS='@SCINTILLA_CXXFLAGS@' \
                 CURSES_FLAGS='@PDCURSES_CFLAGS@ @XCURSES_CFLAGS@ @CURSES_CFLAGS@'
endif

# Pass toolchain configuration to Scintilla.
# This is what allows cross compilation
MAKE_SCINTILLA += CC='@CC@' CXX='@CXX@' \
                  AR='@AR@' RANLIB='@RANLIB@'

# Build as phony target - we do not know
# scintilla.a's dependencies.
# If it's up to date, the additional recursive
# make call does not hurt.
.PHONY: make-scintilla
# FIXME: deps.mak cannot be generated when building out-of-tree.
# Also this would draw in a Python dependency.
# It needs to be removed in clean-local-scintilla to appease `make distcheck`.
make-scintilla:
	mkdir -p @top_builddir@/contrib/scintilla/bin
	touch @top_builddir@/contrib/scintilla/bin/deps.mak
	$(MAKE_SCINTILLA) $(LIBSCINTILLA)

# scintilla.a itself is not phony.
# This avoids unnecessary relinking if it is
# up to date.
# Also note the ; which defines this recipe as
# empty.
$(LIBSCINTILLA) : make-scintilla;

.PHONY: clean-local-scintilla
clean-local-scintilla:
	mkdir -p @top_builddir@/contrib/scintilla/bin
	$(MAKE_SCINTILLA) clean
	test "@abs_top_srcdir" = "@abs_top_builddir@" || \
		$(RM) -f @top_builddir@/contrib/scintilla/bin/deps.mak

LIBLEXILLA = @abs_top_builddir@/contrib/lexilla/bin/liblexilla.a

MAKE_LEXILLA = $(MAKE) -C @LEXILLA_PATH@/src \
               DIR_O=@abs_top_builddir@/contrib/lexilla/bin \
               DIR_BIN=@abs_top_builddir@/contrib/lexilla/bin \
               SCINTILLA_INCLUDE=@SCINTILLA_PATH@/include \
               CXXFLAGS='@SCINTILLA_CXXFLAGS@' \
               CC='@CC@' CXX='@CXX@' \
               AR='@AR@' RANLIB='@RANLIB@'

# FIXME: Makes sure that -arch arm64 -arch x86_64
# will not be used on Mac OS as it is not supported
# by all SDKs.
# The remaining BASE_FLAGS should not be important.
MAKE_LEXILLA += BASE_FLAGS=''

.PHONY: make-lexilla
make-lexilla:
	mkdir -p @top_builddir@/contrib/lexilla/bin
	$(MAKE_LEXILLA) $(LIBLEXILLA)

$(LIBLEXILLA) : make-lexilla;

.PHONY: clean-local-lexilla
clean-local-lexilla:
	mkdir -p @top_builddir@/contrib/lexilla/bin
	$(MAKE_LEXILLA) clean

# NOTE: using a separate `clean-local-scintilla`
# target allows us to add more custom rules to the
# including Automake file
clean-local: clean-local-scintilla clean-local-lexilla