[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Management C Project Files with Emacs?
From: |
Hadron |
Subject: |
Re: Management C Project Files with Emacs? |
Date: |
Thu, 29 Mar 2007 02:20:48 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) |
"Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk> writes:
> Daniel wrote:
>> Hi,
>>
>> If I want to compile a large project like Linux Kernel, I don't know
>> how I can use emacs.
>>
>>
>> 2. Whenever opening a file, it seems that emacs change current
>> directory. So, I cannot simply type "M-x compile RET make". Is there
>> anyway to have emacs to stick on specific directory?
>>
>
> These easiest way to do this is to change the compile line to
>
> cd /path/to/src/ && make -f Makefile ALL
>
>
> HTH,
> Colin S. Miller
This would be really limiting at a later date. Better to open the
makefile or the c file you are interested in so emacs deafults to the
right directory when you then make.
Here is my compile command:
(defun my-compile ()
(lambda ()
(unless (file-exists-p "Makefile")
(set (make-local-variable 'compile-command)
;; emulate make's .c.o implicit pattern rule, but with
;; different defaults for the CC, CPPFLAGS, and CFLAGS
;; variables:
;; $(CC) -c -o $@ $(GTKFLAGS) $(CPPFLAGS) $(CFLAGS) $<
(let ((file (file-name-nondirectory buffer-file-name)))
(format "%s -o %s %s %s %s %s"
(or (getenv "CC") "gcc")
(file-name-sans-extension file)
(or (getenv "GTKFLAGS") "")
(or (getenv "CPPFLAGS")"-DDEBUG=9")
(or (getenv "CFLAGS") "-std=c99 -pedantic -Wall -Werror
-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-Wredundant-decls -Wnested-externs -Winline -g")
file)))))
)
--