diff options
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 163 |
1 files changed, 67 insertions, 96 deletions
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 $</src tar czf /tmp/$<.tgz $< && rm -rf $< && gpg -ab /tmp/$<.tgz @@ -346,8 +338,9 @@ $(basedir).x86_64: ; hg archive $@ -X ".hg*" release64: $(basedir).x86_64 make clean libluajit64 PKG_CONFIG_PATH=/opt/gtk64/lib/pkgconfig make -j4 CFLAGS="$(CFLAGS) -m64" \ - CXXFLAGS="$(CXXFLAGS) -m64" || return 0 - make -j4 CFLAGS="$(CFLAGS) -m64" CXXFLAGS="$(CXXFLAGS) -m64" \ + CXXFLAGS="$(CXXFLAGS) -m64 -static-libstdc++" || return 0 + make -j4 CFLAGS="$(CFLAGS) -m64" \ + CXXFLAGS="$(CXXFLAGS) -m64 -static-libstdc++" \ CURSES_CFLAGS=-I/opt/ncursesw64/include/ncursesw \ CURSES_LIBS="-L/opt/ncursesw64/lib -lncursesw" curses || return 0 cp -r ../doc ../lexers ../textadept* $< && cp *.asc $</src @@ -391,32 +384,22 @@ osx-app: ../textadept ../textadeptjit ../textadept-curses \ # External dependencies. -base_deps = scintilla tre scintilla/term scintillua lua lualibs luajit \ - gtdialog cdk ../doc/bombay +base_deps = scintilla lua lualibs luajit gtdialog cdk ../doc/bombay deps: $(base_deps) termkey win32-deps: $(base_deps) win32gtk win32curses osx-deps: $(base_deps) gtkosx termkey ifndef NIGHTLY - #scinterm_url = http://foicica.com/scinterm/download/$@ - scinterm_url = http://foicica.com/hg/scinterm/archive/$@ - #scintillua_url = http://foicica.com/scintillua/download/$@ - scintillua_url = http://foicica.com/hg/scintillua/archive/$@ #gtdialog_url = http://foicica.com/gtdialog/download/$@ gtdialog_url = http://foicica.com/hg/gtdialog/archive/$@ #lspawn_url = http://foicica.com/lspawn/download/$@ lspawn_url = http://foicica.com/hg/lspawn/archive/$@ else - scinterm_url = http://foicica.com/hg/scinterm/archive/tip.zip - scintillua_url = http://foicica.com/hg/scintillua/archive/tip.zip gtdialog_url = http://foicica.com/hg/gtdialog/archive/tip.zip lspawn_url = http://foicica.com/hg/lspawn/archive/tip.zip endif -scintilla_tgz = scintilla373.tgz -tre_zip = cdce45e8dd7a3b36954022b4a4d3570e1ac5a4f8.zip -scinterm_zip = 46e218082338.zip -scintillua_zip = 3d489664a2af.zip +scintilla_zip = 3dd2baa4e876.zip lua_tgz = lua-5.3.4.tar.gz lpeg_tgz = lpeg-1.0.0.tar.gz lfs_zip = v_1_6_3.zip @@ -435,28 +418,16 @@ gtkosx_zip = gtkosx-2.24.16.zip bombay_zip = bombay.zip cloc = cloc-1.60.pl -$(scintilla_tgz): ; wget http://prdownloads.sourceforge.net/scintilla/$@ -O $@ -scintilla: $(sort $(wildcard scintilla_backports/*.patch)) scintilla.patch | \ - $(scintilla_tgz) +$(scintilla_zip): ; wget http://foicica.com/hg/scintilla/archive/$@ -O $@ +scintilla: scintilla.patch | $(scintilla_zip) if [ -d $@/.hg ]; then \ - hg --cwd $@ update -C -r rel-3-7-3; \ + hg --cwd $@ update -C LongTerm3; \ else \ if [ -d $@ ]; then rm -r $@; fi; \ - mkdir $@ && tar xzf $| -C $@ && mv $@/*/* $@; \ + mkdir $@ && unzip -d $@ $| && mv $@/*/* $@; \ fi for patch in $^; do echo Applying $$patch; patch -d $@ -N -p1 < $$patch; done -$(tre_zip): ; wget https://github.com/laurikari/tre/archive/$@ -O $@ -tre: tre.patch | $(tre_zip) - if [ -d $@ ]; then rm -r $@; fi - mkdir $@ && unzip -d $@ $| && mv $@/*/* $@ - patch -d $@ -N -p1 < $< -$(scinterm_zip): ; wget $(scinterm_url) -O $@ -scintilla/term: | $(scinterm_zip) ; mkdir $@ && unzip -d $@ $| && mv $@/*/* $@ -scintillua: ../lexers LexLPeg.cxx -$(scintillua_zip): ; wget $(scintillua_url) -O $@ -../lexers: | $(scintillua_zip) - mkdir $@ && unzip -d $@ -j $| "*/lexers/*.lua" "*.txt" "*.cxx" -x "*/themes/*" -LexLPeg.cxx: | ../lexers ; ln -s $|/$@ $@ +../lexers: | scintilla ; ln -s src/$|/lexlua $@ $(lua_tgz): ; wget http://www.lua.org/ftp/$@ $(lpeg_tgz): ; wget http://www.inf.puc-rio.br/~roberto/lpeg/$@ $(lfs_zip): ; wget http://github.com/keplerproject/luafilesystem/archive/$@ @@ -525,18 +496,18 @@ $(bombay_zip): ; wget http://foicica.com/hg/bombay/archive/tip.zip -O $@ mkdir $(notdir $@) && unzip -d $(notdir $@) $| && \ mv $(notdir $@)/*/* $(dir $@) $(cloc): ; wget http://prdownloads.sourceforge.net/cloc/$@ -O $@ -sign-deps: | $(scintilla_tgz) $(scinterm_zip) $(scintillua_zip) $(lua_tgz) \ - $(lpeg_tgz) $(lfs_zip) $(lspawn_zip) $(luajit_tgz) \ - $(libluajit_tgz) $(gtdialog_zip) $(cdk_tgz) $(termkey_tgz) \ - $(win32gtk_zip) $(win32iconv_bin_zip) $(win32iconv_lib_zip) \ - $(win32curses_zip) $(pdcurses_zip) $(gtkosx_zip) +sign-deps: | $(scintilla_tgz) $(lua_tgz) $(lpeg_tgz) $(lfs_zip) $(lspawn_zip) \ + $(luajit_tgz) $(libluajit_tgz) $(gtdialog_zip) $(cdk_tgz) \ + $(termkey_tgz) $(win32gtk_zip) $(win32iconv_bin_zip) \ + $(win32iconv_lib_zip) $(win32curses_zip) $(pdcurses_zip) \ + $(gtkosx_zip) @for file in $|; do gpg -ab $$file; done verify-deps: | $(wildcard $(basename $(wildcard *.asc))) @for file in $|; do echo "$$file"; gpg --verify $$file.asc || return 1; done clean-deps: - rm -rf scintilla tre ../lexers LexLPeg.cxx lua luajit gtdialog cdk termkey \ - win32gtk win32curses gtkosx $(notdir ../doc/bombay) + rm -rf scintilla ../lexers lua luajit gtdialog cdk termkey win32gtk \ + win32curses gtkosx $(notdir ../doc/bombay) # Count lines of code and generate ctags. @@ -551,4 +522,4 @@ ctags: --regex-luax="/^\s*function\s+[^[:space:]\.]*\.?([[:alnum:]_]+)\(/\1/f/" \ --regex-luax="/^\s*local\s+function\s+([[:alnum:]_]+)\(/\1/F/" \ --regex-luax="/^[^[:space:]\.]*\.?([[:alnum:]_]+)\s*=\s*[{]/\1/t/" \ - $(sources) LexLPeg.cxx scintilla gtdialog/gtdialog.c + $(sources) scintilla gtdialog/gtdialog.c |