User forums > Using Code::Blocks
Compile single file with custum makefile
(1/1)
Greg84:
Hello,
I'm using C::B 8.02. I wonder if it is possible to change the value of the $file variable in the "Make" Commands tab (Project Build Options). In fact, this variable represents the full name of the file to build depending on the target : for example "obj/Debug/foo.o" if the target is Debug. So the make command executed is "make -f Makefile obj/Debug/foo.o". I use custum makefile and I'd like to compile single file with "make -f Makefile foo.o". A solution would be inserting the shell command "basename" in order to execute this
:
--- Code: ---make -f Makefile $(basename obj/Debug/foo.o)
--- End code ---
If I write this in "Make commands tab in C::B :
--- Code: ---$make -f $makefile $(basename $file)
--- End code ---
It mistakes the shell syntax $() for its own variable syntax and executes make as :
--- Code: ---make -f Makefile $(basename
--- End code ---
which of course results in errors "no target to build...."
My makefile has "Debug" and "Release" target so I can't use blank target. What can I do ?
Thanks ^^
Navigation
[0] Message Index
Go to full version