unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help with makefile command line
@ 2008-03-25 13:11 Balaji V. Iyer
  2008-03-26  4:17 ` Mike Mattie
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Balaji V. Iyer @ 2008-03-25 13:11 UTC (permalink / raw)
  To: emacs-devel

Hello Everyone,
    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 thus I would lke the default line to be
 
"gcc -ansi -O4 -Wall <c_source_file>"
 
How do I do this?
 
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))))))
 
 
 
Any help is greatly appreciated.

Oh, one thing..I am using emacs 21.2.1 on cygwin
 
Thanks,
 
-- 
 
Balaji V. Iyer
PhD Student,
Center for Efficient, Scalable and Reliable Computing, Department of
Electrical and Computer Engineering, North Carolina State University.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help with makefile command line
  2008-03-25 13:11 Help with makefile command line Balaji V. Iyer
@ 2008-03-26  4:17 ` Mike Mattie
  2008-03-26  9:05 ` Andreas Schwab
  2008-03-26 13:50 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Mattie @ 2008-03-26  4:17 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]

On Tue, 25 Mar 2008 09:11:58 -0400
"Balaji V. Iyer" <bviyer@ncsu.edu> wrote:

> Hello Everyone,
>     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 thus I would lke the default line to be
>  
> "gcc -ansi -O4 -Wall <c_source_file>"
>  
> How do I do this?
>  
> I tried the following command but it doesn't seem to work (If anyone
> have a better idea please let me know).
>  
> (function
   ^^^ defun
>  (lambda ()
>    (unless (or (file-exists-p "makefile")
                                 ^^
                                 strange?
>                (file-exists-p "Makefile"))
>      (setq compile-command
       ^^^
       why modify a variable each time ? pass as an argument function ?
>            (concat "gcc -Wall -O3 -o"
>                    (file-name-sans-extension (file-name-nondirectory
> buffer-file -name))
             ^^
             broken ?

>                    " "
>                    (file-name-nondirectory buffer-file-name))))))
                      ^^^
                      computed twice, should bind.
>  
>  
>  
> Any help is greatly appreciated.

also concatenating arguments means that some external shell is going to have to split the args again,
usually better (no quoting issues), to simply pass off the arguments to exec without invoking the shell
if you can.

Hope that helps a bit.

> Oh, one thing..I am using emacs 21.2.1 on cygwin
>  
> Thanks,
>  

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help with makefile command line
  2008-03-25 13:11 Help with makefile command line Balaji V. Iyer
  2008-03-26  4:17 ` Mike Mattie
@ 2008-03-26  9:05 ` Andreas Schwab
  2008-03-26 13:50 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2008-03-26  9:05 UTC (permalink / raw)
  To: Balaji V. Iyer; +Cc: emacs-devel

"Balaji V. Iyer" <bviyer@ncsu.edu> writes:

> Hello Everyone,
>     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 thus I would lke the default line to be
>  
> "gcc -ansi -O4 -Wall <c_source_file>"
>  
> How do I do this?

Note that you can run make even without a makefile.  There are builtin
default rules that allows you to type "make foo.o" to create foo.o from
foo.c.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Help with makefile command line
  2008-03-25 13:11 Help with makefile command line Balaji V. Iyer
  2008-03-26  4:17 ` Mike Mattie
  2008-03-26  9:05 ` Andreas Schwab
@ 2008-03-26 13:50 ` Stefan Monnier
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-03-26 13:50 UTC (permalink / raw)
  To: Balaji V. Iyer; +Cc: emacs-devel

> "gcc -ansi -O4 -Wall <c_source_file>"
 
> How do I do this?
 
C-h v compile-command RET


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-26 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-25 13:11 Help with makefile command line Balaji V. Iyer
2008-03-26  4:17 ` Mike Mattie
2008-03-26  9:05 ` Andreas Schwab
2008-03-26 13:50 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).