diff --git a/.gitmodules b/.gitmodules index a83702e82a..53b0f86697 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,9 +19,6 @@ [submodule "auxil/netcontrol-connectors"] path = auxil/netcontrol-connectors url = https://github.com/zeek/zeek-netcontrol -[submodule "auxil/bifcl"] - path = auxil/bifcl - url = https://github.com/zeek/bifcl [submodule "doc"] path = doc url = https://github.com/zeek/zeek-docs diff --git a/CMakeLists.txt b/CMakeLists.txt index d2b4734d54..6e146f1a2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -904,11 +904,11 @@ set(_binpac_exe_path "included") find_package(BinPAC REQUIRED) add_executable(Zeek::BinPAC ALIAS binpac) -add_subdirectory(auxil/bifcl) +add_subdirectory(tools/bifcl) add_executable(Zeek::BifCl ALIAS bifcl) # FIXME: avoid hard-coding a path for multi-config generator support. See the # TODO in ZeekPluginConfig.cmake.in. -set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/auxil/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}") +set(BIFCL_EXE_PATH "${CMAKE_BINARY_DIR}/tools/bifcl/bifcl${CMAKE_EXECUTABLE_SUFFIX}") set(_bifcl_exe_path "included") if (NOT GEN_ZAM_EXE_PATH) diff --git a/auxil/bifcl b/auxil/bifcl deleted file mode 160000 index 5947749f78..0000000000 --- a/auxil/bifcl +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5947749f7850b075f11d6a2aaefe7dad4f63cb62 diff --git a/tools/bifcl/CMakeLists.txt b/tools/bifcl/CMakeLists.txt index e422a962d1..9896236429 100644 --- a/tools/bifcl/CMakeLists.txt +++ b/tools/bifcl/CMakeLists.txt @@ -1,70 +1,26 @@ -cmake_minimum_required(VERSION 3.15.0 FATAL_ERROR) -project(BifCl C CXX) - -include(cmake/CommonCMakeConfig.cmake) -include(cmake/RequireCXXStd.cmake) - find_package(BISON REQUIRED) find_package(FLEX REQUIRED) -if (MSVC) - add_compile_options(/J) # Similar to -funsigned-char on other platforms - set_property(SOURCE bif_lex.cc APPEND_STRING PROPERTY COMPILE_FLAGS "/wd4018") -else () - set_property(SOURCE bif_lex.cc APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-sign-compare") -endif () - -include_directories(BEFORE ${BifCl_SOURCE_DIR}/include ${BifCl_BINARY_DIR}) - set(BISON_FLAGS "--debug") # BIF parser/scanner -bison_target(BIFParser builtin-func.y ${BifCl_BINARY_DIR}/bif_parse.cc - DEFINES_FILE ${BifCl_BINARY_DIR}/bif_parse.h COMPILE_FLAGS "${BISON_FLAGS}") -flex_target(BIFScanner builtin-func.l ${BifCl_BINARY_DIR}/bif_lex.cc) +bison_target(BIFParser builtin-func.y ${CMAKE_CURRENT_BINARY_DIR}/bif_parse.cc + DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/bif_parse.h COMPILE_FLAGS "${BISON_FLAGS}") +flex_target(BIFScanner builtin-func.l ${CMAKE_CURRENT_BINARY_DIR}/bif_lex.cc) add_flex_bison_dependency(BIFScanner BIFParser) -set(bifcl_SRCS - ${BISON_BIFParser_INPUT} - ${FLEX_BIFScanner_INPUT} - ${BISON_BIFParser_OUTPUTS} - ${FLEX_BIFScanner_OUTPUTS} - bif_arg.cc - include/bif_arg.h - module_util.cc - include/module_util.h) +set(bifcl_SRCS ${BISON_BIFParser_INPUT} ${FLEX_BIFScanner_INPUT} ${BISON_BIFParser_OUTPUTS} + ${FLEX_BIFScanner_OUTPUTS} bif_arg.cc module_util.cc) add_executable(bifcl ${bifcl_SRCS}) +target_include_directories(bifcl BEFORE PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) if (MSVC) - # If building separately from zeek, we need to add the libunistd subdirectory - # so that linking doesn't fail. - if ("${CMAKE_PROJECT_NAME}" STREQUAL "BifCl") - add_subdirectory(auxil/libunistd EXCLUDE_FROM_ALL) - endif () + target_compile_options(bifcl PUBLIC "/J") # Similar to -funsigned-char on other platforms + target_compile_options(bifcl PUBLIC "/wd4018") # Similar to -Wno-sign-compare on other platforms target_link_libraries(bifcl PRIVATE libunistd) +else () + target_compile_options(bifcl PUBLIC "-Wno-sign-compare") endif () install(TARGETS bifcl DESTINATION bin) - -if (CMAKE_BUILD_TYPE) - string(TOUPPER ${CMAKE_BUILD_TYPE} BuildType) -endif () - -message( - "\n====================| Bifcl Build Summary |=====================" - "\n" - "\nBuild type: ${CMAKE_BUILD_TYPE}" - "\nBuild dir: ${PROJECT_BINARY_DIR}" - "\nInstall prefix: ${CMAKE_INSTALL_PREFIX}" - "\nDebug mode: ${ENABLE_DEBUG}" - "\n" - "\nCC: ${CMAKE_C_COMPILER}" - "\nCFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BuildType}}" - "\nCXX: ${CMAKE_CXX_COMPILER}" - "\nCXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BuildType}}" - "\nCPP: ${CMAKE_CXX_COMPILER}" - "\n" - "\n================================================================\n") - -include(UserChangedWarning) diff --git a/tools/bifcl/bif_arg.cc b/tools/bifcl/bif_arg.cc index 920846e4a8..a75d480b9a 100644 --- a/tools/bifcl/bif_arg.cc +++ b/tools/bifcl/bif_arg.cc @@ -1,3 +1,5 @@ +// See the file "COPYING" in the main distribution directory for copyright. + #include "bif_arg.h" #include diff --git a/tools/bifcl/include/bif_arg.h b/tools/bifcl/include/bif_arg.h index a9febd013b..57e38cbbd6 100644 --- a/tools/bifcl/include/bif_arg.h +++ b/tools/bifcl/include/bif_arg.h @@ -1,3 +1,5 @@ +// See the file "COPYING" in the main distribution directory for copyright. + #pragma once #include diff --git a/tools/bifcl/include/module_util.h b/tools/bifcl/include/module_util.h index 30015e527c..92a4c7598a 100644 --- a/tools/bifcl/include/module_util.h +++ b/tools/bifcl/include/module_util.h @@ -1,3 +1,5 @@ +// See the file "COPYING" in the main distribution directory for copyright. + // // These functions are used by both Zeek and bifcl. //