Quote:
Originally Posted by pan64
the solution could be the target dependent macro, but it will not simplify:
Code:
$(BIN)/targetfile.o := DEP = $(target_H)
...
$(BIN)/%.o: %.cpp $(DEP) $(BIN)
g++ -o $@ $(FLAGS) -c $<
and do not foget to add the dependency for $(BIN)
|
I'm confused by your code (RED).
why is there a variable called "bin/targetfile.o" being assigned to it's header definition (target_h)?
Then bin/targetfile.o, DEP, and target_h would all hold the same information.
But not only that, it still doesn't solve the issue of the % not resolving inside of the variable call in the dependecy list $(%_H).
With the code in red, being that DEP is defined to only one of the header variables, you would be saying that all the objects depend on that one header. Each object (Enemy.o, Player.o, Path.o) has it's own header variable (Enemy_H, Player_H, Path_H) and I'm just trying to figure a way for % which holds the current object's stem (Enemy, Player, Path) to turn into it's corrisponding header variable (Enemy_H,...).
Unless you're suggesting that I define DEP multiple times for every Object... but I might as well just leave the code how it used to be with each object's name typed explicitly (Enemy.o: Enemy.cpp $(Enemey_H)).
If I'm not understanding what you said correctly, please reiterate.