All of lore.kernel.org
 help / color / mirror / Atom feed
* Need help: How to set .RECIPEPREFIX variable to whitespaces
@ 2011-07-13  7:52 amit mehta
  2011-07-13 14:33 ` DG
  0 siblings, 1 reply; 3+ messages in thread
From: amit mehta @ 2011-07-13  7:52 UTC (permalink / raw)
  To: kernelnewbies

Hi,

How to set .RECIPEPREFIX variable to whitespace(say 4 whitespces) , so that
make uses this particular set of characters to identify the recipe for
a particular target.
In my $HOME/.vimrc file, for code indentation purpose, I've put the
following entries
to replace tabs with 4 whitespaces:

<<<snip from my $HOME/.vimrc file>>>
"replace tabs with spaces
set expandtab
set shiftwidth=4
set tabstop=4
<<<snip from my $HOME/.vimrc file>>>


but the above will cause problem in case you write your own makefile
for a kernel module,
because now the tab stroke will be replaced by 4 whitespaces which
'make' will not understand.
Quoting from 'make' manual,
"Please note: you need to put a tab character at the beginning of
every recipe line!"

Seems .RECIPEPREFIX will come for resuce, but as of now I don't know
how to use it
to fix my problem.

Regards,
Amit

-- 
Life is elsewhere. Cross Frontiers. Fly away.

- Salman Rushdie

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

* Need help: How to set .RECIPEPREFIX variable to whitespaces
  2011-07-13  7:52 Need help: How to set .RECIPEPREFIX variable to whitespaces amit mehta
@ 2011-07-13 14:33 ` DG
       [not found]   ` <CAOUxTKO4pxUYxRNvpYO+M7bXNcskerJ=+iq9Cg82GTOhmkG4ew@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: DG @ 2011-07-13 14:33 UTC (permalink / raw)
  To: kernelnewbies

On Wed, Jul 13, 2011 at 1:52 AM, amit mehta <gmate.amit@gmail.com> wrote:
> Hi,
>
> How to set .RECIPEPREFIX variable to whitespace(say 4 whitespces) , so that
> make uses this particular set of characters to identify the recipe for
> a particular target.
> In my $HOME/.vimrc file, for code indentation purpose, I've put the
> following entries
> to replace tabs with 4 whitespaces:
>
> <<<snip from my $HOME/.vimrc file>>>
> "replace tabs with spaces
> set expandtab
> set shiftwidth=4
> set tabstop=4
> <<<snip from my $HOME/.vimrc file>>>
>
>
> but the above will cause problem in case you write your own makefile
> for a kernel module,
> because now the tab stroke will be replaced by 4 whitespaces which
> 'make' will not understand.
> Quoting from 'make' manual,
> "Please note: you need to put a tab character at the beginning of
> every recipe line!"
>
> Seems .RECIPEPREFIX will come for resuce, but as of now I don't know
> how to use it
> to fix my problem.
>
> Regards,
> Amit
>
> --
> Life is elsewhere. Cross Frontiers. Fly away.
>
> - Salman Rushdie
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

I have my vimrc file setup to use different tabs/spacing depending on
the filetype.  8-width tab in C, 4-space indent in Python, etc...

Here's a snippet from my vimrc:

"-------- C -------------------------
function! LANG_C()
    setlocal noexpandtab
    setlocal shiftwidth=8
    setlocal tabstop=8
    setlocal softtabstop=8
    setlocal formatoptions=tcroq
endfunction
autocmd FileType c call LANG_C()

"------- Python ----------------
function! LANG_PYTHON()
    setlocal shiftwidth=4
    setlocal tabstop=4
    setlocal softtabstop=4
    setlocal expandtab
    "--- python indent keywords --------
    setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with
endfunction
autocmd FileType python call LANG_PYTHON()

"------- Makefile --------------
function! LANG_MAKEFILE()
    setlocal noexpandtab     " makefiles only work with tab-indents
    setlocal shiftwidth=8
    setlocal tabstop=8
    setlocal softtabstop=8
endfunction
autocmd FileType make call LANG_MAKEFILE()


There may be other/better ways to do this, but it works well for me.

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

* Need help: How to set .RECIPEPREFIX variable to whitespaces
       [not found]   ` <CAOUxTKO4pxUYxRNvpYO+M7bXNcskerJ=+iq9Cg82GTOhmkG4ew@mail.gmail.com>
