[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compile-command customisation
From: |
Daniel Wright |
Subject: |
Re: compile-command customisation |
Date: |
Thu, 24 Feb 2005 10:41:49 +0100 |
Kevin Rodgers <ihs_4664@yahoo.com> writes:
> It doesn't work because of the presence of a Makefile, right? But make
> has many built-in default rules, including rules that allow you to build
> an executable from its C or C++ source. In fact, there is a similar
> code snippet in compile-command's doc string, and just last week I was
> considering submitting a bug report that the Makefile test is not useful
> in the mode hook.
>
> Note also that make's default rules are parameterized by macros,
> e.g. CC, CPPFLAGS, CFLAGS, CXXFLAGS, and LDFLAGS, which in turn get
> their default values from your environment. So all you should really
> need is CC=gcc and CFLAGS="-g -W -Wall", plus this:
>
> (add-hook 'c-mode-common-hook
> (lambda ()
> (set (make-local-variable 'compile-command)
> (format "make %s"
> (file-name-sans-extension
> (file-name-nondirectory buffer-file-name))))))
> I think that less is more.
> --
> Kevin Rodgers
Thanks! This is a much better and more elegant solution. I'm still
unfamiliar with make, but you've really helped my understanding.
All the best,
Daniel.
- compile-command customisation, Daniel Wright, 2005/02/23
- Re: compile-command customisation, Stefan Monnier, 2005/02/23
- Re: compile-command customisation, Kevin Rodgers, 2005/02/23
- Re: compile-command customisation, Thien-Thi Nguyen, 2005/02/23
- Re: compile-command customisation, Daniel Wright, 2005/02/24
- Re: compile-command customisation, Daniel Wright, 2005/02/24
- Re: compile-command customisation,
Daniel Wright <=
- Re: compile-command customisation, Stefan Monnier, 2005/02/25