mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-14 16:02:12 +00:00

Remove a few more redundant `:group` args. Make use of lexical scoping to replace `(lambda...) with proper closures. * lisp/cedet/ede/custom.el (ede-project-sort-targets-list): Use `dotimes` and replace `(lambda..) with closures. * lisp/cedet/ede/proj-comp.el (proj-comp-insert-variable-once): * lisp/cedet/ede/pmake.el (ede-pmake-insert-variable-once): Remove unused var `addcr`. * lisp/cedet/semantic/complete.el: Use lexical-binding. (semantic-displayer-show-request): Remove unused var `typing-count`. Use `equal` instead of `stringp+string=`. * lisp/cedet/semantic/db-ebrowse.el: Use lexical-binding. (semanticdb-create-ebrowse-database): Remove unused vars `mma` and `regexp`. (semanticdb-ebrowse-strip-trees): Remove unused var `class` and `filename`. (semanticdb-ebrowse-add-globals-to-table): Remove unused var `fname`. * lisp/cedet/semantic/db-find.el: Use lexical-binding. (semanticdb-find-adebug-insert-scanned-tag-cons): Remove always-nil var `tip`. * lisp/cedet/semantic/db-global.el: Use lexical-binding. (semanticdb-enable-gnu-global-databases): Access local var `semantic--ih` by sticking its value in the code passed to `eval` rather than by dynamic scoping. * lisp/cedet/semantic/db-typecache.el: Use lexical-binding. (semanticdb-db-typecache-dump): Remove unused var `junk`. * lisp/cedet/semantic/debug.el: Use lexical-binding. * lisp/cedet/semantic/dep.el: Use lexical-binding. (semantic-add-system-include): Avoid `add-to-list` on a local variable. Access local var `value` by sticking its value in the code passed to `eval` rather than by dynamic scoping. (semantic-remove-system-include): Don't use `delete` on a list received from elsewhere. Access local var `value` by sticking its value in the code passed to `eval` rather than by dynamic scoping. (semantic-reset-system-include): Simplify a bit. * lisp/cedet/semantic/ede-grammar.el: Use lexical-binding. (project-compile-target): Remove unused vars `csrc` and `cb`. Use `cl-incf`. Remove apparently unneeded `with-no-warnings`. * lisp/cedet/semantic/edit.el: Use lexical-binding. (semantic-edits-change-over-tags): Remove unused var `inner-start`. (semantic-edits-incremental-parser-1): Silence warnings about intentionally unused var `last-cond`. * lisp/cedet/semantic/fw.el: Use lexical-binding. (recentf-exclude, semantic-init-hook, ede-auto-add-method) (flymake-start-syntax-check-on-find-file, auto-insert): Declare vars. * lisp/cedet/semantic/ia-sb.el: Use lexical-binding. (semantic-ia-sb-key-map): Move initialization into declaration. (semantic-ia-sb-more-buttons): Remove unused var `idx`. (semantic-ia-sb-line-path): Simplify `if` -> `or`. * lisp/cedet/semantic/idle.el (semantic-idle-breadcrumbs--tag-function): Make it a function returning a closure. * lisp/cedet/semantic/senator.el: Use lexical-binding. (senator-search-set-tag-class-filter): Replace `(lambda..) with a closure. * lisp/cedet/semantic/sort.el: Use lexical-binding. (semanticdb-search-system-databases): Declare var. (semantic-tag-external-member-children-default): Replace `(lambda..) with a closure. * lisp/cedet/semantic/tag-ls.el: Use lexical-binding. (semantic-tag-protection-default, semantic-tag-abstract-p-default): Simplify with `member`. * lisp/cedet/semantic/util.el: Use lexical-binding. (semantic-something-to-tag-table): Declare function `semanticdb-abstract-table--eieio-childp` called via `cl-typep`. * lisp/cedet/semantic/bovine/scm.el (semantic-default-scheme-setup): Remove duplicate setting of `imenu-create-index-function`. * lisp/cedet/semantic/decorate/mode.el (semantic-decoration-build-style-menu): Replace `(lambda..) with a closure. * lisp/cedet/srecode/cpp.el (srecode-semantic-apply-tag-to-dict): Remove always-t variable `member`. * lisp/cedet/srecode/mode.el (srecode-minor-mode-templates-menu): Replace `(lambda..) with a closure. Use `push`. * lisp/cedet/semantic/chart.el: Use lexical-binding. * lisp/cedet/semantic/db-debug.el: Use lexical-binding. * lisp/cedet/semantic/db-el.el: Use lexical-binding. * lisp/cedet/semantic/db-file.el: Use lexical-binding. * lisp/cedet/semantic/db-javascript.el: Use lexical-binding. * lisp/cedet/semantic/db-mode.el: Use lexical-binding. * lisp/cedet/semantic/db-ref.el: Use lexical-binding. * lisp/cedet/semantic/decorate.el: Use lexical-binding. * lisp/cedet/semantic/doc.el: Use lexical-binding. * lisp/cedet/semantic/find.el: Use lexical-binding. * lisp/cedet/semantic/format.el: Use lexical-binding. * lisp/cedet/semantic/html.el: Use lexical-binding. * lisp/cedet/semantic/ia.el: Use lexical-binding. * lisp/cedet/semantic/imenu.el: Use lexical-binding. * lisp/cedet/semantic/java.el: Use lexical-binding. * lisp/cedet/semantic/mru-bookmark.el: Use lexical-binding. * lisp/cedet/semantic/symref.el: Use lexical-binding. * lisp/cedet/semantic/tag-file.el: Use lexical-binding. * lisp/cedet/semantic/tag-write.el: Use lexical-binding. * lisp/cedet/semantic/texi.el: Use lexical-binding. * lisp/cedet/semantic/util-modes.el: Use lexical-binding.
208 lines
6.9 KiB
EmacsLisp
208 lines
6.9 KiB
EmacsLisp
;;; ede-proj-shared.el --- EDE Generic Project shared library support -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
|
|
|
;; Author: Eric M. Ludlam <zappo@gnu.org>
|
|
;; Keywords: project, make
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
;;
|
|
;; Handle shared object libraries in and EDE Project file.
|
|
;; Tries to deal with libtool and non-libtool situations.
|
|
|
|
(require 'ede/pmake)
|
|
(require 'ede/proj-obj)
|
|
(require 'ede/proj-prog)
|
|
|
|
;;; THIS NEEDS WORK. SEE ede-proj-obj.
|
|
|
|
;;; Code:
|
|
(defclass ede-proj-target-makefile-shared-object
|
|
(ede-proj-target-makefile-program)
|
|
((availablecompilers :initform '(ede-gcc-libtool-shared-compiler
|
|
;;ede-gcc-shared-compiler
|
|
ede-g++-libtool-shared-compiler
|
|
;;ede-g++-shared-compiler
|
|
))
|
|
(availablelinkers :initform '(ede-cc-linker-libtool
|
|
ede-g++-linker-libtool
|
|
;; Add more linker thingies here.
|
|
))
|
|
(ldflags :custom (repeat (string :tag "Libtool flag"))
|
|
:documentation
|
|
"Additional flags to add when linking this shared library.
|
|
Use ldlibs to add addition libraries.")
|
|
)
|
|
"This target generates a shared library.")
|
|
|
|
(defvar ede-gcc-shared-compiler
|
|
(clone ede-gcc-compiler
|
|
"ede-c-shared-compiler"
|
|
:name "gcc -shared"
|
|
:variables '(("CC_SHARED" . "gcc")
|
|
("C_SHARED_COMPILE" .
|
|
"$(CC_SHARED) -shared $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)"))
|
|
; :linkvariables '(("C_SHARED_LINK" .
|
|
; "$(CC_SHARED) -shared $(CFLAGS) $(LDFLAGS) -L. -o $@ $^")
|
|
; )
|
|
; :commands '("$(C_SHARED_LINK) %s")
|
|
;; @TODO - additive modification of autoconf.
|
|
:autoconf '("AC_PROG_LIBTOOL")
|
|
)
|
|
"Compiler for C sourcecode.")
|
|
|
|
(defvar ede-gcc-libtool-shared-compiler
|
|
(clone ede-gcc-shared-compiler
|
|
"ede-c-shared-compiler-libtool"
|
|
:name "libtool"
|
|
:variables '(("LIBTOOL" . "libtool")
|
|
("LTCOMPILE" . "$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)")
|
|
("LTLINK" . "$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -L. -o $@")
|
|
)
|
|
:rules (list (ede-makefile-rule
|
|
:target "%.o"
|
|
:dependencies "%.c"
|
|
:rules '("@echo '$(LTCOMPILE) -o $@ $<'; \\"
|
|
"$(LTCOMPILE) -o $@ $<"
|
|
)
|
|
))
|
|
:autoconf '("AC_PROG_LIBTOOL")
|
|
)
|
|
"Compiler for C sourcecode.")
|
|
|
|
(defvar ede-cc-linker-libtool
|
|
(clone ede-cc-linker
|
|
"ede-cc-linker-libtool"
|
|
:name "cc shared"
|
|
;; Only use this linker when c++ exists.
|
|
:sourcetype '(ede-source-c++)
|
|
:variables '(
|
|
("LIBTOOL" . "libtool")
|
|
("LTLINK" . "$(LIBTOOL) --tag=CPP --mode=link $(CPP) $(CFLAGS) $(LDFLAGS) -L. -o $@")
|
|
)
|
|
:commands '("$(LTLINK) -o $@ $^")
|
|
:autoconf '("AC_PROG_LIBTOOL")
|
|
:objectextention ".la")
|
|
"Linker needed for c++ programs.")
|
|
|
|
(defvar ede-g++-shared-compiler
|
|
(clone ede-g++-compiler
|
|
"ede-c++-shared-compiler"
|
|
:name "gcc -shared"
|
|
:variables '(("CXX_SHARED" . "g++")
|
|
("CXX_SHARED_COMPILE" .
|
|
"$(CXX_SHARED) -shared $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)"))
|
|
;; @TODO - additive modification of autoconf.
|
|
:autoconf '("AC_PROG_LIBTOOL")
|
|
)
|
|
"Compiler for C sourcecode.")
|
|
|
|
(defvar ede-g++-libtool-shared-compiler
|
|
(clone ede-g++-shared-compiler
|
|
"ede-c++-shared-compiler-libtool"
|
|
:name "libtool"
|
|
:variables '(("CXX" "g++")
|
|
("LIBTOOL" . "libtool")
|
|
("LTCOMPILE" . "$(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)")
|
|
)
|
|
:rules (list (ede-makefile-rule
|
|
:target "%.o"
|
|
:dependencies "%.cpp"
|
|
:rules '("@echo '$(LTCOMPILE) -o $@ $<'; \\"
|
|
"$(LTCOMPILE) -o $@ $<"
|
|
)
|
|
))
|
|
:autoconf '("AC_PROG_LIBTOOL")
|
|
)
|
|
"Compiler for C sourcecode.")
|
|
|
|
(defvar ede-g++-linker-libtool
|
|
(clone ede-g++-linker
|
|
"ede-g++-linker-libtool"
|
|
:name "g++"
|
|
;; Only use this linker when c++ exists.
|
|
:sourcetype '(ede-source-c++)
|
|
:variables '(
|
|
("LIBTOOL" . "libtool")
|
|
("LTLINK" . "$(LIBTOOL) --tag=CXX --mode=link $(CXX) $(CFLAGS) $(LDFLAGS) -L. -o $@")
|
|
)
|
|
:commands '("$(LTLINK) -o $@ $^")
|
|
:autoconf '("AC_PROG_LIBTOOL")
|
|
:objectextention ".la")
|
|
"Linker needed for c++ programs.")
|
|
|
|
;;; @TODO - C++ versions of the above.
|
|
|
|
(when nil
|
|
|
|
|
|
(insert;; These C to O rules create dependencies
|
|
"%.o: %.c\n"
|
|
"\t@echo '$(COMPILE) -c $<'; \\\n"
|
|
"\t$(COMPILE)"
|
|
(if (oref this automatic-dependencies)
|
|
" -Wp,-MD,.deps/$(*F).P"
|
|
"")
|
|
" -c $<\n\n")
|
|
(if have-libtool
|
|
(insert;; These C to shared o rules create pic code.
|
|
"%.lo: %.c\n"
|
|
"\t@echo '$(LTCOMPILE) -c $<'; \\\n"
|
|
"\t$(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<\n"
|
|
"\t@-sed -e 's/^\\([^:]*\\)\\.o:/\\1.lo \\1.o:/' \\\n"
|
|
"\t < .deps/$(*F).p > .deps/$(*F).P\n"
|
|
"\t@-rm -f .deps/$(*F).p\n\n"))
|
|
)
|
|
|
|
(cl-defmethod ede-proj-configure-add-missing
|
|
((_this ede-proj-target-makefile-shared-object))
|
|
"Query if any files needed by THIS provided by automake are missing.
|
|
Results in --add-missing being passed to automake."
|
|
(not (and (ede-expand-filename (ede-toplevel) "ltconfig")
|
|
(ede-expand-filename (ede-toplevel) "ltmain.sh"))))
|
|
|
|
(cl-defmethod ede-proj-makefile-insert-automake-pre-variables
|
|
((this ede-proj-target-makefile-shared-object))
|
|
"Insert bin_PROGRAMS variables needed by target THIS.
|
|
We aren't actually inserting SOURCE details, but this is used by the
|
|
Makefile.am generator, so use it to add this important bin program."
|
|
(ede-pmake-insert-variable-shared "lib_LTLIBRARIES"
|
|
(insert (concat "lib" (ede-name this) ".la"))))
|
|
|
|
(cl-defmethod ede-proj-makefile-insert-automake-post-variables
|
|
((_this ede-proj-target-makefile-shared-object))
|
|
"Insert bin_PROGRAMS variables needed by target THIS.
|
|
We need to override -program which has an LDADD element."
|
|
nil)
|
|
|
|
(cl-defmethod ede-proj-makefile-target-name ((this ede-proj-target-makefile-shared-object))
|
|
"Return the name of the main target for THIS target."
|
|
;; We need some platform gunk to make the .so change to .sl, or .a,
|
|
;; depending on the platform we are going to compile against.
|
|
(concat "lib" (ede-name this) ".la"))
|
|
|
|
(cl-defmethod ede-proj-makefile-sourcevar ((this ede-proj-target-makefile-shared-object))
|
|
"Return the variable name for THIS's sources."
|
|
(if (eq (oref (ede-target-parent this) makefile-type) 'Makefile.am)
|
|
(concat "lib" (oref this name) "_la_SOURCES")
|
|
(cl-call-next-method)))
|
|
|
|
|
|
(provide 'ede/proj-shared)
|
|
|
|
;;; ede/proj-shared.el ends here
|