[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compilation in C and ADA
From: |
B.V. Raghav |
Subject: |
Re: Compilation in C and ADA |
Date: |
Wed, 20 Jul 2016 10:00:14 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Francis Belliveau <f.belliveau@comcast.net> writes:
[...]
> I am no emacs expert, but from the evidence it seems clear to me that
> the emacs "compile" default is to make an entire application, not just
> compile a single file or the current buffer.
>
`C-h f compile' details out how I can build over the compile command to
suit my needs.
For a higher order automation, here is an excerpt from `Info > ede >
Building and Debugging' (C-h i m ede RET m build TAB RET)
#+BEGIN_QUOTE
EDE provides the following “project-aware” compilation and debugging
commands:
‘C-c . c’
Compile the current target (‘ede-compile-target’).
‘C-c . C’
Compile the entire project (‘ede-compile-project’).
‘c-c . D’
Debug the current target (‘ede-debug-target’).
‘M-x ede-make-dist’
Build a distribution file for your project.
These commands are also available from the ‘Development’ menu.
#+END_QUOTE
> It has been a long time since I used Ada, so I cannot speak to how Ada
> applications are built these days, but I expect "make" can be used to
> do it.
>
Eitherways, it seems to be `configurable' into my project system.
https://gcc.gnu.org/onlinedocs/gnat_ugn/Running-a-Simple-Ada-Program.html
> However, both C and C++ developers commonly use make, or one of its
> many flavors, to describe the dependancies between application sources
> and how to build the applications. Normally when you compile a C file
> you get an object file, not an executable program. All the objects
> for the project, just the one in this case, then need to be linked
> with the appropriate set of libraries in order to create the program
> executable. Again this is just a simple system library in the case of
> a "hello" application.
>
Emacs does provide an interface to this shell command, with compile.
(Info > Emacs > Building > Compilation) details it out. Here is an
excerpt.
#+BEGIN_QUOTE
The default compilation command is ‘make -k’, which is usually
correct for programs compiled using the ‘make’ utility (the ‘-k’ flag
tells ‘make’ to continue compiling as much as possible after an error).
*Note Make: (make)Top. If you have done ‘M-x compile’ before, the
command that you specified is automatically stored in the variable
‘compile-command’; this is used as the default the next time you type
‘M-x compile’. A file can also specify a file-local value for
‘compile-command’ (*note File Variables::).
#+END_QUOTE
> Since I do not use the menus either, I do not know what the various choices
> are.
> However, this sounds to me like a "Human Factors" ambiguity problem.
>
I do not understand the "Human Factors" ambiguity problem. So I refrain
speaking here
> Either the default for "compile" should be to execute "gcc" rather
> than "make", or the menu command "compile" should be changed to
> something like "make app".
>
You may try ply around with this:
(global-set-key (kbd "C-c C-c C-c")
(lambda ()
(compile (format "gcc -c -o %s %s"
(replace-regexp-in-string "\\.[^\\.]*$"
".o"
(buffer-file-name))
(buffer-file-name)))))
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur
Re: Compilation in C and ADA, Kendall Shaw, 2016/07/23