--- gforth/libcc.fs 2008/07/15 16:11:49 1.50 +++ gforth/libcc.fs 2008/11/01 19:21:07 1.57 @@ -135,6 +135,7 @@ \ : delete-file 2drop 0 ; require struct.fs +require mkdir.fs \ c-function-ft word body: struct @@ -226,7 +227,7 @@ end-struct c-lib% variable c-libs \ linked list of library names (without "lib") -: add-lib ( c-addr u -- ) +: add-lib ( c-addr u -- ) \ gforth \G Add library lib@i{string} to the list of libraries, where \G @i{string} is represented by @i{c-addr u}. c-lib% %size allocate throw dup >r @@ -431,7 +432,7 @@ create gen-wrapped-types dup { descriptor } count { ret } count 2dup { d: pars } chars + count { d: c-name } ." void " lib-modulename 2@ type ." _LTX_" descriptor wrapper-function-name 2dup type drop free throw - .\" (void)\n" + .\" (GFORTH_ARGS)\n" .\" {\n Cell MAYBE_UNUSED *sp = gforth_SP;\n Float MAYBE_UNUSED *fp = gforth_FP;\n " pars c-name 2over count-stacks ret gen-wrapped-stmt .\" ;\n" ?dup-if @@ -505,13 +506,15 @@ create gen-wrapped-types open-wrappers dup if lib-handle-addr @ ! else + libcc-named-dir $1ff mkdir-parents drop drop c-library-name-create endif ; : c-tmp-library-name ( c-addr u -- ) \ set up filenames for a new library; c-addr u is the basename of \ the library - libcc-tmp-dir prepend-dirname c-library-name-setup c-library-name-create ; + libcc-tmp-dir 2dup $1ff mkdir-parents drop + prepend-dirname c-library-name-setup c-library-name-create ; : lib-handle ( -- addr ) lib-handle-addr @ @ ; @@ -553,15 +556,15 @@ DEFER compile-wrapper-function ( -- ) lib-handle 0= if c-source-file close-file throw 0 c-source-file-id ! - [ libtool-command s" --silent --mode=compile --tag=CC " s+ + [ libtool-command s" --silent --mode=compile " s+ libtool-cc append s" -I " append s" includedir" getenv append ] sliteral s" -O -c " s+ lib-filename 2@ append s" .c -o " append lib-filename 2@ append s" .lo" append ( c-addr u ) - \ cr 2dup type + \ 2dup type cr 2dup system drop free throw $? abort" libtool compile failed" - [ libtool-command s" --silent --mode=link --tag=CC " s+ - libtool-cc append s" -module -rpath " s+ ] sliteral + [ libtool-command s" --silent --mode=link " s+ + libtool-cc append libtool-flags append s" -module -rpath " s+ ] sliteral lib-filename 2@ dirname replace-rpath s+ s" " append lib-filename 2@ append s" .lo -o " append lib-filename 2@ append s" .la" append ( c-addr u ) @@ -614,7 +617,7 @@ DEFER compile-wrapper-function ( -- ) defer lastxt dup c-function-rt lastxt c-function-ft lastxt swap defer! ; -: clear-libs ( -- ) +: clear-libs ( -- ) \ gforth \G Clear the list of libs c-source-file-id @ if compile-wrapper-function