[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs and parent directory Makefile

From: Bastian Beischer
Subject: Re: Emacs and parent directory Makefile
Date: Sat, 10 Jul 2010 12:58:17 +0200

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."
  (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.


On Sat, Jul 10, 2010 at 9:05 AM, Eli Zaretskii <address@hidden> wrote:
> Date: Fri, 9 Jul 2010 11:51:19 -0500
> From: =?ISO-8859-1?Q?St=E9phane_Maniaci?= <address@hidden>
> 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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]