Results 1 to 4 of 4
Hi,
I'm having a problem with makefile dependencies.
Now what I'm trying to achieve is something similar to the .d files generated when we run gcc on a .c or ...
- 06-10-2009 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 2
makefile include dependency problem
Hi,
I'm having a problem with makefile dependencies.
Now what I'm trying to achieve is something similar to the .d files generated when we run gcc on a .c or .cc file with the -M option enabled.
In the system that I'm running however, assume that these .c and .cc files do not exist. We have these internal files which are of format say .boy.
Now I have a file X.boy in one directory and a file Y.boy in another directory. Now X.boy includes Y.boy. The problem I am facing is that if Y.boy is updated, X.boy needs to detect this and recompile itself even if IT itself is not changed.
To allow this, I have handcoded my own .d files which I call .ds files. These are then included in the makefile just like the .d files generated with the -M option.
Now my problem is that make does not recognize the fact that Y.boy has changed even though the .ds file contains the entire path pointing to the location of Y.boy. Should it not automatically trigger the recompilation of the dependent file when it sees this difference?
Is my understanding wrong in that the makefile would work with these alternative extensions as well and cause some form of re-making or is it that this is confined only to recognizable files like .c, .java, etc. From my understanding, it should work with any kind of file.
Any suggestions?
Thanks a lot.
Cheers
--
SHM
- 06-10-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
We need to see your actual Makefile and an example of these .d files - I assume .d stands for 'dependency'?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 06-10-2009 #3Just Joined!
- Join Date
- Jun 2009
- Posts
- 2
In my case I have called the .d files as .ds files. This is because for the .boy files, a corresponding .cc file also exists. Hence for X.cc, X.h and X.boy exist. .cc includes and dependencies are handled without any problems as normal by make. However, the .boy dependencies are not. Hence I created the .boy.ds files accordingly.
Makefile Snippet:
BOY_TABLE_DEP = $(call objectify,.boy,.boy.ds,${BOY_TABLES})
#objectify works much like patsubst
#BOY_TABLES is a list of .boy files in the system i.e. across all directories
.SECONDARY: $(BOY_TABLE_DEP)
${OD}/%.smdb.h: ${OD}/%.boy.ds $(BOYGEN_BIN)
$(BOYGEN_EXEC) -ZI${APIDOCS_BASE_PATH} ${OD}/$*.boy
#APIDOCS_BASE_PATH shouldn't affect the problem
${OD}/%.boy: %.boy
$(RM) $@ && $(CPS) -f $(<) $@
${OD}/%.boy.ds: ${OD}/%.boy $(BOYGEN_BIN)
$(BOYGEN_EXEC_DEP) ${OD}/$*.boy
#BOYGEN_EXEC_DEP is the command which re-generates the .boy.ds files
#This is code that I have written and which generates the files mentioned below #in the .ds file snipper
include $(BOY_TABLE_DEP)
x.boy.ds file snippet
/x/eng/src/tables/x.smdb.h: \
/x/eng/src/tables/x.boy \
/x/src/tables/can.boy\
/x/src/main_tables/peer.boy\
Other files below this in a similar manner
Please let me know if you need additional information.
Sincerely
--
Shishir
- 06-10-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
