unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs and parent directory Makefile
@ 2010-07-09 16:51 Stéphane Maniaci
  2010-07-10  5:13 ` Bob Proulx
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stéphane Maniaci @ 2010-07-09 16:51 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 614 bytes --]

Hi,

My project uses non-recursive Makefile, thus there is only (at the moment) a
single Makefile in my project root tree, that compiles (with Autotools) all
my sources files, located in the src/ directory.

Now the problem is : when I'm editing my code and tries to compile it (M-x
compile), I have to use 'make -k -C ../', which works fine, but Emacs
doesn't know anymore which files contains error. When trying to move to last
error, it outputs this :

Find this error in (default src/ease-about-dialog.vala): ~/build/ease/src/

Does anyone have a workaround for this ?

Thank you,

Stéphane.

[-- Attachment #2: Type: text/html, Size: 656 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs and parent directory Makefile
  2010-07-09 16:51 Emacs and parent directory Makefile Stéphane Maniaci
@ 2010-07-10  5:13 ` Bob Proulx
  2010-07-12  2:24   ` Stéphane Maniaci
  2010-07-10  7:05 ` Eli Zaretskii
  2010-07-10 23:08 ` Jose A. Ortega Ruiz
  2 siblings, 1 reply; 7+ messages in thread
From: Bob Proulx @ 2010-07-10  5:13 UTC (permalink / raw)
  To: Stéphane Maniaci; +Cc: help-gnu-emacs

Stéphane Maniaci wrote:
> Now the problem is : when I'm editing my code and tries to compile it (M-x
> compile), I have to use 'make -k -C ../', which works fine, but Emacs
> doesn't know anymore which files contains error.

It might be easier to simply run the compile from the root of the
source directory.  Then the Makefile will be present and all of the
generated filenames will be correct.  If you don't have any particular
file to edit then just edit the top level directory with dired and
launch the compile from there.

Bob



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs and parent directory Makefile
  2010-07-09 16:51 Emacs and parent directory Makefile Stéphane Maniaci
  2010-07-10  5:13 ` Bob Proulx
@ 2010-07-10  7:05 ` Eli Zaretskii
  2010-07-10 10:58   ` Bastian Beischer
  2010-07-10 23:08 ` Jose A. Ortega Ruiz
  2 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2010-07-10  7:05 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 9 Jul 2010 11:51:19 -0500
> From: =?ISO-8859-1?Q?St=E9phane_Maniaci?= <stephane.maniaci@gmail.com>
> 
> My project uses non-recursive Makefile, thus there is only (at the moment) a
> single Makefile in my project root tree, that compiles (with Autotools) all
> my sources files, located in the src/ directory.
> 
> Now the problem is : when I'm editing my code and tries to compile it (M-x
> compile), I have to use 'make -k -C ../', which works fine, but Emacs
> doesn't know anymore which files contains error. When trying to move to last
> error, it outputs this :
> 
> Find this error in (default src/ease-about-dialog.vala): ~/build/ease/src/
> 
> Does anyone have a workaround for this ?

Switch to the buffer that visits your top-level Makefile, before
typing "M-x compile".



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs and parent directory Makefile
  2010-07-10  7:05 ` Eli Zaretskii
@ 2010-07-10 10:58   ` Bastian Beischer
  0 siblings, 0 replies; 7+ messages in thread
From: Bastian Beischer @ 2010-07-10 10:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

I have this in my .emacs:

(defun my-compile ()
  "This command is meant to step out of the include/src directories on
compilation. Useful for compiling projects without cd-ing to the correct
Makefile path."
  (interactive)
  (let ((last-directory default-directory))
    (if (string-match "\\(\/src\/\\|\/include\/\\)$" default-directory)
        (cd (replace-regexp-in-string "\\(\/src\/\\|\/include\/\\)$" "/"
default-directory)))
    (call-interactively 'compile)
    (cd last-directory)))

(define-key c++-mode-map (kbd "<f9>") 'my-compile)

Far from perfect, but it's a start and works very well for me.

Cheers
Bastian


On Sat, Jul 10, 2010 at 9:05 AM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Fri, 9 Jul 2010 11:51:19 -0500
> > From: =?ISO-8859-1?Q?St=E9phane_Maniaci?= <stephane.maniaci@gmail.com>
> >
> > My project uses non-recursive Makefile, thus there is only (at the
> moment) a
> > single Makefile in my project root tree, that compiles (with Autotools)
> all
> > my sources files, located in the src/ directory.
> >
> > Now the problem is : when I'm editing my code and tries to compile it
> (M-x
> > compile), I have to use 'make -k -C ../', which works fine, but Emacs
> > doesn't know anymore which files contains error. When trying to move to
> last
> > error, it outputs this :
> >
> > Find this error in (default src/ease-about-dialog.vala):
> ~/build/ease/src/
> >
> > Does anyone have a workaround for this ?
>
> Switch to the buffer that visits your top-level Makefile, before
> typing "M-x compile".
>
>


-- 
Bastian Beischer

I. Physikalisches Institut B (RWTH Aachen)
Sommerfeldstr. 14
52074 Aachen
GERMANY

Office: 28-C-203
Phone: +49 241 - 8027205

[-- Attachment #2: Type: text/html, Size: 2457 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs and parent directory Makefile
  2010-07-09 16:51 Emacs and parent directory Makefile Stéphane Maniaci
  2010-07-10  5:13 ` Bob Proulx
  2010-07-10  7:05 ` Eli Zaretskii
@ 2010-07-10 23:08 ` Jose A. Ortega Ruiz
  2 siblings, 0 replies; 7+ messages in thread
