diff --git a/contrib/10.regexp/CMakeLists.txt b/contrib/10.regexp/CMakeLists.txt index f71ccfc7..6ab06aaa 100644 --- a/contrib/10.regexp/CMakeLists.txt +++ b/contrib/10.regexp/CMakeLists.txt @@ -7,7 +7,7 @@ if (REGEX_FOUND) file(GLOB PICRIN_REGEX_SOURCES ${PROJECT_SOURCE_DIR}/contrib/10.regexp/src/*.c) - list(APPEND PICRIN_CONTRIB_INITS "void pic_init_regexp(pic_state *)\; pic_init_regexp(pic)\;") + list(APPEND PICRIN_CONTRIB_INITS regexp) list(APPEND PICRIN_CONTRIB_LIBRARIES ${REGEX_LIBRARIES}) list(APPEND PICRIN_CONTRIB_SOURCES ${PICRIN_REGEX_SOURCES}) endif() diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 2487f0d0..11050d90 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -3,5 +3,3 @@ list(SORT CONTRIBS) foreach(contrib ${CONTRIBS}) include(${contrib}) endforeach() - -add_definitions("-DPIC_CONTRIB_INITS=${PICRIN_CONTRIB_INITS}") diff --git a/etc/mkinit.pl b/etc/mkinit.pl new file mode 100755 index 00000000..d559db27 --- /dev/null +++ b/etc/mkinit.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl + +use strict; + +print < ${CONTRIB_INIT} + DEPENDS ${PICRIN_CONTRIB_SOURCES} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + ) + # build! file(GLOB PICRIN_SOURCES ${PROJECT_SOURCE_DIR}/src/*.c) -add_library(picrin SHARED ${PICRIN_SOURCES} ${PICLIB_SOURCE} ${XFILE_SOURCES} ${PICRIN_CONTRIB_SOURCES}) +add_library(picrin SHARED ${PICRIN_SOURCES} ${PICLIB_SOURCE} ${XFILE_SOURCES} ${PICRIN_CONTRIB_SOURCES} ${CONTRIB_INIT}) target_link_libraries(picrin m ${PICRIN_CONTRIB_LIBRARIES}) # install diff --git a/src/init.c b/src/init.c index c6667a3b..b59e0600 100644 --- a/src/init.c +++ b/src/init.c @@ -31,15 +31,10 @@ void pic_init_load(pic_state *); void pic_init_write(pic_state *); void pic_init_read(pic_state *); void pic_init_dict(pic_state *); +void pic_init_contrib(pic_state *); void pic_load_piclib(pic_state *); -void -pic_init_contrib(pic_state *pic) -{ - PIC_CONTRIB_INITS -} - #define push_sym(pic, name, list) \ pic_push(pic, pic_symbol_value(pic_intern_cstr(pic, name)), list)