Hi, All!
I need generate .def file for my library. I use second commands for it:
echo EXPORTS > mylib.def
nm mylib_1.obj | grep " T " | grep " _mylib_" | sed "s/^.* _//"
>>mylib.def
...
nm mylib_N.obj | grep " T " | grep " _mylib_" | sed "s/^.*
_//" >>mylib.def
First, I create make target in my Jamfile, and it works (not always):
---------------------------------------------------------------------
make $(mylib-source-locate)/mylib.def
: # sources
$(MYLIB_OBJ)
: # generator
@mylib-def
;
rule mylib-def ( target : sources * : properties * )
{
NM on $(target) = nm ;
}
actions mylib-def
{
echo EXPORTS > "$(<)"
$(NM) "$(>)" | grep " T " | grep " _mylib_" | sed "s/^.* _//"
>>"$(<)"
}
explicit $(sqlite-source-locate)/sqlite3.def ;
When I use solution above, I get the error from Boost Build: "Action
too long (8192 max)".
Then I rework with using generate rule (proces sources by one at time):
----------------------------------------------------------------------
rule generate-def ( project name : property-set : sources * )
{
local result ;
local a = [ new non-scanning-action : def-init : $(property-set) ]
;
result += [ new file-target $(name) $(name) : : $(project) : $(a) ]
;
for local s in $(sources)
{
a = [ new non-scanning-action $(s) : def-proc : $(property-set)
] ;
result += [ new file-target $(name) $(name) : : $(project) :
$(a) ] ;
}
return $(result) ;
}
rule def-init ( target : sources * : properties * )
{
}
actions def-init
{
echo EXPORTS > "$(<)"
}
rule def-proc ( target : sources * : properties * )
{
}
actions def-proc
{
$(NM) "$(>)" | grep " T " | grep " _mylib_" | sed "s/^.* _//"
>>"$(<)"
}
generate mylib.def
: $(MYLIB_OBJ)
: <generating-rule>@generate-def
;
explicit mylib.def ;
BUT this code not work: Boost Build report me about error (this is all
output from bjam):
c:/devtools/libs/boost_1_38_0/tools/build/v2/kernel\modules.jam:103:
in modules.call-in
rule def-init unknown in module object(non-scanning-action)@1337.
c:/devtools/libs/boost_1_38_0/tools/build/v2/util\indirect.jam:90: in
indirect.call
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:758:
in object(non-scanning-action)@1337.actualize
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:301:
in actualize-action
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:489:
in actualize-no-scanner
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:130:
in object(file-target)@1338.actualize
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:779:
in actualize-source-type
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:798:
in actualize-sources
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:740:
in object(action)@1508.actualize
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:301:
in actualize-action
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:489:
in actualize-no-scanner
c:/devtools/libs/boost_1_38_0/tools/build/v2/build\virtual-target.jam:130:
in object(file-target)@1509.actualize
c:/devtools/libs/boost_1_38_0/tools/build/v2\build-system.jam:695: in
load
c:\devtools\libs\boost_1_38_0\tools\build\v2/kernel\modules.jam:283: in
import
c:\devtools\libs\boost_1_38_0\tools\build\v2\kernel\bootstrap.jam:138:
in boost-build
c:\devtools\libs\boost_1_38_0\boost-build.jam:16: in module scope
--
С уважением, Алексей Бадяев
г. Кемерово пр-т Ленина 52 тел. +7 904 375 7805