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: stan
Subject: Re: help with makefile command line
Date: Thu, 27 Mar 2008 21:51:56 -0500
User-agent: slrn/0.9.8.0 (Linux)

Richard G Riley wrote:
> "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?
>>  
>> 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))))))
<snip>

Seems like it might be easier to write a makefile :) 

Do you really mean that you plan to not use makefiles? If not you might
just want to change the command on a session basis. You do know that you
can backspace over the make -k and simply type g++ -Wall -g file.cpp and
that will become the new command until you close emacs. I tend to do
that when working on small throwaway programs. 

Another idea, if you don't like what Eli suggested earlier is to come up
with a makefile template and use auto insert. I have a template that I
only need to basically change the list of files in and it save a lot of
time during the compile, run. scream. debug, edit cycle.

Finally, you can edit the compile command for all time but it seems like
a bad idea.


reply via email to

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