From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hadron Newsgroups: gmane.emacs.help Subject: Re: Management C Project Files with Emacs? Date: Thu, 29 Mar 2007 02:20:48 +0200 Message-ID: <87648k528v.fsf@gmail.com> References: <1175109304.583467.65140@n59g2000hsh.googlegroups.com> <460af700$0$90268$14726298@news.sunsite.dk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1175128804 14127 80.91.229.12 (29 Mar 2007 00:40:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 29 Mar 2007 00:40:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 29 02:39:57 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HWigG-0003hk-H1 for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Mar 2007 02:39:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HWiim-0000g4-LY for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Mar 2007 19:42:32 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-X-Trace: individual.net V1ToBZvJVHzHiO7x7B+liwhqwIcyrYA1rxa9S0rhp1VvUd+mrD X-Orig-Path: news.individual.net!news X-Face: 2h#||Cd#d%F*NCm59[_6/{1a@jy%; |j>{D~4^gKg(^i%7j0IK?+,/GmW&:CD5fEKb_! User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux) Cancel-Lock: sha1:XY1yyVQOYzL95cselkFKisjxN4s= Original-Xref: shelby.stanford.edu gnu.emacs.help:146654 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42259 Archived-At: "Colin S. Miller" 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))))) ) --