From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bvraghav@iitk.ac.in (B.V. Raghav) Newsgroups: gmane.emacs.help Subject: Re: Compilation in C and ADA Date: Wed, 20 Jul 2016 10:00:14 +0530 Organization: Indian Institute of Technology, Kanpur Message-ID: <87y44xors9.fsf@ram.bvr.dp.lan> References: <87shv5sf78.fsf@ram.bvr.dp.lan> <4781A7A0-F110-47CC-A19D-0C9F1619FD23@comcast.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1468989069 18161 80.91.229.3 (20 Jul 2016 04:31:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Jul 2016 04:31:09 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Francis Belliveau Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 20 06:30:59 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bPj9u-0006Kb-3S for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Jul 2016 06:30:58 +0200 Original-Received: from localhost ([::1]:60498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPj9t-0000GU-7s for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Jul 2016 00:30:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPj9V-0000GD-42 for help-gnu-emacs@gnu.org; Wed, 20 Jul 2016 00:30:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPj9O-0007Xg-Vt for help-gnu-emacs@gnu.org; Wed, 20 Jul 2016 00:30:31 -0400 Original-Received: from mail3.iitk.ac.in ([202.3.77.190]:60066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPj9O-0007Ty-99 for help-gnu-emacs@gnu.org; Wed, 20 Jul 2016 00:30:26 -0400 Original-Received: from smtp.cc.iitk.ac.in (smtp.cc.iitk.ac.in [172.31.1.22]) by mail3.iitk.ac.in (Postfix) with ESMTP id 85A1D10000F1; Wed, 20 Jul 2016 10:00:14 +0530 (IST) Original-Received: from ram.bvr.dp.lan.iitk.ac.in (unknown [172.20.240.119]) (Authenticated sender: bvraghav) by smtp.cc.iitk.ac.in (Postfix) with ESMTPA id 7848F48; Wed, 20 Jul 2016 10:00:14 +0530 (IST) In-Reply-To: <4781A7A0-F110-47CC-A19D-0C9F1619FD23@comcast.net> (Francis Belliveau's message of "Tue, 19 Jul 2016 22:50:12 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 202.3.77.190 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110897 Archived-At: Francis Belliveau 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.=20 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 =A1=B0project-aware=A1=B1 compilation and debu= gging commands: =A1=AEC-c . c=A1=AF Compile the current target (=A1=AEede-compile-target=A1=AF). =A1=AEC-c . C=A1=AF Compile the entire project (=A1=AEede-compile-project=A1=AF). =A1=AEc-c . D=A1=AF Debug the current target (=A1=AEede-debug-target=A1=AF). =A1=AEM-x ede-make-dist=A1=AF Build a distribution file for your project. These commands are also available from the =A1=AEDevelopment=A1=AF men= u. #+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 =A1=AEmake -k=A1=AF, which is usually correct for programs compiled using the =A1=AEmake=A1=AF utility (the =A1= =AE-k=A1=AF flag tells =A1=AEmake=A1=AF to continue compiling as much as possible after an e= rror). *Note Make: (make)Top. If you have done =A1=AEM-x compile=A1=AF before, the command that you specified is automatically stored in the variable =A1=AEcompile-command=A1=AF; this is used as the default the next time you = type =A1=AEM-x compile=A1=AF. A file can also specify a file-local value for =A1=AEcompile-command=A1=AF (*note File Variables::). #+END_QUOTE > Since I do not use the menus either, I do not know what the various choic= es are.=20=20 > However, this sounds to me like a "Human Factors" ambiguity problem.=20=20 > 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))))) --=20 (B.V. Raghav) Ph.D. Student, Design Programme, IIT Kanpur