From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: help with makefile command line Date: Wed, 26 Mar 2008 06:19:17 +0200 Message-ID: References: <000001c88e79$86451340$33160e98@ece.ncsu.edu> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1206505186 26299 80.91.229.12 (26 Mar 2008 04:19:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Mar 2008 04:19:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 26 05:20:16 2008 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 1JeN7W-000246-7t for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Mar 2008 05:20:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeN6u-0004ib-PG for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Mar 2008 00:19:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JeN6g-0004iB-5h for help-gnu-emacs@gnu.org; Wed, 26 Mar 2008 00:19:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JeN6e-0004h4-Mw for help-gnu-emacs@gnu.org; Wed, 26 Mar 2008 00:19:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeN6e-0004h1-ID for help-gnu-emacs@gnu.org; Wed, 26 Mar 2008 00:19:20 -0400 Original-Received: from romy.inter.net.il ([213.8.233.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JeN6e-00014I-7F for help-gnu-emacs@gnu.org; Wed, 26 Mar 2008 00:19:20 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-84-228-236-188.inter.net.il [84.228.236.188]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id KPJ09634 (AUTH halo1); Wed, 26 Mar 2008 06:18:59 +0200 (IST) In-reply-to: <000001c88e79$86451340$33160e98@ece.ncsu.edu> (bviyer@ncsu.edu) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) 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:52691 Archived-At: > From: "Balaji V. Iyer" > Date: Tue, 25 Mar 2008 09:09:56 -0400 > > I use the compile option extenstively in emacs. When I type "M-x > compile" the default line is "make -k" Many times I do not have a make > file You don't need a Makefile to perform simple tasks, because Make knows a lot of built in rules out of the box. For example, to compile a .c source file foo.c into a program foo, all you need is say "make -k foo", and Make will do it even without a Makefile. > thus I would lke the default line to be > > "gcc -ansi -O4 -Wall " > > How do I do this? Customize the variable compile-command. > I tried the following command but it doesn't seem to work (If anyone > have a better idea please let me know). > > (function > (lambda () > (unless (or (file-exists-p "makefile") > (file-exists-p "Makefile")) > (setq compile-command > (concat "gcc -Wall -O3 -o" > (file-name-sans-extension (file-name-nondirectory > buffer-file -name)) > " " > (file-name-nondirectory buffer-file-name)))))) Where did you put this and how did you use it?