From ec391b6bfe8d87f4fb1bbb2a4e6033eaad9f4672 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 12 Mar 2018 18:20:24 -0400 Subject: Start using Scintilla's LongTerm3, which now includes Scintillua and Scinterm. Since LongTerm3 requires a C++11 compiler, GCC 4.9+ is required. Since C++11 includes regex capability, drop TRE dependency. --- src/Makefile | 163 ++++++++++++++++++++++++----------------------------------- 1 file changed, 67 insertions(+), 96 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index c09ca11a..bb6ed657 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,15 @@ # Copyright 2007-2018 Mitchell mitchell.att.foicica.com. See LICENSE. CC = gcc +CFLAGS = -Os CXX = g++ +CXXFLAGS = -Os -std=c++11 MAKE = make ifeq (win, $(findstring win, $(MAKECMDGOALS))) # Cross-compile for Win32. CROSS = i686-w64-mingw32- - CFLAGS = -mms-bitfields -Os - CXXFLAGS = -mms-bitfields -static-libgcc -static-libstdc++ -Os -std=c++0x + CFLAGS += -mms-bitfields + CXXFLAGS += -mms-bitfields -static-libgcc -static-libstdc++ LUA_CFLAGS = -DLUA_BUILD_AS_DLL -DLUA_LIB LDFLAGS = -Wl,--retain-symbols-file -Wl,lua.sym ifeq (, $(findstring curses, $(MAKECMDGOALS))) @@ -34,11 +36,11 @@ ifeq (win, $(findstring win, $(MAKECMDGOALS))) libluajit = luajit/src/lua51.dll else ifeq (osx, $(findstring osx, $(MAKECMDGOALS))) # Cross-compile for Mac OSX. - CROSS = i686-apple-darwin10- - CFLAGS = -m32 -arch i386 -mdynamic-no-pic -mmacosx-version-min=10.5 -Os - CXXFLAGS = -m32 -arch i386 -mdynamic-no-pic -mmacosx-version-min=10.5 -Os + CROSS = i386-apple-darwin9- + CFLAGS += -mdynamic-no-pic + CXXFLAGS += -mdynamic-no-pic LUA_CFLAGS = -DLUA_USE_MACOSX - LDFLAGS = -liconv -rdynamic + LDFLAGS = -liconv -Wl,-read_only_relocs,suppress ifeq (, $(findstring curses, $(MAKECMDGOALS))) plat_flag = -DGTK GTK_CFLAGS = $(shell PKG_CONFIG_PATH=`pwd`/gtkosx/lib/pkgconfig \ @@ -58,15 +60,13 @@ else ifeq (osx, $(findstring osx, $(MAKECMDGOALS))) libluajit = luajit/src/libluajit.osx.a else # Build for Linux/BSD. - CFLAGS = -Os - CXXFLAGS = -Os -std=c++0x LUA_CFLAGS = -DLUA_USE_LINUX LDFLAGS = -rdynamic -Wl,--retain-symbols-file -Wl,lua.sym ifeq (Linux, $(shell uname -s)) LDFLAGS += -ldl else - CC=cc - CXX=c++ + CC = cc + CXX = c++ LDFLAGS += -liconv MAKE = gmake endif @@ -104,9 +104,8 @@ endif # Scintilla. -sci_flags = -pedantic $(plat_flag) -DSCI_LEXER -DNDEBUG -DNO_CXX11_REGEX \ - -DSCI_OWNREGEX -Iscintilla/include -Iscintilla/src \ - -Iscintilla/lexlib -Itre/lib -Wall +sci_flags = -pedantic $(plat_flag) -DSCI_LEXER -DLPEG_LEXER -DNDEBUG \ + -Iscintilla/include -Iscintilla/src -Iscintilla/lexlib -Wall sci_objs = AutoComplete.o CallTip.o CaseConvert.o CaseFolder.o Catalogue.o \ CellBuffer.o CharClassify.o ContractionState.o Decoration.o \ @@ -117,16 +116,13 @@ sci_objs = AutoComplete.o CallTip.o CaseConvert.o CaseFolder.o Catalogue.o \ sci_lex_objs = Accessor.o CharacterCategory.o CharacterSet.o LexerBase.o \ LexerModule.o LexerNoExceptions.o LexerSimple.o PropSetSimple.o \ StyleContext.o WordList.o +sci_lexer_objs = LexLPeg.o LexLPegjit.o LexLPeg-curses.o LexLPegjit-curses.o sci_gtk_objs = PlatGTK.o ScintillaGTK.o ScintillaGTKAccessible.o -regex_objs = regcomp.o regerror.o regexec.o tre-ast.o tre-compile.o \ - tre-filter.o tre-match-backtrack.o tre-match-parallel.o tre-mem.o \ - tre-parse.o tre-stack.o xmalloc.o -lexlpeg_objs = LexLPeg.o LexLPegjit.o LexLPeg-curses.o LexLPegjit-curses.o +sci_curses_objs = ScintillaCurses.o # Textadept. -ta_flags = -std=c99 -pedantic $(plat_flag) -Iscintilla/include -Igtdialog \ - -Wall -Wextra -Wno-unused +ta_flags = -std=c99 -pedantic $(plat_flag) -Iscintilla/include -Igtdialog -Wall textadept_gtk_objs = textadept.o textadeptjit.o textadept_curses_objs = textadept-curses.o textadeptjit-curses.o @@ -168,17 +164,14 @@ $(sci_objs): %.o: scintilla/src/%.cxx $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $< -o $@ $(sci_lex_objs): %.o: scintilla/lexlib/%.cxx $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $< -o $@ +$(sci_lexer_objs): scintilla/lexers/LexLPeg.cxx + $(CROSS)$(CXX) -c $(CXXFLAGS) $(LUA_CFLAGS) $(sci_flags) $< -o $@ $(sci_gtk_objs): %.o: scintilla/gtk/%.cxx $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $(GTK_CFLAGS) $< -o $@ scintilla-marshal.o: scintilla/gtk/scintilla-marshal.c $(CROSS)$(CC) -c $(CFLAGS) $(GTK_CFLAGS) $< -o $@ -$(regex_objs): %.o: tre/lib/%.c - $(CROSS)$(CC) -c $(CFLAGS) -Itre/lib $< -o $@ -ScintillaTerm.o: scintilla/term/ScintillaTerm.cxx - $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $(CURSES_CFLAGS) -DSCI_COMPAT_4 \ - -DTA_PATCH $< -o $@ -$(lexlpeg_objs): LexLPeg.cxx - $(CROSS)$(CXX) -c $(CXXFLAGS) $(LUA_CFLAGS) $(sci_flags) $< -o $@ +$(sci_curses_objs): %.o: scintilla/curses/%.cxx + $(CROSS)$(CXX) -c $(CXXFLAGS) $(sci_flags) $(CURSES_CFLAGS) $< -o $@ $(textadept_objs): textadept.c $(CROSS)$(CC) -c $(CFLAGS) $(LUA_CFLAGS) $(ta_flags) $< -o $@ $(lua_objs): %.o: lua/src/%.c @@ -197,7 +190,8 @@ luajit/src/libluajit.osx.a: $(MAKE) -C luajit CC="$(CC) -m32" CROSS=$(CROSS) TARGET_SYS=Darwin \ LUAJIT_A=$(notdir $@) || return 0 $(gtdialog_objs): gtdialog/gtdialog.c - $(CROSS)$(CC) -c $(CFLAGS) -std=c99 -pedantic $(gtdialog_flags) $< -o $@ + $(CROSS)$(CC) -c $(CFLAGS) -std=c99 -pedantic $(plat_flag) -DNOHELP \ + -DLIBRARY $(gtdialog_flags) $< -o $@ $(cdk_objs): %.o: cdk/%.c $(CROSS)$(CC) -c $(CFLAGS) -D_GNU_SOURCE -Itermkey -Icdk $(CURSES_CFLAGS) $< \ -o $@ @@ -207,7 +201,6 @@ textadept_rc.o: textadept.rc ; $(CROSS)$(WINDRES) $< $@ # Target-specific variables. -$(lexlpeg_objs): sci_flags += -DLPEG_LEXER -DNO_SCITE -Wno-long-long LexLPeg-curses.o LexLPegjit-curses.o: sci_flags += -DCURSES $(CURSES_CFLAGS) lua_dep_objs = LexLPeg.o LexLPeg-curses.o textadept.o textadept-curses.o \ $(lua_objs) $(lua_lib_objs) lspawn.o lspawn-curses.o @@ -218,9 +211,8 @@ $(lua_dep_objs): LUA_CFLAGS += -Ilua/src $(luajit_dep_objs): LUA_CFLAGS += -Iluajit/src $(textadept_gtk_objs): ta_flags += $(GTK_CFLAGS) $(textadept_curses_objs): \ - ta_flags += -Iscintilla/term -Itermkey -Icdk $(CURSES_CFLAGS) + ta_flags += -Iscintilla/curses -Itermkey -Icdk $(CURSES_CFLAGS) lspawn.o lspawnjit.o: spawn_flags = -DGTK $(GLIB_CFLAGS) -$(gtdialog_objs): gtdialog_flags = $(plat_flag) -DNOHELP -DLIBRARY gtdialog.o: gtdialog_flags += $(GTK_CFLAGS) gtdialog-curses.o: gtdialog_flags += -Icdk $(CURSES_CFLAGS) # Lua 5.3 compatibility with LuaJIT. @@ -229,46 +221,44 @@ lutf8libjit.o: LUA_CFLAGS += -Ilua/src # Executables. -textadept: $(sci_objs) $(sci_lex_objs) $(sci_gtk_objs) scintilla-marshal.o \ - $(regex_objs) LexLPeg.o textadept.o $(lua_objs) $(lua_lib_objs) \ +textadept: $(sci_objs) $(sci_lex_objs) LexLPeg.o $(sci_gtk_objs) \ + scintilla-marshal.o textadept.o $(lua_objs) $(lua_lib_objs) \ lspawn.o gtdialog.o $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(GTK_LIBS) $(LDFLAGS) -textadeptjit: $(sci_objs) $(sci_lex_objs) $(sci_gtk_objs) scintilla-marshal.o \ - $(regex_objs) LexLPegjit.o textadeptjit.o $(luajit_lib_objs) \ +textadeptjit: $(sci_objs) $(sci_lex_objs) LexLPegjit.o $(sci_gtk_objs) \ + scintilla-marshal.o textadeptjit.o $(luajit_lib_objs) \ $(libluajit) lspawnjit.o gtdialog.o $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(GTK_LIBS) $(LDFLAGS) -textadept-curses: $(sci_objs) $(sci_lex_objs) ScintillaTerm.o $(regex_objs) \ - LexLPeg-curses.o textadept-curses.o $(lua_objs) \ +textadept-curses: $(sci_objs) $(sci_lex_objs) LexLPeg-curses.o \ + $(sci_curses_objs) textadept-curses.o $(lua_objs) \ $(lua_lib_objs) lspawn-curses.o gtdialog-curses.o termkey.o \ $(termkey_unix_objs) $(cdk_objs) $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(CURSES_LIBS) $(LDFLAGS) -textadeptjit-curses: $(sci_objs) $(sci_lex_objs) ScintillaTerm.o $(regex_objs) \ - LexLPegjit-curses.o textadeptjit-curses.o \ +textadeptjit-curses: $(sci_objs) $(sci_lex_objs) LexLPegjit-curses.o \ + $(sci_curses_objs) textadeptjit-curses.o \ $(luajit_lib_objs) $(libluajit) lspawnjit-curses.o \ gtdialog-curses.o termkey.o $(termkey_unix_objs) \ $(cdk_objs) $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(CURSES_LIBS) $(LDFLAGS) -textadept.exe: $(sci_objs) $(sci_lex_objs) $(sci_gtk_objs) scintilla-marshal.o \ - $(regex_objs) LexLPeg.o textadept.o textadept_rc.o $(lua_objs) \ +textadept.exe: $(sci_objs) $(sci_lex_objs) LexLPeg.o $(sci_gtk_objs) \ + scintilla-marshal.o textadept.o textadept_rc.o $(lua_objs) \ $(lua_lib_objs) lspawn.o gtdialog.o $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(GTK_LIBS) $(LDFLAGS) -textadeptjit.exe: $(sci_objs) $(sci_lex_objs) $(sci_gtk_objs) \ - scintilla-marshal.o $(regex_objs) LexLPegjit.o \ - textadeptjit.o textadept_rc.o $(luajit_lib_objs) \ - $(libluajit) lspawnjit.o gtdialog.o +textadeptjit.exe: $(sci_objs) $(sci_lex_objs) LexLPegjit.o $(sci_gtk_objs) \ + scintilla-marshal.o textadeptjit.o textadept_rc.o \ + $(luajit_lib_objs) $(libluajit) lspawnjit.o gtdialog.o $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(GTK_LIBS) $(LDFLAGS) -textadept-curses.exe: $(sci_objs) $(sci_lex_objs) ScintillaTerm.o \ - $(regex_objs) LexLPeg-curses.o textadept-curses.o \ - textadept_rc.o $(lua_objs) $(lua_lib_objs) \ - lspawn-curses.o gtdialog-curses.o termkey.o \ - $(termkey_win32_objs) $(cdk_objs) +textadept-curses.exe: $(sci_objs) $(sci_lex_objs) LexLPeg-curses.o \ + $(sci_curses_objs) textadept-curses.o textadept_rc.o \ + $(lua_objs) $(lua_lib_objs) lspawn-curses.o \ + gtdialog-curses.o termkey.o $(termkey_win32_objs) \ + $(cdk_objs) $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(CURSES_LIBS) $(LDFLAGS) -textadeptjit-curses.exe: $(sci_objs) $(sci_lex_objs) ScintillaTerm.o \ - $(regex_objs) LexLPegjit-curses.o \ - textadeptjit-curses.o textadept_rc.o \ - $(luajit_lib_objs) $(libluajit) lspawnjit-curses.o \ - gtdialog-curses.o termkey.o $(termkey_win32_objs) \ - $(cdk_objs) +textadeptjit-curses.exe: $(sci_objs) $(sci_lex_objs) LexLPegjit-curses.o \ + $(sci_curses_objs) textadeptjit-curses.o \ + textadept_rc.o $(luajit_lib_objs) $(libluajit) \ + lspawnjit-curses.o gtdialog-curses.o termkey.o \ + $(termkey_win32_objs) $(cdk_objs) $(CROSS)$(CXX) $(CXXFLAGS) -o ../$@ $^ $(CURSES_LIBS) $(LDFLAGS) # Install/uninstall. @@ -337,8 +327,10 @@ release-all: release release64 win32-release osx-release modules-release $(basedir).i386: ; hg archive $@ -X ".hg*" release: $(basedir).i386 make deps clean doc sign-deps - PKG_CONFIG_PATH=/opt/gtk/lib/pkgconfig make -j4 - make -j4 CURSES_CFLAGS=-I/opt/ncursesw/include/ncursesw \ + PKG_CONFIG_PATH=/opt/gtk/lib/pkgconfig make -j4 \ + CXXFLAGS="$(CXXFLAGS) -static-libstdc++" + make -j4 CXXFLAGS="$(CXXFLAGS) -static-libstdc++" \ + CURSES_CFLAGS=-I/opt/ncursesw/include/ncursesw \ CURSES_LIBS="-L/opt/ncursesw/lib -lncursesw" curses cp -r ../doc ../lexers ../textadept* $< && cp *.asc $