Author Topic: How makefile  (Read 1570 times)

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 107
How makefile
« 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))
 :-\
« Last Edit: February 21, 2022, 04:56:08 pm by Дмитро »

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 107
Re: How makefile
« Reply #1 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)) ===|

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1209
Re: How makefile
« Reply #2 on: February 21, 2022, 05:49:10 pm »
Whitespace in makefiles is very strict, you must use tabs and remove most spaces.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1209
Re: How makefile
« Reply #3 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.

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 107
Re: How makefile
« Reply #4 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.
« Last Edit: February 21, 2022, 07:18:23 pm by Дмитро »

Offline Дмитро

  • Multiple posting newcomer
  • *
  • Posts: 107
Re: How makefile
« Reply #5 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.
« Last Edit: February 21, 2022, 07:25:23 pm by Дмитро »

Offline jordi

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: How makefile
« Reply #6 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 ....