Skip to content

Extracting dependencies in 0.142

Vitorio edited this page Nov 24, 2013 · 1 revision

When you upgrade to a new version of MESS, this is how to regenerate the dependency cross-reference text files in the helpers folder.

Make sure nm is available on your system. It's like objdump, but different. Thanks to luser for all his help.

Given a full version of MESS 0.142u6 building properly as described in Building MESS 0.142, in the makefile, uncomment DEBUG = 1 and SYMBOLS = 1.

Rebuild this full debug build of MESS: make TARGET=mess. This will give you a new mess64d executable, and a new cache of object files in obj/sdl/mess64d.

Change directory into obj/sdl/mess64d and run:

rm mangled-all-resolved.txt; \
rm mangled-all-unresolved.txt; \
rm all-resolved.txt

for a in `find . -name '*.o'`; \
do nm --defined-only $a | cut -d ' ' -f 3- > $a.tmp; \
cat $a.tmp | while read LINE; \
do echo $a $LINE >> mangled-all-resolved.txt; \
done; \
rm $a.tmp; \
done

for a in `find . -name '*.o'`; \
do nm -u $a | cut -c 20- > $a.tmp; \
cat $a.tmp | while read LINE; \
do echo $a $LINE >> mangled-all-unresolved.txt; \
done; \
rm $a.tmp; \
done

for a in `find . -name '*.o'`; \
do nm -C --defined-only $a | cut -d ' ' -f 3- > $a.tmp; \
cat $a.tmp | while read LINE; \
do echo $a $LINE >> all-resolved.txt; \
done; \
rm $a.tmp; \
done

Those will generate three files, with lists of every function and name in the system, and where they are located, e.g.

./lib/formats/trd_dsk.o floppyoptions_trd
./lib/formats/trd_dsk.o _ZL16trd_dsk_identifyP13_floppy_imagePK12FloppyFormatPi

mangled-all-resolved.txt has all the files with the definitions they contain. mangled-all-unresolved.txt has all the files with the definitions they're missing, which must be found elsewhere. all-resolved.txt has human-readable function names in case something goes wrong: just grep for whatever your errors say there's an "undefined reference to" to find the .o file that's missing. (This shouldn't happen.)

Replace the files in helpers with these new versions. You should be able to use them as-is with fulldeps.sh, to create a list of all the DRVLIBS dependencies for any system makefile.