From: Jose A. Ortega Ruiz @ 2010-07-10 23:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Jul 09 2010, Stéphane Maniaci wrote:

> Hi,
>
> My project uses non-recursive Makefile, thus there is only (at the
> moment) a single Makefile in my project root tree, that compiles (with
> Autotools) all my sources files, located in the src/ directory.
>
> Now the problem is : when I'm editing my code and tries to compile it
> (M-x compile), I have to use 'make -k -C ../', which works fine, but
> Emacs doesn't know anymore which files contains error. When trying to
> move to last error, it outputs this :

I use the elisp code at

<http://git.hacks-galore.org/gitweb/jao?p=emacs.git;a=blob;f=custom/jao-compile.el;hb=master>

When one calls jao-compile on a source buffer, it looks upwards the
directory tree until it encounters a Makefile, or some other file
indicating that the top dir of the source has been found. Then it puts
itself in the right directory (where, in my case, 'right' means the
corresponding compilation directory, i.e., 'build' because i compile
off-tree).

Perhaps you could adapt the code above (its 'finding the right
directory' logic) to your needs.

HTH,
jao
-- 
Lisp has assisted a number of our most gifted fellow humans in
thinking previously impossible thoughts. —Edsger Dijkstra




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs and parent directory Makefile
  2010-07-10  5:13 ` Bob Proulx
@ 2010-07-12  2:24   ` Stéphane Maniaci
  2010-07-12  9:16     ` Geralt
  0 siblings, 1 reply; 7+ messages in thread
From: Stéphane Maniaci @ 2010-07-12  2:24 UTC (permalink / raw)
  To: Bob Proulx, Stéphane Maniaci, help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

That works perfectly, sorry for not thinking about this before! Thank you
very much!

Stéphane.

On Sat, Jul 10, 2010 at 12:13 AM, Bob Proulx <bob@proulx.com> wrote:

> Stéphane Maniaci wrote:
> > Now the problem is : when I'm editing my code and tries to compile it
> (M-x
> > compile), I have to use 'make -k -C ../', which works fine, but Emacs
> > doesn't know anymore which files contains error.
>
> It might be easier to simply run the compile from the root of the
> source directory.  Then the Makefile will be present and all of the
> generated filenames will be correct.  If you don't have any particular
> file to edit then just edit the top level directory with dired and
> launch the compile from there.
>
> Bob
>

[-- Attachment #2: Type: text/html, Size: 1100 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs and parent directory Makefile
  2010-07-12  2:24   ` Stéphane Maniaci
@ 2010-07-12  9:16     ` Geralt
  0 siblings, 0 replies; 7+ messages in thread
From: Geralt @ 2010-07-12  9:16 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

are you all running make in silent mode? If I use make -C to build my
projects (and I do that for all of them) compilation-mode has no
problem to match the error reports to the originating files, because
make prints messages like "make: Entering directory
`/home/geralt/testproj'" whenever it changes it working directory (and
with -C it's the first thing that make prints).

However if you compile with the -s flag or the .SILENT target in my
makefile I don't get these directory change notification messages and
compilation-mode is no longer able to match error reports to the
originating files.



HTH,

Geralt.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-12  9:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-09 16:51 Emacs and parent directory Makefile Stéphane Maniaci
2010-07-10  5:13 ` Bob Proulx
2010-07-12  2:24   ` Stéphane Maniaci
2010-07-12  9:16     ` Geralt
2010-07-10  7:05 ` Eli Zaretskii
2010-07-10 10:58   ` Bastian Beischer
2010-07-10 23:08 ` Jose A. Ortega Ruiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).