@ 2011-07-25 12:29     ` amit mehta
  0 siblings, 0 replies; 3+ messages in thread
From: amit mehta @ 2011-07-25 12:29 UTC (permalink / raw)
  To: kernelnewbies

Asked 'Make' gurus today about this and here's what Paul D. Smith confirmed:

"RECIPEPREFIX must be set to exactly one unique character.  There's no
way to set it to be "four spaces".

Also note that this feature is only available in the latest version of
GNU make and many systems do not include that version yet, so if you use
this feature your makefiles will not be portable to older systems (you
might not care about that). "

- Amit

On Mon, Jul 18, 2011 at 10:40 AM, amit mehta <gmate.amit@gmail.com> wrote:
> Thank you. With your work around I do not need to edit my vimrc file
> everytime i need to write a Makefile.
>
> -Amit
>
> On Wed, Jul 13, 2011 at 8:03 PM, DG <dangets@gmail.com> wrote:
>> On Wed, Jul 13, 2011 at 1:52 AM, amit mehta <gmate.amit@gmail.com> wrote:
>>> Hi,
>>>
>>> How to set .RECIPEPREFIX variable to whitespace(say 4 whitespces) , so that
>>> make uses this particular set of characters to identify the recipe for
>>> a particular target.
>>> In my $HOME/.vimrc file, for code indentation purpose, I've put the
>>> following entries
>>> to replace tabs with 4 whitespaces:
>>>
>>> <<<snip from my $HOME/.vimrc file>>>
>>> "replace tabs with spaces
>>> set expandtab
>>> set shiftwidth=4
>>> set tabstop=4
>>> <<<snip from my $HOME/.vimrc file>>>
>>>
>>>
>>> but the above will cause problem in case you write your own makefile
>>> for a kernel module,
>>> because now the tab stroke will be replaced by 4 whitespaces which
>>> 'make' will not understand.
>>> Quoting from 'make' manual,
>>> "Please note: you need to put a tab character at the beginning of
>>> every recipe line!"
>>>
>>> Seems .RECIPEPREFIX will come for resuce, but as of now I don't know
>>> how to use it
>>> to fix my problem.
>>>
>>> Regards,
>>> Amit
>>>
>>> --
>>> Life is elsewhere. Cross Frontiers. Fly away.
>>>
>>> - Salman Rushdie
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>
>> I have my vimrc file setup to use different tabs/spacing depending on
>> the filetype. ?8-width tab in C, 4-space indent in Python, etc...
>>
>> Here's a snippet from my vimrc:
>>
>> "-------- C -------------------------
>> function! LANG_C()
>> ? ?setlocal noexpandtab
>> ? ?setlocal shiftwidth=8
>> ? ?setlocal tabstop=8
>> ? ?setlocal softtabstop=8
>> ? ?setlocal formatoptions=tcroq
>> endfunction
>> autocmd FileType c call LANG_C()
>>
>> "------- Python ----------------
>> function! LANG_PYTHON()
>> ? ?setlocal shiftwidth=4
>> ? ?setlocal tabstop=4
>> ? ?setlocal softtabstop=4
>> ? ?setlocal expandtab
>> ? ?"--- python indent keywords --------
>> ? ?setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with
>> endfunction
>> autocmd FileType python call LANG_PYTHON()
>>
>> "------- Makefile --------------
>> function! LANG_MAKEFILE()
>> ? ?setlocal noexpandtab ? ? " makefiles only work with tab-indents
>> ? ?setlocal shiftwidth=8
>> ? ?setlocal tabstop=8
>> ? ?setlocal softtabstop=8
>> endfunction
>> autocmd FileType make call LANG_MAKEFILE()
>>
>>
>> There may be other/better ways to do this, but it works well for me.
>>
>
>
>
> --
> Life is elsewhere. Cross Frontiers. Fly away.
>
> - Salman Rushdie
>



-- 
Life is elsewhere. Cross Frontiers. Fly away.

- Salman Rushdie

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

end of thread, other threads:[~2011-07-25 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-13  7:52 Need help: How to set .RECIPEPREFIX variable to whitespaces amit mehta
2011-07-13 14:33 ` DG
     [not found]   ` <CAOUxTKO4pxUYxRNvpYO+M7bXNcskerJ=+iq9Cg82GTOhmkG4ew@mail.gmail.com>
2011-07-25 12:29     ` amit mehta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.