diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-12-17 20:16:25 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-12-17 20:16:25 +0000 |
commit | 1cd73b4dadb8e618a0ec56289408922be42aac8a (patch) | |
tree | b437cb421d0ed2da6eca57ec4925a8b740aa00d1 /include | |
parent | 1fca479d8eb793bf6473226ff248cfe7b814a3e8 (diff) |
Implemented CMake build system to replace the old autoconf-based build system.
(Note: Although each Makefile was changed, they will be removed later as CMake reconstructs them.)
Also fixed generation of language files and version.h to not rely on the current directory they are in.
Edited Config to send parameters to cmake, but it is no longer a requirement.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1835 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
-rw-r--r-- | include/CMakeLists.txt | 69 | ||||
-rw-r--r-- | include/Makefile | 188 | ||||
-rw-r--r-- | include/sysconf.h.cmake | 78 | ||||
-rw-r--r-- | include/version.sh | 8 |
4 files changed, 328 insertions, 15 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 000000000..8deeef120 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,69 @@ +# NOTE: Need a better dependency system here! + +set(HEADERS_REL commands.h extern.h messages.h module.h modules.h pseudo.h services.h) + +set(commands.h_HEADERS modules.h) +set(extern.h_HEADERS slist.h) +set(messages.h_HEADERS modules.h) +set(module.h_HEADERS services.h commands.h ${Anope_BINARY_DIR}/lang/language.h modules.h ${CMAKE_CURRENT_BINARY_DIR}/version.h) +set(modules.h_HEADERS services.h) +set(pseudo.h_HEADERS commands.h ${Anope_BINARY_DIR}/lang/language.h timeout.h encrypt.h datafiles.h slist.h) +set(services.h_HEADERS sysconf.h config.h sockets.h defs.h slist.h events.h bots.h account.h regchannel.h users.h extern.h configreader.h) + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h + #COMMAND ${CMAKE_COMMAND} -E copy ${Anope_SOURCE_DIR}/version.log ../ + COMMAND ${SH} ${CMAKE_CURRENT_SOURCE_DIR}/version.sh ${Anope_SOURCE_DIR}/version.log + #COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_SOURCE_DIR}/ + #COMMAND ${CMAKE_COMMAND} -E remove ../version.log + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/version.sh DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h ${CMAKE_CURRENT_SOURCE_DIR}/messages.h ${SRC_SRCS} +# MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/version.sh DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h ${CMAKE_CURRENT_SOURCE_DIR}/messages.h +) + +foreach(HEADER ${HEADERS_REL}) + add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} + COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} + ) + set(HEADERS_FULL ${HEADERS_FULL} ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER}) + set(HEADERS) + if(${HEADER}_HEADERS) + foreach(HEADER ${${HEADER}_HEADERS}) + string(SUBSTRING ${HEADER} 0 1 FIRST_CHAR) + if(FIRST_CHAR STREQUAL "/") + set(HEADERS ${HEADERS} ${HEADER}) + else(FIRST_CHAR STREQUAL "/") + set(HEADERS ${HEADERS} ${Anope_SOURCE_DIR}/include/${HEADER}) + endif(FIRST_CHAR STREQUAL "/") + endforeach(HEADER) + endif(${HEADER}_HEADERS) + if(HEADERS) + set_source_files_properties(${HEADER} PROPERTIES OBJECT_DEPENDS "${HEADERS}") + endif(HEADERS) +endforeach(HEADER) + +set(HEADERS_FULL ${HEADERS_FULL} ${CMAKE_CURRENT_BINARY_DIR}/version.h) +message(STATUS "HEADERS_FULL: ${HEADERS_FULL}") + +#add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/services.h +# COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/services.h +# MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/extern.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sysconf.h ${CMAKE_CURRENT_SOURCE_DIR}/config.h +#) +#add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/extern.h +# COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/extern.h +# MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/slist.h +#) +#add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h +# COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h +# MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/timeout.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/commands.h ${CMAKE_CURRENT_SOURCE_DIR}/encrypt.h ${CMAKE_CURRENT_SOURCE_DIR}/datafiles.h ${CMAKE_CURRENT_SOURCE_DIR}/slist.h +#) +#add_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/version.h src_srcs) +#add_custom_target(include_version_h ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.h) +#add_custom_target(include_version_h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.h) +#add_dependencies(include_version_h src_srcs) + +#add_custom_target(include ALL) +#add_custom_target(include) +#add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${CMAKE_CURRENT_SOURCE_DIR}/extern.h ${CMAKE_CURRENT_SOURCE_DIR}/pseudo.h) +add_custom_target(headers DEPENDS ${HEADERS_FULL}) +#add_dependencies(include include_version_h) + +set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM yes ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/language.h") diff --git a/include/Makefile b/include/Makefile index b5641c71b..0f6f17e9b 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,20 +1,182 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 2.6 -all: services.h extern.h pseudo.h version.h +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target -version.h: Makefile version.sh services.h pseudo.h messages.h $(SRCS) - sh version.sh +#============================================================================= +# Special targets provided by cmake. -services.h: sysconf.h config.h extern.h - touch $@ +# Disable implicit rules so canoncical targets will work. +.SUFFIXES: -extern.h: slist.h - touch $@ +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = -pseudo.h: commands.h timeout.h encrypt.h datafiles.h slist.h - touch $@ +.SUFFIXES: .hpux_make_needs_suffix_list -clean: - (rm -f language.h) +# Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/local/bin/cmake + +# The command to remove a file. +RM = /usr/local/bin/cmake -E remove -f + +# The program to use to edit the cache. +CMAKE_EDIT_COMMAND = /usr/local/bin/ccmake + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /celes/anope + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /celes/anope + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + cd /celes/anope/include && /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + cd /celes/anope/include && /usr/local/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + cd /celes/anope/include && /usr/local/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + cd /celes/anope/include && /usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: install/local +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + cd /celes/anope/include && /usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: install/strip +.PHONY : install/strip/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + cd /celes/anope/include && /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# The main all target +all: cmake_check_build_system + cd /celes/anope && $(CMAKE_COMMAND) -E cmake_progress_start /celes/anope/CMakeFiles /celes/anope/include/CMakeFiles/progress.make + cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 include/all + $(CMAKE_COMMAND) -E cmake_progress_start /celes/anope/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 include/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 include/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 include/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /celes/anope && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +include/CMakeFiles/headers.dir/rule: + cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 include/CMakeFiles/headers.dir/rule +.PHONY : include/CMakeFiles/headers.dir/rule + +# Convenience name for target. +headers: include/CMakeFiles/headers.dir/rule +.PHONY : headers + +# fast build rule for target. +headers/fast: + cd /celes/anope && $(MAKE) -f include/CMakeFiles/headers.dir/build.make include/CMakeFiles/headers.dir/build +.PHONY : headers/fast + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... headers" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /celes/anope && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system -distclean: clean - (rm -f sysconf.h version.h) diff --git a/include/sysconf.h.cmake b/include/sysconf.h.cmake new file mode 100644 index 000000000..b4241f4b2 --- /dev/null +++ b/include/sysconf.h.cmake @@ -0,0 +1,78 @@ +#ifndef _SYSCONF_H_ +#define _SYSCONF_H_ + +#cmakedefine DEFUMASK @DEFUMASK@ +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_STDDEF_H 1 +#cmakedefine HAVE_BACKTRACE 1 +#cmakedefine HAVE_GETHOSTBYNAME 1 +#cmakedefine HAVE_GETTIMEOFDAY 1 +#cmakedefine HAVE_SETGRENT 1 +#cmakedefine HAVE_STRCASECMP 1 +#cmakedefine HAVE_STRICMP 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_STRLCAT 1 +#cmakedefine HAVE_STRLCPY 1 +#cmakedefine HAVE_SYS_SELECT_H 1 +#cmakedefine HAVE_UMASK 1 +#cmakedefine HAVE_VA_LIST_AS_ARRAY 1 +// Temporary, change elsewhere to be SERVICES_DIR/modules/ +#define MODULE_PATH "@SERVICES_DIR@/modules/" +#cmakedefine RUNGROUP "@RUNGROUP@" +#cmakedefine SERVICES_BIN "@SERVICES_BIN@" +#cmakedefine SERVICES_DIR "@SERVICES_DIR@" + +// Temporary, remove from here later as well as elsewhere in the code +#define DL_PREFIX "" + +#cmakedefine HAVE_INT16_T 1 +#cmakedefine HAVE_UINT16_T 1 +#cmakedefine HAVE_U_INT16_T 1 +#cmakedefine HAVE_INT32_T 1 +#cmakedefine HAVE_UINT32_T 1 +#cmakedefine HAVE_U_INT32_T 1 + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_STDDEF_H +# include <stddef.h> +#endif + +#ifdef HAVE_INT16_T +typedef int16_t int16; +#else +typedef short int16; +#endif + +#ifdef HAVE_UINT16_T +typedef uint16_t uint16; +#else +# ifdef HAVE_U_INT16_T +typedef u_int16_t uint16; +# else +typedef unsigned short uint16; +# endif +#endif + +#ifdef HAVE_INT32_T +typedef int32_t int32; +#else +typedef long int32; +#endif + +#ifdef HAVE_UINT32_T +typedef uint32_t uint32; +#else +# ifdef HAVE_U_INT32_T +typedef u_int32_t uint32; +# else +typedef unsigned long uint32; +# endif +#endif + +#endif diff --git a/include/version.sh b/include/version.sh index fe978fab7..962896e6b 100644 --- a/include/version.sh +++ b/include/version.sh @@ -3,8 +3,12 @@ # Build version string and increment Services build number. # +if [ $# -lt 1 ] ; then + echo "Syntax: $0 <version.log>" + exit 1 +fi # Grab version information from the version control file. -CTRL="../version.log" +CTRL="$1" if [ -f $CTRL ] ; then . $CTRL else @@ -16,7 +20,7 @@ VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_EXTRA} (${V VERSIONDOTTED="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_EXTRA}.${VERSION_BUILD}" if [ -f version.h ] ; then - BUILD=`fgrep '#define BUILD' version.h | sed 's/^#define BUILD.*\([0-9]*\).*$/\1/'` + BUILD=`fgrep '#define BUILD' version.h | cut -f2 -d\"` BUILD=`expr $BUILD + 1 2>/dev/null` else BUILD=1 |