2010-03-12 07:48:17 makefile
Filip Vanalme (BELGIUM)
Message: 87136
My knowledge about makefiles is rather limited. I would like to do something like this in the Kernel's main makefile to make a 'special' version of the Kernel (e.g. a stripped variant) :
test:
@echo "**** building special Kernel ****"
# Saving current config files and replace them by the special one's
cp linux-2.6.x/.config linux-2.6.x/.savedconfig
cp linux-2.6.x/.specialconfig linux-2.6.x/.config
cp config/.config config/.savedconfig
cp config/.specialconfig config/.config
export TESTING
$(MAKE) TESTING=1
# restore the original configs
cp config/.savedconfig config/.config
cp linux-2.6.x/.savedconfig linux-2.6.x/.config
I looks like this is working when I do make test (I see the copying of files, then the starting of the 'normal' make ...), but I finally get compilation errors.
When I do the first copy part (i.e. the first 4 cp's) manually from the command prompt and let the makefile start with the 'export' line, It works well (no compilation errors).
test:
@echo "**** building special Kernel ****"
# .config files manually replace from command prompt before calling make
export TESTING
$(MAKE) TESTING=1
# restore the original configs
cp config/.savedconfig config/.config
cp linux-2.6.x/.savedconfig linux-2.6.x/.config
Can I replace any .config files within the makefile or is this already too late (i.e. the make has already interpreted the .config files before it reaches the replace part) ?
There are probably better ways to do this kind of things, no ?
Filip
TranslateQuoteReplyEditDelete
2010-03-12 08:17:21 Re: makefile
Mike Frysinger (UNITED STATES)
Message: 87137
since you use $(MAKE), it should a re-processing of the Makefile, but it's probably using the existing environment as a base instead of a fresh one
you could try creating a GNUmakefile that looks like:
all %:
$(MAKE) -f Makefile $@
test:
... your current test target ...
QuoteReplyEditDelete
2010-03-12 09:35:43 Re: makefile
Filip Vanalme (BELGIUM)
Message: 87138
Thanks Mike !
It's working now. I created a 'special' makefile that does the copying and finally calls the 'standard' makefile with a parameter.