From 464f06c5c1639182c019ff4069a7869bae979219 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Sat, 30 Oct 2010 23:11:10 +0200 Subject: [PATCH 01/19] parse: typo --- src/parse/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parse/parse.c b/src/parse/parse.c index 4963b4e..c214448 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -338,7 +338,7 @@ include(struct keyword *head) filename = head->name; if (!(kw = parse_keywords(filename))) { - warnx("no config fond in include file %s", head->name); + warnx("no config found in include file %s", head->name); if (filename != head->name) free(filename); From 658e26bd49dcdb349eb66c40ff485db0e0b30737 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Sat, 30 Oct 2010 23:16:44 +0200 Subject: [PATCH 02/19] parse: detect empty file + fix memleak --- src/parse/parse.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/parse/parse.c b/src/parse/parse.c index c214448..d9948b2 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -165,8 +165,15 @@ parse_keywords(const char *filename) return NULL; } + if (st.st_size == 0) { + warnx("%s: empty file", filename); + close(fd); + return NULL; + } + if (!realpath(filename, path)) { warn("%s", filename); + close(fd); return NULL; } From 7db51713e525229a591603cc39e98490d5d5fe47 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 12:15:11 +0100 Subject: [PATCH 03/19] Build System: remove cmake Cmake is bloat and wmfs doesn't need a complex build system So now wmfs compile with a Makefile using gmake and pkg-config compilation options can be customised through confix.mk (dwm like) Remove doxygen config files (wmfs code doesn't use it, and nobody use doxygen with wmfs) Replace wmfsrc.in by wmfsrc (change @WMFS_TERM@ and use shell choice urxvt || xterm || ...) Remove generation of Changelog file (we can git log > Changelog before creating a dist package) Remove README from install process (this file don't need to be included in dist package) What's next before merging into master ? - provide a BSD Makefile - discuss if we use or not pkg-config (we can document common places to include directory and libs in config.mk) - compile out of tree --- .gitignore | 12 -- CMakeLists.txt | 171 ----------------- Makefile | 79 ++++++++ cmake/cmake_uninstall.cmake.in | 21 --- cmake/modules/MacroConfigureFile.cmake | 8 - config.mk | 19 ++ src/wmfs.c | 6 +- src/wmfs.h | 1 - wmfs.doxygen.in | 242 ------------------------- wmfsrc.in => wmfsrc | 4 +- 10 files changed, 101 insertions(+), 462 deletions(-) delete mode 100644 CMakeLists.txt create mode 100644 Makefile delete mode 100755 cmake/cmake_uninstall.cmake.in delete mode 100644 cmake/modules/MacroConfigureFile.cmake create mode 100644 config.mk delete mode 100644 wmfs.doxygen.in rename wmfsrc.in => wmfsrc (99%) diff --git a/.gitignore b/.gitignore index 8bdb74a..6145015 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,5 @@ -CMakeCache.txt -CMakeFiles/ -cmake_install.cmake -cmake_uninstall.cmake -Makefile *.o .*.sw? wmfs -src/config.h -changelog -config.h #* \#* -build/ -doc/ -wmfs.doxygen -wmfsrc diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index ac3e474..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,171 +0,0 @@ -# -*- mode: cmake -*- - -# Minimal version of CMake -cmake_minimum_required(VERSION 2.6.0) -cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) - -# set some default options -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} ) -set(CMAKE_COLOR_MAKEFILE ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_BUILD_TYPE_SHARED_LIBS ON) -set(CMAKE_C_FLAGS $ENV{CFLAGS}) -set(CMAKE_CXX_FLAGS $ENV{CXXFLAGS}) -set(CMAKE_LINK_FLAGS $ENV{LDFLAGS}) - -# include macros -include(MacroConfigureFile) - -# uninstall -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY ) -add_custom_target( uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" ) - -# Project name - wmfs -set(PROJECT_NAME wmfs) -set(VERSION "WMFS-201008") -project(${PROJECT_NAME} C) - -find_package(PkgConfig REQUIRED) -# required packages -pkg_check_modules(FREETYPE REQUIRED freetype2) -pkg_check_modules(X11 REQUIRED x11) -pkg_check_modules(XFT REQUIRED xft) - -include_directories( - ${FREETYPE_INCLUDE_DIRS} - ${X11_INCLUDE_DIRS} - ${XFT_INCLUDE_DIRS} -) - -set(CMAKE_LINK_LIBRARIES - ${FREETYPE_LIBRARIES} - ${X11_LIBRARIES} - ${XFT_LIBRARIES} - -lpthread -) - -# options -option(BUILD_DOC "Generate documentation using doxygen" OFF) -option(WITH_XINERAMA "Build with Xinerama support" ON) -option(WITH_XRANDR "Build with Xrandr support" ON) -option(WITH_IMLIB2 "Build with Imlib2 support" ON) - -# optional finders -if(WITH_XINERAMA) - add_definitions(-DHAVE_XINERAMA) - pkg_check_modules(XINERAMA REQUIRED xinerama) - include_directories(${XINERAMA_INCLUDE_DIRS}) - set(CMAKE_LINK_LIBRARIES ${XINERAMA_LIBRARIES} ${CMAKE_LINK_LIBRARIES}) -else(WITH_XINERAMA) - message(STATUS "Not building with Xinerama support") -endif(WITH_XINERAMA) - -if(WITH_XRANDR) - add_definitions(-DHAVE_XRANDR) - pkg_check_modules(XRANDR REQUIRED xrandr) - include_directories(${XRANDR_INCLUDE_DIRS}) - set(CMAKE_LINK_LIBRARIES ${XRANDR_LIBRARIES} ${CMAKE_LINK_LIBRARIES}) -else(WITH_XRANDR) - message(STATUS "Not building with Xrandr support") -endif(WITH_XRANDR) - -if(WITH_IMLIB2) - add_definitions(-DHAVE_IMLIB) - pkg_check_modules(IMLIB2 REQUIRED imlib2) - include_directories(${IMLIB2_INCLUDE_DIRS}) - set(CMAKE_LINK_LIBRARIES ${IMLIB2_LIBRARIES} ${CMAKE_LINK_LIBRARIES}) -else(WITH_IMLIB2) - message(STATUS "Not building with Imlib2 support") -endif(WITH_IMLIB2) - -set(CMAKE_SYSCONFDIR ${CMAKE_INSTALL_PREFIX}/etc/ CACHE PATH "Config directory") -set(CMAKE_XDGCONFDIR ${CMAKE_SYSCONFDIR}/xdg/ CACHE PATH "XDG config directory") -set(CMAKE_DATADIR ${CMAKE_INSTALL_PREFIX}/share/ CACHE PATH "Data directory") -set(CMAKE_DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}-${VERSION} CACHE PATH "Data directory") - -# set default terminal for user -set(WMFS_TERM xterm) -# get the user compiling this thing -SET(USERNAME $ENV{USER}) - -# configure files -set(CONFIGURE_FILES - src/config.h.in - wmfs.doxygen.in - wmfsrc.in) -foreach(file ${CONFIGURE_FILES}) - ConfigureFile(${file}) -endforeach(file) - -# add the source directory -add_subdirectory(src) - -# documentation -if(BUILD_DOC) - find_package(Doxygen REQUIRED) - if(DOXYGEN_FOUND) - add_custom_target(doc - COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/wmfs.doxygen - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - else(DOXYGEN_FOUND) - MESSAGE(FATAL_ERROR "Doxygen executable not found") - endif(DOXYGEN_FOUND) -endif(BUILD_DOC) - -# Generating ChangeLog only for live version, for release we generate it to tarball -if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog) - find_program(GIT_EXECUTABLE git) - if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) - message(STATUS "<<< Generating ChangeLog... >>>") - execute_process( - COMMAND ${GIT_EXECUTABLE} log - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog) - else(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) - message(STATUS "No ChangeLog present and git not found") - message(STATUS "<<< Will not generate ChangeLog >>>") - endif(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) -endif(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog) - -# manpage (compression handled by system not by us) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wmfs.1 DESTINATION ${CMAKE_DATADIR}/man/man1) - -# install docs -# changelog || can have 2 locations based on whether we generate it or not -if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog) - set(WMFS_DOCS ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog ${WMFS_DOCS}) -endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog) -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog) - set(WMFS_DOCS ${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog ${WMFS_DOCS}) -endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ChangeLog) -set(WMFS_DOCS - ${CMAKE_CURRENT_SOURCE_DIR}/TODO - ${CMAKE_CURRENT_SOURCE_DIR}/README - ${WMFS_DOCS} -) -install(FILES ${WMFS_DOCS} DESTINATION ${CMAKE_DOCDIR}) - -# config file -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wmfsrc DESTINATION ${CMAKE_XDGCONFDIR}/${PROJECT_NAME}) - -# xsession -install(FILES "wmfs.desktop" DESTINATION ${CMAKE_DATADIR}/xsessions) - -# Status messages -message(STATUS "<<< ${PROJECT_NAME} ${VERSION} configuration >>> - Build type ${CMAKE_BUILD_TYPE} - Install path ${CMAKE_INSTALL_PREFIX} - Compiler flags: - C ${CMAKE_C_FLAGS} - C++ ${CMAKE_CXX_FLAGS} - Linker flags: - Executable ${CMAKE_EXE_LINKER_FLAGS} - Module ${CMAKE_MODULE_LINKER_FLAGS} - Shared ${CMAKE_SHARED_LINKER_FLAGS}\n") diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d7a72c8 --- /dev/null +++ b/Makefile @@ -0,0 +1,79 @@ +include config.mk + +SRC= \ +src/barwin.c \ +src/client.c \ +src/config.c \ +src/draw.c \ +src/event.c \ +src/ewmh.c \ +src/frame.c \ +src/getinfo.c \ +src/infobar.c \ +src/init.c \ +src/launcher.c \ +src/layout.c \ +src/menu.c \ +src/mouse.c \ +src/parse/api.c \ +src/parse/parse.c \ +src/screen.c \ +src/status.c \ +src/systray.c \ +src/tag.c \ +src/util.c \ +src/viwmfs.c \ +src/wmfs.c + +OBJ = ${SRC:.c=.o} + +ifneq ($(findstring xrandr, ${LIBS}),) + CFLAGS+= -DHAVE_XRANDR +endif + +ifneq ($(findstring xinerama, ${LIBS}),) + CFLAGS+= -DHAVE_XINERAMA +endif + +ifneq ($(findstring imlib2, ${LIBS}),) + CFLAGS+= -DHAVE_IMLIB2 +endif + +all: options wmfs + +.c.o: + @echo CC $< + @${CC} -c ${CFLAGS} $< -o $@ + +options: + @echo wmfs compile with ${LIBS} + @echo - CFLAGS ${CFLAGS} + @echo - LDFLAGS ${LDFLAGS} + +wmfs: ${OBJ} + @echo CC -o $@ + @${CC} -o $@ ${OBJ} ${LDFLAGS} + +clean: + @rm -f ${OBJ} wmfs + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @install wmfs ${DESTDIR}${PREFIX}/bin + @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @install -m 644 wmfs.1 ${DESTDIR}${MANPREFIX}/man1/ + @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions + @install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/wmfs + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1 + @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions + @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + + +.PHONY: all clean install uninstall diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in deleted file mode 100755 index cd4c9d8..0000000 --- a/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - -FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) -STRING(REGEX REPLACE "\n" ";" files "${files}") -FOREACH(file ${files}) - MESSAGE(STATUS "Uninstalling: \"$ENV{DESTDIR}${file}\"") - IF(EXISTS "$ENV{DESTDIR}${file}") - EXEC_PROGRAM( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - IF(NOT "${rm_retval}" STREQUAL 0) - MESSAGE(FATAL_ERROR "Problem when removing: \"$ENV{DESTDIR}${file}\"") - ENDIF(NOT "${rm_retval}" STREQUAL 0) - ELSE(EXISTS "$ENV{DESTDIR}${file}") - MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") - ENDIF(EXISTS "$ENV{DESTDIR}${file}") -ENDFOREACH(file) diff --git a/cmake/modules/MacroConfigureFile.cmake b/cmake/modules/MacroConfigureFile.cmake deleted file mode 100644 index b2ae132..0000000 --- a/cmake/modules/MacroConfigureFile.cmake +++ /dev/null @@ -1,8 +0,0 @@ -macro(ConfigureFile file) - string(REGEX REPLACE ".in\$" "" outfile ${file}) - message(STATUS "<<< Configuring ${outfile} >>>") - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${file} - ${CMAKE_CURRENT_BINARY_DIR}/${outfile} - ESCAPE_QUOTE - @ONLY) -endmacro(ConfigureFile) diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..38c08ea --- /dev/null +++ b/config.mk @@ -0,0 +1,19 @@ +# wmfs version +VERSION= 201011 + +# Customize below to fit your system +# x11 xft and freetype2 are REQUIRED, others are optionals +LIBS= x11 xft freetype2 xrandr xinerama imlib2 + +# paths +PREFIX= /usr/local +MANPREFIX= ${PREFIX}/share/man +XDG_CONFIG_DIR= /usr/local/etc/xdg/wmfs + +# flags +CFLAGS= -Wall -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" +CFLAGS+= $(shell pkg-config --cflags-only-I ${LIBS}) +LDFLAGS= $(shell pkg-config --libs ${LIBS}) -lpthread +CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" + +CC = cc diff --git a/src/wmfs.c b/src/wmfs.c index d1c666a..b614b21 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -449,11 +449,7 @@ main(int argc, char **argv) break; case 'v': - printf("WMFS version : "WMFS_VERSION"\n" - " Compilation settings :\n" - " - Flags : "WMFS_COMPILE_FLAGS"\n" - " - Linked Libs : "WMFS_LINKED_LIBS"\n" - " - On "WMFS_COMPILE_MACHINE" by "WMFS_COMPILE_BY".\n"); + printf("WMFS "WMFS_VERSION"\n"); exit(EXIT_SUCCESS); break; diff --git a/src/wmfs.h b/src/wmfs.h index c5da5c1..d6c88b9 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -60,7 +60,6 @@ /* Local headers */ #include "parse/parse.h" -#include "config.h" #include "structs.h" /* Optional dependencies */ diff --git a/wmfs.doxygen.in b/wmfs.doxygen.in deleted file mode 100644 index 583a59b..0000000 --- a/wmfs.doxygen.in +++ /dev/null @@ -1,242 +0,0 @@ -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = WMFS -PROJECT_NUMBER = devel -OUTPUT_DIRECTORY = doc -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = - -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = YES -EXTRACT_ANON_NSPACES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.c \ - *.h \ -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -HTML_DYNAMIC_SECTIONS = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor... -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references... -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool... -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = YeS -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = YES -CALLER_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine... -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/wmfsrc.in b/wmfsrc similarity index 99% rename from wmfsrc.in rename to wmfsrc index be084ee..9b52c8e 100644 --- a/wmfsrc.in +++ b/wmfsrc @@ -231,7 +231,7 @@ fg_focus = "#191919" bg_focus = "#7E89A2" fg_normal = "#9F9AB3" bg_normal = "#191919" - [item] name = "Terminal" func = "spawn" cmd = "@WMFS_TERM@" [/item] + [item] name = "Terminal" func = "spawn" cmd = "xterm" [/item] [item] name = "Applications" submenu = "appmenu" [/item] [item] name = "Next tag" func = "tag_next" [/item] [item] name = "Previous tag" func = "tag_prev" [/item] @@ -285,7 +285,7 @@ [key] mod = {"Alt", "Control"} key = "r" func = "reload" [/key] # Open a terminal. - [key] mod = {"Control"} key = "Return" func = "spawn" cmd = "@WMFS_TERM@" [/key] + [key] mod = {"Control"} key = "Return" func = "spawn" cmd = "xterm" [/key] # Kill the selected client. [key] mod = {"Alt"} key = "q" func = "client_kill" [/key] From f3c0f5492afbec288f91ea080916a92d8e94941b Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 12:32:48 +0100 Subject: [PATCH 04/19] Parser: fix unused variable --- src/parse/parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parse/parse.c b/src/parse/parse.c index d9948b2..1fdab6c 100644 --- a/src/parse/parse.c +++ b/src/parse/parse.c @@ -80,7 +80,9 @@ static struct keyword * push_keyword(struct keyword *tail, enum keyword_t type, char *buf, size_t *offset, struct files *file, int line) { struct keyword *kw; +#ifdef DEBUG int i = 0; +#endif if (type == WORD && *offset == 0) return tail; From a1de32cac7aff8682caf182b8fb5069e4c5de7e9 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 12:36:13 +0100 Subject: [PATCH 05/19] wmfsrc: Made change announced in f3c0f5492afbec288f91ea080916a92d8e94941b --- wmfsrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wmfsrc b/wmfsrc index 9b52c8e..0b675bd 100644 --- a/wmfsrc +++ b/wmfsrc @@ -231,7 +231,7 @@ fg_focus = "#191919" bg_focus = "#7E89A2" fg_normal = "#9F9AB3" bg_normal = "#191919" - [item] name = "Terminal" func = "spawn" cmd = "xterm" [/item] + [item] name = "Terminal" func = "spawn" cmd = "urxvt || xterm || gnome-terminal" [/item] [item] name = "Applications" submenu = "appmenu" [/item] [item] name = "Next tag" func = "tag_next" [/item] [item] name = "Previous tag" func = "tag_prev" [/item] From e01bb5c3b0c4de30f73d3b84703633a7bfa7d3f4 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 18:22:02 +0100 Subject: [PATCH 06/19] Re use doxygen file (in fact still used /o\) --- wmfs.doxygen | 242 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 wmfs.doxygen diff --git a/wmfs.doxygen b/wmfs.doxygen new file mode 100644 index 0000000..bb3e3a4 --- /dev/null +++ b/wmfs.doxygen @@ -0,0 +1,242 @@ +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = WMFS +PROJECT_NUMBER = devel +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +ALIASES = + +OPTIMIZE_OUTPUT_FOR_C = YES +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = YES +EXTRACT_ANON_NSPACES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = YES +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.h \ +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = YES +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = NO +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor... +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references... +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool... +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = YES +TEMPLATE_RELATIONS = YeS +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine... +#--------------------------------------------------------------------------- +SEARCHENGINE = NO From 52e53c7415ccbebb580c638514db76ca07549790 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 18:28:39 +0100 Subject: [PATCH 07/19] Remove another CMakelist.txt --- src/CMakeLists.txt | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 24a540e..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# -*- mode: cmake -*- - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/parse) - -SET(WMFS_SOURCES - parse/parse.c - parse/api.c - barwin.c - client.c - config.c - draw.c - event.c - ewmh.c - frame.c - getinfo.c - infobar.c - init.c - launcher.c - layout.c - menu.c - mouse.c - screen.c - status.c - systray.c - tag.c - util.c - viwmfs.c - wmfs.c -) - -add_executable(${PROJECT_NAME} ${WMFS_SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CMAKE_LINK_LIBRARIES}) -INSTALL ( TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib${LIB_SUFFIX} ) From 2614c61657ca177d1193469a644bc854dec06447 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 19:24:22 +0100 Subject: [PATCH 08/19] build: all .o and wmfs depend on config.mk --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d7a72c8..c30ee42 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ endif all: options wmfs -.c.o: +%.o: %.c config.mk @echo CC $< @${CC} -c ${CFLAGS} $< -o $@ @@ -50,7 +50,7 @@ options: @echo - CFLAGS ${CFLAGS} @echo - LDFLAGS ${LDFLAGS} -wmfs: ${OBJ} +wmfs: ${OBJ} config.mk @echo CC -o $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} From b0559080800fc511dcbf2c328fbd018d43817b33 Mon Sep 17 00:00:00 2001 From: David Delassus Date: Tue, 9 Nov 2010 20:01:14 +0100 Subject: [PATCH 09/19] Add out-of-tree building (make O=/path -C /path/to/wmfs) --- Makefile | 13 +++++++++---- config.mk | 1 + src/config.h.in | 45 --------------------------------------------- 3 files changed, 10 insertions(+), 49 deletions(-) delete mode 100644 src/config.h.in diff --git a/Makefile b/Makefile index c30ee42..dc2cc72 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ src/util.c \ src/viwmfs.c \ src/wmfs.c -OBJ = ${SRC:.c=.o} +OBJ = ${patsubst %.c,${O}/%.o,${SRC}} ifneq ($(findstring xrandr, ${LIBS}),) CFLAGS+= -DHAVE_XRANDR @@ -39,9 +39,10 @@ ifneq ($(findstring imlib2, ${LIBS}),) CFLAGS+= -DHAVE_IMLIB2 endif -all: options wmfs +all: options ${O}/wmfs -%.o: %.c config.mk +${O}/%.o: %.c config.mk + @if [ ! -d `dirname ${O}/$<` ]; then mkdir -p `dirname ${O}/$<`; fi @echo CC $< @${CC} -c ${CFLAGS} $< -o $@ @@ -49,8 +50,11 @@ options: @echo wmfs compile with ${LIBS} @echo - CFLAGS ${CFLAGS} @echo - LDFLAGS ${LDFLAGS} + @echo - OUTPUT ${O} -wmfs: ${OBJ} config.mk + @if [ ! -d ${O} ]; then mkdir -p ${O}; fi + +${O}/wmfs: ${OBJ} config.mk src/structs.h src/wmfs.h src/parse/parse.h @echo CC -o $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} @@ -77,3 +81,4 @@ uninstall: .PHONY: all clean install uninstall + diff --git a/config.mk b/config.mk index 38c08ea..e17e681 100644 --- a/config.mk +++ b/config.mk @@ -17,3 +17,4 @@ LDFLAGS= $(shell pkg-config --libs ${LIBS}) -lpthread CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" CC = cc +O = __build__ diff --git a/src/config.h.in b/src/config.h.in deleted file mode 100644 index 77d88bd..0000000 --- a/src/config.h.in +++ /dev/null @@ -1,45 +0,0 @@ -/* -* config.h -* Copyright © 2008 Martin Duquesnoy -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* * Neither the name of the nor the names of its -* contributors may be used to endorse or promote products derived from -* this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "wmfs.h" - -#define WMFS_VERSION "@VERSION@" -#define WMFS_COMPILE_MACHINE "@CMAKE_SYSTEM_PROCESSOR@" -#define WMFS_COMPILE_BY "@USERNAME@" -#define WMFS_COMPILE_FLAGS "@CMAKE_C_FLAGS@" -#define WMFS_LINKED_LIBS "@CMAKE_LINK_LIBRARIES@" -#define XDG_CONFIG_DIR "@CMAKE_XDGCONFDIR@" - -#endif /* CONFIG_H */ From eb567d99362036c5ad3284408e02d3fca495fffa Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Tue, 9 Nov 2010 20:07:29 +0100 Subject: [PATCH 10/19] BuildSystem: fix stuff on install --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc2cc72..b820f6f 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ clean: install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin - @install wmfs ${DESTDIR}${PREFIX}/bin + @install ${O}/wmfs ${DESTDIR}${PREFIX}/bin @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 @mkdir -p ${DESTDIR}${MANPREFIX}/man1 @install -m 644 wmfs.1 ${DESTDIR}${MANPREFIX}/man1/ From 5a05594092fa9cca81ea0e2a28e2cb30db11e250 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 16:14:26 +0100 Subject: [PATCH 11/19] BuildSystem: add BSDMakefile --- .gitignore | 1 + BSDmakefile | 42 ++++++++++++++++++++++++++++++++++++++++++ Makefile | 43 +++++++++++++------------------------------ common.mk | 31 +++++++++++++++++++++++++++++++ config.mk | 8 -------- 5 files changed, 87 insertions(+), 38 deletions(-) create mode 100644 BSDmakefile create mode 100644 common.mk diff --git a/.gitignore b/.gitignore index 6145015..a3eabb8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ wmfs #* \#* +build diff --git a/BSDmakefile b/BSDmakefile new file mode 100644 index 0000000..ce1328a --- /dev/null +++ b/BSDmakefile @@ -0,0 +1,42 @@ +.include "config.mk" +.include "common.mk" + +PROG= wmfs +MAN1= wmfs.1 + +.for lib in xrandr xinerama imlib2 +HAVE_${lib:U}!= echo ${LIBS} | grep -q ${lib} && echo -DHAVE_${lib:U} +CFLAGS+= ${HAVE_${lib:U}} +.endfor + +CFLAGS_LIB!= pkg-config --cflags-only-I ${LIBS} +LDFLAGS_LIB!= pkg-config --libs ${LIBS} + +CFLAGS+= ${CFLAGS_LIB} +LDADD+= ${LDFLAGS_LIB} -lpthread + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @install ${.OBJDIR}/wmfs ${DESTDIR}${PREFIX}/bin + @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @install -m 644 ${.OBJDIR}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ + @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions + @install -m 644 ${.CURDIR}/wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/wmfs + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz + @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions + @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + + +.include + +.c.o: config.mk + @if [ ! -d `dirname ${.TARGET}` ]; then mkdir -p `dirname ${.TARGET}`; fi + @echo CC ${.IMPSRC} + @${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} diff --git a/Makefile b/Makefile index b820f6f..057b563 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,7 @@ include config.mk +include common.mk -SRC= \ -src/barwin.c \ -src/client.c \ -src/config.c \ -src/draw.c \ -src/event.c \ -src/ewmh.c \ -src/frame.c \ -src/getinfo.c \ -src/infobar.c \ -src/init.c \ -src/launcher.c \ -src/layout.c \ -src/menu.c \ -src/mouse.c \ -src/parse/api.c \ -src/parse/parse.c \ -src/screen.c \ -src/status.c \ -src/systray.c \ -src/tag.c \ -src/util.c \ -src/viwmfs.c \ -src/wmfs.c - -OBJ = ${patsubst %.c,${O}/%.o,${SRC}} +OBJ = ${patsubst %.c,${O}/%.o,${SRCS}} ifneq ($(findstring xrandr, ${LIBS}),) CFLAGS+= -DHAVE_XRANDR @@ -39,7 +15,13 @@ ifneq ($(findstring imlib2, ${LIBS}),) CFLAGS+= -DHAVE_IMLIB2 endif -all: options ${O}/wmfs +CFLAGS+= $(shell pkg-config --cflags-only-I ${LIBS}) +LDFLAGS+= $(shell pkg-config --libs ${LIBS}) -lpthread + +all: options ${O}/wmfs ${O}/wmfs.1.gz + +${O}/wmfs.1.gz: wmfs.1 + gzip -cn -9 $< > $@ ${O}/%.o: %.c config.mk @if [ ! -d `dirname ${O}/$<` ]; then mkdir -p `dirname ${O}/$<`; fi @@ -59,7 +41,7 @@ ${O}/wmfs: ${OBJ} config.mk src/structs.h src/wmfs.h src/parse/parse.h @${CC} -o $@ ${OBJ} ${LDFLAGS} clean: - @rm -f ${OBJ} wmfs + @rm -f ${OBJ} ${O}/wmfs ${O}/wmfs.1.gz install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin @@ -67,7 +49,7 @@ install: all @install ${O}/wmfs ${DESTDIR}${PREFIX}/bin @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 @mkdir -p ${DESTDIR}${MANPREFIX}/man1 - @install -m 644 wmfs.1 ${DESTDIR}${MANPREFIX}/man1/ + @install -m 644 ${O}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions @install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions @@ -75,10 +57,11 @@ uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin @rm -f ${DESTDIR}${PREFIX}/bin/wmfs @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 - @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + .PHONY: all clean install uninstall diff --git a/common.mk b/common.mk new file mode 100644 index 0000000..2a6dd8e --- /dev/null +++ b/common.mk @@ -0,0 +1,31 @@ +SRCS= \ +src/barwin.c \ +src/client.c \ +src/config.c \ +src/draw.c \ +src/event.c \ +src/ewmh.c \ +src/frame.c \ +src/getinfo.c \ +src/infobar.c \ +src/init.c \ +src/launcher.c \ +src/layout.c \ +src/menu.c \ +src/mouse.c \ +src/parse/api.c \ +src/parse/parse.c \ +src/screen.c \ +src/status.c \ +src/systray.c \ +src/tag.c \ +src/util.c \ +src/viwmfs.c \ +src/wmfs.c + +# flags +CFLAGS= -Wall -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" +CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" + +# build directory +O?= build diff --git a/config.mk b/config.mk index e17e681..4ccc8d1 100644 --- a/config.mk +++ b/config.mk @@ -10,11 +10,3 @@ PREFIX= /usr/local MANPREFIX= ${PREFIX}/share/man XDG_CONFIG_DIR= /usr/local/etc/xdg/wmfs -# flags -CFLAGS= -Wall -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" -CFLAGS+= $(shell pkg-config --cflags-only-I ${LIBS}) -LDFLAGS= $(shell pkg-config --libs ${LIBS}) -lpthread -CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" - -CC = cc -O = __build__ From 7c9e5602362c8ec576abdd66b414d3824e6cc307 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 16:33:24 +0100 Subject: [PATCH 12/19] BuildSystem: Improve detection of optionals libs --- BSDmakefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index ce1328a..6b17ea0 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -5,8 +5,9 @@ PROG= wmfs MAN1= wmfs.1 .for lib in xrandr xinerama imlib2 -HAVE_${lib:U}!= echo ${LIBS} | grep -q ${lib} && echo -DHAVE_${lib:U} -CFLAGS+= ${HAVE_${lib:U}} +.if !empty(LIBS:M${lib}) +CFLAGS+= -DHAVE_${lib:U} +.endif .endfor CFLAGS_LIB!= pkg-config --cflags-only-I ${LIBS} From 6ac65840c0f3ec86aaddf914bd59f79d62ce4200 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 17:13:34 +0100 Subject: [PATCH 13/19] BuildSystem: pkg-config optional --- BSDmakefile | 13 +++++++++---- Makefile | 18 +++++++++++++----- config.mk | 11 +++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index 6b17ea0..99cfb82 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -10,11 +10,16 @@ CFLAGS+= -DHAVE_${lib:U} .endif .endfor -CFLAGS_LIB!= pkg-config --cflags-only-I ${LIBS} -LDFLAGS_LIB!= pkg-config --libs ${LIBS} +.if !defined(CFLAGS_LIBS) +CFLAGS_LIBS!= pkg-config --cflags-only-I ${LIBS} +.endif -CFLAGS+= ${CFLAGS_LIB} -LDADD+= ${LDFLAGS_LIB} -lpthread +.if !defined(LDFLAGS_LIBS) +LDFLAGS_LIBS!= pkg-config --libs ${LIBS} +.endif + +CFLAGS+= ${CFLAGS_LIBS} +LDADD+= ${LDFLAGS_LIBS} -lpthread install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin diff --git a/Makefile b/Makefile index 057b563..c3086c4 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,27 @@ include common.mk OBJ = ${patsubst %.c,${O}/%.o,${SRCS}} ifneq ($(findstring xrandr, ${LIBS}),) - CFLAGS+= -DHAVE_XRANDR +CFLAGS+= -DHAVE_XRANDR endif ifneq ($(findstring xinerama, ${LIBS}),) - CFLAGS+= -DHAVE_XINERAMA +CFLAGS+= -DHAVE_XINERAMA endif ifneq ($(findstring imlib2, ${LIBS}),) - CFLAGS+= -DHAVE_IMLIB2 +CFLAGS+= -DHAVE_IMLIB2 endif -CFLAGS+= $(shell pkg-config --cflags-only-I ${LIBS}) -LDFLAGS+= $(shell pkg-config --libs ${LIBS}) -lpthread +ifndef CFLAGS_LIBS +CFLAGS_LIBS= $(shell pkg-config --cflags-only-I ${LIBS}) +endif + +ifndef LDFLAGS_LIBS +LDFLAGS_LIBS= $(shell pkg-config --libs ${LIBS}) +endif + +CFLAGS+= ${CFLAGS_LIBS} +LDFLAGS+= ${LDFLAGS_LIBS} -lpthread all: options ${O}/wmfs ${O}/wmfs.1.gz diff --git a/config.mk b/config.mk index 4ccc8d1..c72f8e7 100644 --- a/config.mk +++ b/config.mk @@ -5,6 +5,17 @@ VERSION= 201011 # x11 xft and freetype2 are REQUIRED, others are optionals LIBS= x11 xft freetype2 xrandr xinerama imlib2 + +# If theses variables are defined, make will not call pkg-config +# +# Linux example +# CFLAGS_LIBS= -I/usr/include/freetype2 +# LDFLAGS_LIBS= -lX11 -lXft -lfreetype -lXrandr -lXinerama -lImlib2 +# +# FreeBSD example +# CFLAGS_LIBS= -I/usr/local/include -I/usr/local/include/freetype2 +# LDFLAGS_LIBS= -L/usr/local/lib -lXft -lXrender -lfontconfig -lX11 -lfreetype -lXrandr -lXinerama -lImlib2 + # paths PREFIX= /usr/local MANPREFIX= ${PREFIX}/share/man From 66d1b9b2fb3c402f1c179e1d07ebba97dfb57625 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 17:19:28 +0100 Subject: [PATCH 14/19] BuildSystem: install wmfsrc in XDG_CONFIG_DIR --- BSDmakefile | 5 +++++ Makefile | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/BSDmakefile b/BSDmakefile index 99cfb82..2a502f2 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -30,6 +30,9 @@ install: all @install -m 644 ${.OBJDIR}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions @install -m 644 ${.CURDIR}/wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions + @echo installing default config file to ${DESTDIR}${XDG_CONFIG_DIR} + @mkdir -p ${DESTDIR}${XDG_CONFIG_DIR} + @install -m 444 ${.CURDIR}/wmfsrc ${DESTDIR}${XDG_CONFIG_DIR} uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin @@ -38,6 +41,8 @@ uninstall: @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + @echo removing config file from ${DESTDIR}${XDG_CONFIG_DIR} + @rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfsrc .include diff --git a/Makefile b/Makefile index c3086c4..8286557 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,9 @@ install: all @install -m 644 ${O}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions @install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions + @echo installing default config file to ${DESTDIR}${XDG_CONFIG_DIR} + @mkdir -p ${DESTDIR}${XDG_CONFIG_DIR} + @install -m 444 wmfsrc ${DESTDIR}${XDG_CONFIG_DIR} uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin @@ -68,6 +71,8 @@ uninstall: @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop + @echo removing config file from ${DESTDIR}${XDG_CONFIG_DIR} + @rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfsrc From 9ff9c81441b09ee5b4ba0e3977e997ca038c7e8c Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 18:42:32 +0100 Subject: [PATCH 15/19] BuildSystem: change default MANPREFIX --- config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk b/config.mk index c72f8e7..4783db9 100644 --- a/config.mk +++ b/config.mk @@ -18,6 +18,6 @@ LIBS= x11 xft freetype2 xrandr xinerama imlib2 # paths PREFIX= /usr/local -MANPREFIX= ${PREFIX}/share/man +MANPREFIX= ${PREFIX}/man XDG_CONFIG_DIR= /usr/local/etc/xdg/wmfs From 26dde34d5c0f03944d8adeb430bf96a8ccba91e6 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 18:51:25 +0100 Subject: [PATCH 16/19] BuildSystem: create xsession directory --- BSDmakefile | 5 +++-- Makefile | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index 2a502f2..719071e 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -29,7 +29,8 @@ install: all @mkdir -p ${DESTDIR}${MANPREFIX}/man1 @install -m 644 ${.OBJDIR}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions - @install -m 644 ${.CURDIR}/wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions + @mkdir -p ${DESTDIR}${PREFIX}/share/xsessions + @install -m 644 ${.CURDIR}/wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions/ @echo installing default config file to ${DESTDIR}${XDG_CONFIG_DIR} @mkdir -p ${DESTDIR}${XDG_CONFIG_DIR} @install -m 444 ${.CURDIR}/wmfsrc ${DESTDIR}${XDG_CONFIG_DIR} @@ -39,7 +40,7 @@ uninstall: @rm -f ${DESTDIR}${PREFIX}/bin/wmfs @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 @rm -f ${DESTDIR}${MANPREFIX}/man1/wmfs.1.gz - @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions + @echo removing xsession file from ${DESTDIR}${PREFIX}/share/xsessions/ @rm -f ${DESTDIR}${PREFIX}/share/xsessions/wmfs.desktop @echo removing config file from ${DESTDIR}${XDG_CONFIG_DIR} @rm -f ${DESTDIR}${XDG_CONFIG_DIR}/wmfsrc diff --git a/Makefile b/Makefile index 8286557..2a623a0 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,8 @@ install: all @mkdir -p ${DESTDIR}${MANPREFIX}/man1 @install -m 644 ${O}/wmfs.1.gz ${DESTDIR}${MANPREFIX}/man1/ @echo installing xsession file to ${DESTDIR}${PREFIX}/share/xsessions - @install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions + @mkdir -p ${DESTDIR}${PREFIX}/share/xsessions + @install -m 644 wmfs.desktop ${DESTDIR}${PREFIX}/share/xsessions/ @echo installing default config file to ${DESTDIR}${XDG_CONFIG_DIR} @mkdir -p ${DESTDIR}${XDG_CONFIG_DIR} @install -m 444 wmfsrc ${DESTDIR}${XDG_CONFIG_DIR} From c3cf9d64b3accefd25c4a13c7a9f514c5a83ed38 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 19:27:09 +0100 Subject: [PATCH 17/19] BuildSystem: CFLAGS and LDFLAGS can be customised through command line --- common.mk | 4 +++- config.mk | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common.mk b/common.mk index 2a6dd8e..3799f9f 100644 --- a/common.mk +++ b/common.mk @@ -24,8 +24,10 @@ src/viwmfs.c \ src/wmfs.c # flags -CFLAGS= -Wall -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" +CFLAGS+= ${C_FLAGS} +CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\" CFLAGS+= -DWMFS_VERSION=\"${VERSION}\" +LDFLAGS+= ${LD_FLAGS} # build directory O?= build diff --git a/config.mk b/config.mk index 4783db9..f1fb029 100644 --- a/config.mk +++ b/config.mk @@ -21,3 +21,7 @@ PREFIX= /usr/local MANPREFIX= ${PREFIX}/man XDG_CONFIG_DIR= /usr/local/etc/xdg/wmfs + +# CFLAGS LDFLAGS can be customised here +C_FLAGS= -Wall +LD_FLAGS="" From f6ad74273cc6de35493c719ffed25804db9426fa Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 11 Nov 2010 22:36:42 +0100 Subject: [PATCH 18/19] BuildSystem: fix empty LD_FLAGS cause empty real arg --- config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk b/config.mk index f1fb029..739dfdb 100644 --- a/config.mk +++ b/config.mk @@ -24,4 +24,4 @@ XDG_CONFIG_DIR= /usr/local/etc/xdg/wmfs # CFLAGS LDFLAGS can be customised here C_FLAGS= -Wall -LD_FLAGS="" +LD_FLAGS= From 01bd4cc26519744be08831973f252a171fd7760f Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Fri, 12 Nov 2010 18:14:31 +0100 Subject: [PATCH 19/19] BuildSystem: set HAVE_IMLIB instead of HAVE_IMLIB --- BSDmakefile | 6 +++++- Makefile | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BSDmakefile b/BSDmakefile index 719071e..aced1b8 100644 --- a/BSDmakefile +++ b/BSDmakefile @@ -4,12 +4,16 @@ PROG= wmfs MAN1= wmfs.1 -.for lib in xrandr xinerama imlib2 +.for lib in xrandr xinerama .if !empty(LIBS:M${lib}) CFLAGS+= -DHAVE_${lib:U} .endif .endfor +.if !empty(LIBS:Mimlib2) +CFLAGS+= -DHAVE_IMLIB +.endif + .if !defined(CFLAGS_LIBS) CFLAGS_LIBS!= pkg-config --cflags-only-I ${LIBS} .endif diff --git a/Makefile b/Makefile index 2a623a0..508bb71 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ CFLAGS+= -DHAVE_XINERAMA endif ifneq ($(findstring imlib2, ${LIBS}),) -CFLAGS+= -DHAVE_IMLIB2 +CFLAGS+= -DHAVE_IMLIB endif ifndef CFLAGS_LIBS