Return-Path: Received: from pfepb.post.tele.dk ([195.41.46.236]:36664 "EHLO pfepb.post.tele.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbZJIE3I (ORCPT ); Fri, 9 Oct 2009 00:29:08 -0400 Date: Fri, 9 Oct 2009 06:28:29 +0200 From: Sam Ravnborg Subject: Re: kbuild generating prefix-foo.o from foo.c Message-ID: <20091009042829.GA32078@merkur.ravnborg.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: kartikeyan sadasivuni Cc: linux-kbuild@vger.kernel.org On Fri, Oct 09, 2009 at 08:45:09AM +0530, kartikeyan sadasivuni wrote: > hi, > > I have a kernel module Makefile requirement as follows (unavoidable) > prefix-foo.o should be generated by foo.c using Kbuild > Right now I am doing the following > ===== > $(obj-m:%.o=%)-objs += $(MORE_OBJS:%=prefix-%) > $(obj)/prefix-%.o : $(src)/%.c               # prefix-foo.o from foo.c >       $(CC) $(c_flags) -c -o $@ $<       #line3 > ===== > Is there is a better kernel builtin way to write line-3 > without module Makefile having quiet_cmd_* and cmd_* stuff, > some thing like > $(obj)/prefix-%.o : $(src)/%.c >      $(call cmd,prefix-$@)      #without quiet_cmd_*,cmd_* in module Makefile > > kartikeyan Is it an option for you to create a copy of said file? Something like this (untested). $(obj)/prefix-foo.c: $(src)/foo.c cat $< > $@ || (rm $@ && flase) obj-m += prefix.o Notes: Use cat rather than copy to avoid potential umask related issues. (rm $@ && false) delte the file if something went wrong and we only piped half the file. Sam