aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/makefile
blob: d6c918600f67fa8e096155cd8f82e1ec4ca1b888 (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
153
# Make file for Scintilla on Windows
# Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
# The License.txt file describes the conditions under which this software may be distributed.
# This makefile assumes the Mingw-w64 version of GCC 7.1+ is used and changes will
# be needed to use other compilers.

.SUFFIXES: .cxx

DIR_BIN=../bin

COMPONENT = $(DIR_BIN)/Scintilla.dll
LEXCOMPONENT = $(DIR_BIN)/SciLexer.dll
LIBSCI = $(DIR_BIN)/libscintilla.a

ifdef CLANG
CXX = clang++
# Clang doesn't like omitting braces in array initialization but they just add noise,
# __uuidof is a Microsoft extension but makes COM code neater,
# public visibility avoids warnings like 'locally defined symbol __std_terminate imported'
CLANG_OPTS = -Wno-missing-braces -Wno-language-extension-token -Xclang -flto-visibility-public-std
else
# MinGW GCC
LDMINGW = -Wl,--enable-runtime-pseudo-reloc-v2 -Wl,--add-stdcall-alias
LIBSMINGW = -lstdc++
STRIPOPTION = -s
endif

CXXSTD = c++17

ifeq ($(OS),Windows_NT)
DEL = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del /q)
else
DEL = rm -f
endif
RANLIB ?= ranlib
WINDRES ?= windres

vpath %.h ../src ../include ../lexlib
vpath %.cxx ../src ../lexlib ../lexers

LDFLAGS=-shared -static -mwindows $(LDMINGW)
LIBS=-lgdi32 -luser32 -limm32 -lole32 -luuid -loleaut32 -lmsimg32 $(LIBSMINGW)
# Add -MMD to get dependencies
INCLUDEDIRS=-I ../include -I ../src -I../lexlib

CXXBASEFLAGS=--std=$(CXXSTD) -Wall -pedantic $(INCLUDEDIRS) -D_CRT_SECURE_NO_DEPRECATE=1 $(CLANG_OPTS)

ifdef NO_CXX11_REGEX
REFLAGS=-DNO_CXX11_REGEX
endif

ifdef DEBUG
CXXFLAGS=-DDEBUG -g $(CXXBASEFLAGS)
else
CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS)
STRIPFLAG=$(STRIPOPTION)
endif

all:	$(COMPONENT) $(LEXCOMPONENT) $(LIBSCI)

clean:
	$(DEL) *.exe *.o *.a *.obj *.dll *.res *.map *.plist

.cxx.o:
	$(CXX) $(CXXFLAGS) $(REFLAGS) -c $<

analyze:
	$(CXX) --analyze $(CXXFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx

depend deps.mak:
	python DepGen.py

LEXOBJS:=$(addsuffix .o,$(basename $(sort $(notdir $(wildcard ../lexers/Lex*.cxx)))))

# Required for base Scintilla
BASEOBJS = \
	AutoComplete.o \
	CallTip.o \
	CaseConvert.o \
	CaseFolder.o \
	CellBuffer.o \
	CharacterCategory.o \
	CharacterSet.o \
	CharClassify.o \
	ContractionState.o \
	DBCS.o \
	Decoration.o \
	Document.o \
	EditModel.o \
	Editor.o \
	EditView.o \
	KeyMap.o \
	Indicator.o \
	LineMarker.o \
	MarginView.o \
	PerLine.o \
	PlatWin.o \
	PositionCache.o \
	PropSetSimple.o \
	RESearch.o \
	RunStyles.o \
	ScintRes.o \
	Selection.o \
	Style.o \
	UniConversion.o \
	UniqueString.o \
	ViewStyle.o \
	XPM.o \
	HanjaDic.o

SOBJS = ScintillaDLL.o ScintillaWin.o ScintillaBase.o $(BASEOBJS)

# Required by lexers
LEXLIBOBJS=\
	Accessor.o \
	Catalogue.o \
	ExternalLexer.o \
	DefaultLexer.o \
	LexerBase.o \
	LexerModule.o \
	LexerSimple.o \
	StyleContext.o \
	WordList.o \

# Required by libraries and DLLs that include lexing
SCILEXOBJS=\
	$(BASEOBJS) \
	$(LEXLIBOBJS) \
	$(LEXOBJS) \
	ScintillaBaseL.o

$(COMPONENT): $(SOBJS) Scintilla.def
	$(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) $(SOBJS) $(CXXFLAGS) $(LIBS)

$(LEXCOMPONENT): ScintillaDLL.o ScintillaWinL.o $(SCILEXOBJS) Scintilla.def
	$(CXX) $(LDFLAGS) -o $@ $(STRIPFLAG) ScintillaDLL.o ScintillaWinL.o $(SCILEXOBJS) $(CXXFLAGS) $(LIBS)

$(LIBSCI): ScintillaWin.o $(SCILEXOBJS)
	$(AR) rc $@ $^
	$(RANLIB) $@

# Automatically generate dependencies for most files with "make deps"
include deps.mak

ScintillaBaseL.o:
	$(CXX) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@

ScintillaWinL.o:
	$(CXX) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@

ScintRes.o:	ScintRes.rc
	$(WINDRES) ScintRes.rc $@