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
|
# Make file for Lexilla
# @file makefile
# Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
# The License.txt file describes the conditions under which this software may be distributed.
# This works on Windows or Linux using GCC 9.0+
# This works on Windows, Linux, or macOS using Clang 9.0+
# On Windows, it is tested with Mingw-w64 GCC and Clang.
# on macOS, it always uses Clang
# For debug versions define DEBUG on the command line:
# make DEBUG=1
# On Windows, to build with MSVC, run lexilla.mak
.PHONY: all clean analyze depend
.SUFFIXES: .cxx
DIR_BIN=../../bin
WARNINGS = -Wpedantic -Wall -Wextra
ifdef windir
SHARED_NAME = lexilla
SHAREDEXTENSION = dll
WINDRES ?= windres
VERSION_RESOURCE = LexillaVersion.o
else
SHARED_NAME = liblexilla
ifeq ($(shell uname),Darwin)
CLANG := 1
LDFLAGS += -dynamiclib
SHAREDEXTENSION = dylib
else
SHAREDEXTENSION = so
endif
BASE_FLAGS += -fvisibility=hidden
endif
LEXILLA=$(DIR_BIN)/$(SHARED_NAME).$(SHAREDEXTENSION)
LIBLEXILLA=$(DIR_BIN)/liblexilla.a
BASE_FLAGS += --std=c++17
ifdef CLANG
CXX = clang++
ifdef windir
# Clang on Win32 uses MSVC headers so will complain about strcpy without this
DEFINES += -D_CRT_SECURE_NO_DEPRECATE=1
endif
endif
ifdef windir
LDFLAGS += -mwindows
else
BASE_FLAGS += -fPIC
endif
# Take care of changing Unix style '/' directory separator to '\' on Windows
normalize = $(if $(windir),$(subst /,\,$1),$1)
PYTHON = $(if $(windir),pyw,python3)
ifdef windir
DEL = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del /q)
else
DEL = rm -f
endif
RANLIB ?= ranlib
vpath %.h ../../src ../../include ../../lexlib
vpath %.cxx ../../src ../../lexlib ../../lexers
DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG)
BASE_FLAGS += $(if $(DEBUG),-g,-Os)
INCLUDES = -I ../../include -I ../../src -I ../../lexlib
LDFLAGS += -shared
BASE_FLAGS += $(WARNINGS)
all: $(LEXILLA) $(LIBLEXILLA)
clean:
$(DEL) *.o *.obj *.a *.res *.map *.plist $(call normalize,$(LEXILLA) $(LIBLEXILLA))
%.o: %.cxx
$(CXX) $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
%.o: %.rc
$(WINDRES) $< $@
analyze:
$(CXX) --analyze $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CXXFLAGS) *.cxx ../../lexlib/*.cxx ../../lexers/*.cxx
depend deps.mak:
$(PYTHON) DepGen.py
LEXERS:=$(sort $(notdir $(wildcard ../../lexers/Lex*.cxx)))
OBJS = Lexilla.o
# Required by lexers
LEXLIB_OBJS=\
Accessor.o \
CharacterCategory.o \
CharacterSet.o \
DefaultLexer.o \
LexerBase.o \
LexerModule.o \
LexerSimple.o \
PropSetSimple.o \
StyleContext.o \
WordList.o
# Required by libraries and DLLs that include lexing
LEXILLA_OBJS=\
$(OBJS) \
$(LEXLIB_OBJS) \
$(LEXERS:.cxx=.o)
$(LEXILLA): $(LEXILLA_OBJS) $(VERSION_RESOURCE)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
$(LIBLEXILLA): $(LEXILLA_OBJS)
$(AR) rc $@ $^
$(RANLIB) $@
# Automatically generate dependencies for most files with "make deps"
include deps.mak
|