help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: help with makefile command line


From: Mike Mattie
Subject: Re: help with makefile command line
Date: Tue, 25 Mar 2008 21:25:53 -0700

On Wed, 26 Mar 2008 06:19:17 +0200
Eli Zaretskii <eliz@gnu.org> wrote:

> > From: "Balaji V. Iyer" <bviyer@ncsu.edu>
> > 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 <c_source_file>"
> >  
> > 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?
> 
> 

btw , you don't have to setq. You can bind a value to compile-command with let 
as well, calling compile within
the let form.

Attachment: signature.asc
Description: PGP signature


reply via email to

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