Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Дмитро on February 21, 2022, 03:08:20 pm

Title: How makefile
Post by: Дмитро on February 21, 2022, 03:08:20 pm
Good afternoon! I never learned how to use makefile, which is present in other projects, or write them myself. I can't figure it out. Here is the project, what settings do I need to make it work?

Do I need to create a project *.cbp if some makefile is already present?


Checking if target is up-to-date: mingw32-make.exe -q -f D:\Makefile-Templates\Makefile-Templates-master\SmallProject\Example\Makefile Debug
Running command: mingw32-make.exe -f D:\Makefile-Templates\Makefile-Templates-master\SmallProject\Example\Makefile Debug
mingw32-make.exe: *** No rule to make target 'Debug'.  Stop.
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 :-\
Title: Re: How makefile
Post by: Дмитро on February 21, 2022, 05:08:12 pm
Well, here's a self-written makefile. That is, I typed it by hand. When I write them myself, I always have the same mistake every time. What it is?

||=== Build: Debug in makefile1 (compiler: GNU GCC Compiler) ===|
Makefile|3|*** missing separator.  Stop.|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|
Title: Re: How makefile
Post by: Miguel Gimenez on February 21, 2022, 05:49:10 pm
Whitespace in makefiles is very strict, you must use tabs and remove most spaces.
Title: Re: How makefile
Post by: Miguel Gimenez on February 21, 2022, 06:03:25 pm
For example, in this target
Code
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
whitespace before -rm is a tab, while the rest are spaces. There is no space between distclean and the colon, in your makefile there are some.
Title: Re: How makefile
Post by: Дмитро on February 21, 2022, 06:55:01 pm
Thanks! For several months, with great irritation, I did not understand what was going on. Finally everything is clear, use the Tab key! It's so simple that I laughed.
Title: Re: How makefile
Post by: Дмитро on February 21, 2022, 07:21:25 pm
But again

Checking if target is up-to-date: mingw32-make.exe -q -f Makefile Debug
Running command: mingw32-make.exe -f Makefile Debug
mingw32-make.exe: *** No rule to make target 'Debug'.  Stop.
Title: Re: How makefile
Post by: jordi on February 21, 2022, 09:45:33 pm
There are two possibilities:
You don't have the target Debug in your makefile
Debug: .....
Or it is not declared in the .PHONY whether Debug is not a file
.PHONY: Debug ....