Using GCC to generate makefile dependencies.

  • Thread starter Thread starter TylerH
  • Start date Start date
  • Tags Tags
    Gcc
AI Thread Summary
To generate dependencies for makefiles using GCC, the -M option is commonly employed, but users often encounter issues with the syntax, particularly with the $< variable not being recognized correctly. This results in GCC failing to generate the necessary dependencies. A suggested solution involves using Autotools, which provides a robust framework for managing dependencies, although it may require significant setup depending on the complexity of the project. For simpler projects with fewer libraries, hard-coding dependencies might be a more practical approach. Additionally, the discussion highlights the importance of considering the operating system and specific libraries in use when determining the best method for dependency management.
TylerH
Messages
729
Reaction score
0
How do I use GCC to generate dependencies for makefiles? I tried using the -M option, like below, but I don't know how to insert the name of the .cpp into the shell command that calls GCC with the -M option.

Code:
%.cpp : $(shell gcc -M $<)

Instead of the desired effect, $< is replaced by nothing, causing GCC to generate an error and my attempt to generate dependencies to fail.
 
Technology news on Phys.org
I had the same problem that you do now. For that I did some googling around and found a set of tools called Autotools. Here is a pretty good explanation of what you might want to do:

http://www.freesoftwaremagazine.com/books/autotools_a_guide_to_autoconf_automake_libtool

This requires some effort to setup correctly (depends on the complexity of your compilation environment), so if you have only a small number of libraries, hard-coding would be a better option.

What operating system are you using? What libraries are you trying to use?
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top