2021-02-21 04:53:09 +00:00
|
|
|
# Make file for Scintilla on Linux, macOS, or Windows
|
|
|
|
# @file makefile
|
2010-08-21 23:59:56 +00:00
|
|
|
# Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
|
|
|
|
# The License.txt file describes the conditions under which this software may be distributed.
|
2021-02-21 04:53:09 +00:00
|
|
|
# This makefile assumes GCC 9.0+ is used and changes will be needed to use other compilers.
|
|
|
|
# Clang 9.0+ can be used with CLANG=1 on command line.
|
|
|
|
# Builds for GTK+ 2 and 3. GTK 3 requires GTK3=1 on command line.
|
2010-08-21 23:59:56 +00:00
|
|
|
# Also works with ming32-make on Windows.
|
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
.PHONY: static shared all clean analyze depend
|
|
|
|
|
2019-05-04 18:14:48 +00:00
|
|
|
.SUFFIXES: .cxx .c .o .h .a .list
|
|
|
|
|
|
|
|
srcdir ?= .
|
2021-02-21 04:53:09 +00:00
|
|
|
basedir = $(srcdir)/..
|
2019-05-04 18:14:48 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
WARNINGS = -Wpedantic -Wall
|
2010-08-21 23:59:56 +00:00
|
|
|
ifdef CLANG
|
2019-05-04 18:14:48 +00:00
|
|
|
CXX = clang++
|
2015-06-07 21:19:26 +00:00
|
|
|
CC = clang
|
2021-02-21 04:53:09 +00:00
|
|
|
WARNINGS += -Wno-deprecated-register
|
|
|
|
ifdef windir
|
|
|
|
# Turn off some warnings that occur when Clang is being used on Windows where it
|
|
|
|
# is including Microsoft headers.
|
|
|
|
# incompatible-ms-struct is because more complex structs are not quite the same as MSVC
|
|
|
|
WARNINGS += -Wno-incompatible-ms-struct
|
|
|
|
# language-extension-token is because of __int64 in glib-2.0 glibconfig.h
|
|
|
|
WARNINGS += -Wno-language-extension-token
|
|
|
|
# register may be used in glib
|
|
|
|
# This produces a warning since -Wno-register is not valid for C files but it still works
|
|
|
|
WARNINGS += -Wno-register
|
|
|
|
DEFINES += -D_CRT_SECURE_NO_DEPRECATE
|
|
|
|
endif
|
2015-06-07 21:19:26 +00:00
|
|
|
# Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for
|
|
|
|
# thread also need to create Position Independent Executable -> search online documentation
|
|
|
|
SANITIZE = address
|
|
|
|
#SANITIZE = undefined
|
2021-02-21 04:53:09 +00:00
|
|
|
BASE_FLAGS += -fsanitize=$(SANITIZE)
|
2010-08-21 23:59:56 +00:00
|
|
|
endif
|
2019-05-04 18:14:48 +00:00
|
|
|
ARFLAGS = rc
|
2021-02-21 04:53:09 +00:00
|
|
|
RANLIB ?= ranlib
|
|
|
|
PKG_CONFIG ?= pkg-config
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
GTK_VERSION = $(if $(GTK3),gtk+-3.0,gtk+-2.0)
|
2011-07-17 22:30:49 +00:00
|
|
|
|
2011-03-22 00:16:49 +00:00
|
|
|
# Environment variable windir always defined on Win32
|
|
|
|
|
2019-05-04 18:14:48 +00:00
|
|
|
# Enable Position Independent Code except on Windows where it is the default so the flag produces a warning
|
|
|
|
ifndef windir
|
2021-02-21 04:53:09 +00:00
|
|
|
BASE_FLAGS += -fPIC
|
2022-01-04 23:07:50 +00:00
|
|
|
ifeq ($(shell uname),Darwin)
|
|
|
|
LDFLAGS += -dynamiclib
|
|
|
|
endif
|
2019-05-04 18:14:48 +00:00
|
|
|
endif
|
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
LDFLAGS += -shared
|
|
|
|
|
|
|
|
# Take care of changing Unix style '/' directory separator to '\' on Windows
|
|
|
|
normalize = $(if $(windir),$(subst /,\,$1),$1)
|
|
|
|
|
|
|
|
PYTHON = $(if $(windir),pyw,python3)
|
|
|
|
|
|
|
|
SHAREDEXTENSION = $(if $(windir),dll,so)
|
|
|
|
|
2011-03-22 00:16:49 +00:00
|
|
|
ifdef windir
|
2019-05-04 18:14:48 +00:00
|
|
|
CC = gcc
|
2011-03-22 00:16:49 +00:00
|
|
|
DEL = del /q
|
|
|
|
else
|
|
|
|
DEL = rm -f
|
|
|
|
endif
|
2021-02-21 04:53:09 +00:00
|
|
|
COMPLIB=$(basedir)/bin/scintilla.a
|
|
|
|
COMPONENT=$(basedir)/bin/libscintilla.$(SHAREDEXTENSION)
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
vpath %.h $(srcdir) $(basedir)/src $(basedir)/include
|
2019-05-04 18:14:48 +00:00
|
|
|
vpath %.c $(srcdir)
|
2022-01-04 23:07:50 +00:00
|
|
|
vpath %.cxx $(srcdir) $(basedir)/src
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
INCLUDES=-I $(basedir)/include -I $(basedir)/src
|
|
|
|
DEFINES += -DGTK
|
2021-02-21 04:53:09 +00:00
|
|
|
BASE_FLAGS += $(WARNINGS)
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2019-05-04 18:14:48 +00:00
|
|
|
ifdef NO_CXX11_REGEX
|
2021-02-21 04:53:09 +00:00
|
|
|
DEFINES += -DNO_CXX11_REGEX
|
2015-06-07 21:19:26 +00:00
|
|
|
endif
|
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG)
|
|
|
|
BASE_FLAGS += $(if $(DEBUG),-g,-Os)
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
CXX_BASE_FLAGS =--std=c++17 $(BASE_FLAGS)
|
|
|
|
CXX_ALL_FLAGS =$(DEFINES) $(INCLUDES) $(CXX_BASE_FLAGS) $(CONFIG_FLAGS)
|
2011-07-17 22:30:49 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
CONFIG_FLAGS:=$(shell $(PKG_CONFIG) --cflags $(GTK_VERSION))
|
|
|
|
CONFIGLIB:=$(shell $(PKG_CONFIG) --libs $(GTK_VERSION) gmodule-no-export-2.0)
|
2010-08-21 23:59:56 +00:00
|
|
|
MARSHALLER=scintilla-marshal.o
|
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
all: $(COMPLIB) $(COMPONENT)
|
2021-02-21 04:53:09 +00:00
|
|
|
|
|
|
|
static: $(COMPLIB)
|
|
|
|
|
|
|
|
shared: $(COMPONENT)
|
|
|
|
|
2019-05-04 18:14:48 +00:00
|
|
|
clean:
|
2021-02-21 04:53:09 +00:00
|
|
|
$(DEL) *.o $(call normalize,$(COMPLIB)) $(call normalize,$(COMPONENT)) *.plist
|
2019-05-04 18:14:48 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
%.o: %.cxx
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXX_ALL_FLAGS) $(CXXFLAGS) -c $<
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CPPFLAGS) $(DEFINES) $(INCLUDES) $(CONFIG_FLAGS) $(BASE_FLAGS) $(CFLAGS) -w -c $<
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2019-05-04 18:14:48 +00:00
|
|
|
GLIB_GENMARSHAL = glib-genmarshal
|
|
|
|
GLIB_GENMARSHAL_FLAGS = --prefix=scintilla_marshal
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2021-02-21 04:53:09 +00:00
|
|
|
%.h: %.list
|
2019-05-04 18:14:48 +00:00
|
|
|
$(GLIB_GENMARSHAL) --header $(GLIB_GENMARSHAL_FLAGS) $< > $@
|
2021-02-21 04:53:09 +00:00
|
|
|
%.c: %.list
|
2019-05-04 18:14:48 +00:00
|
|
|
$(GLIB_GENMARSHAL) --body $(GLIB_GENMARSHAL_FLAGS) $< > $@
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2013-08-28 00:44:27 +00:00
|
|
|
analyze:
|
2022-01-04 23:07:50 +00:00
|
|
|
clang --analyze $(DEFINES) $(INCLUDES) $(CONFIG_FLAGS) $(CXX_BASE_FLAGS) $(CXXFLAGS) $(srcdir)/*.cxx $(basedir)/src/*.cxx
|
2010-08-21 23:59:56 +00:00
|
|
|
|
2019-07-21 13:26:02 +00:00
|
|
|
depend deps.mak:
|
2021-02-21 04:53:09 +00:00
|
|
|
$(PYTHON) DepGen.py
|
|
|
|
|
|
|
|
# Required for base Scintilla
|
|
|
|
SRC_OBJS = \
|
|
|
|
AutoComplete.o \
|
|
|
|
CallTip.o \
|
|
|
|
CaseConvert.o \
|
|
|
|
CaseFolder.o \
|
|
|
|
CellBuffer.o \
|
2022-08-27 07:35:52 +00:00
|
|
|
ChangeHistory.o \
|
2022-01-04 23:07:50 +00:00
|
|
|
CharacterCategoryMap.o \
|
|
|
|
CharacterType.o \
|
2021-02-21 04:53:09 +00:00
|
|
|
CharClassify.o \
|
|
|
|
ContractionState.o \
|
|
|
|
DBCS.o \
|
|
|
|
Decoration.o \
|
|
|
|
Document.o \
|
|
|
|
EditModel.o \
|
|
|
|
Editor.o \
|
|
|
|
EditView.o \
|
2022-01-04 23:07:50 +00:00
|
|
|
Geometry.o \
|
2021-02-21 04:53:09 +00:00
|
|
|
Indicator.o \
|
|
|
|
KeyMap.o \
|
|
|
|
LineMarker.o \
|
|
|
|
MarginView.o \
|
|
|
|
PerLine.o \
|
|
|
|
PositionCache.o \
|
|
|
|
RESearch.o \
|
|
|
|
RunStyles.o \
|
|
|
|
Selection.o \
|
|
|
|
Style.o \
|
|
|
|
UniConversion.o \
|
|
|
|
UniqueString.o \
|
|
|
|
ViewStyle.o \
|
|
|
|
XPM.o
|
|
|
|
|
|
|
|
GTK_OBJS = \
|
|
|
|
ScintillaBase.o \
|
|
|
|
PlatGTK.o \
|
|
|
|
ScintillaGTK.o \
|
|
|
|
ScintillaGTKAccessible.o
|
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
$(COMPLIB): $(SRC_OBJS) $(GTK_OBJS) $(MARSHALLER)
|
2019-05-04 18:14:48 +00:00
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
2010-08-21 23:59:56 +00:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
$(COMPONENT): $(SRC_OBJS) $(GTK_OBJS) $(MARSHALLER)
|
2021-02-21 04:53:09 +00:00
|
|
|
$(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(CONFIGLIB)
|
|
|
|
|
2022-01-04 23:07:50 +00:00
|
|
|
# Automatically generate header dependencies with "make depend"
|
2010-08-21 23:59:56 +00:00
|
|
|
include deps.mak
|