From ec09073087de7e8fc419128186a15a8706e0848c Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 4 Jan 2008 20:49:49 +0100 Subject: [PATCH] switch to autotools as build system --- Makefile | 105 ------------------------- Makefile.am | 108 ++++++++++++++++++++++++++ README | 14 ++-- awesome.doxygen => awesome.doxygen.in | 2 +- config.mk | 29 ------- configure.ac | 79 +++++++++++++++++++ layouts/Makefile-files | 13 ++++ widgets/Makefile-files | 10 +++ 8 files changed, 220 insertions(+), 140 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am rename awesome.doxygen => awesome.doxygen.in (99%) delete mode 100644 config.mk create mode 100644 configure.ac create mode 100644 layouts/Makefile-files create mode 100644 widgets/Makefile-files diff --git a/Makefile b/Makefile deleted file mode 100644 index 8e683c6a..00000000 --- a/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -# awesome -# © 2007-2008 Julien Danjou - -include config.mk - -SRC = focus.c client.c draw.c event.c layout.c awesome.c tag.c util.c xutil.c config.c screen.c statusbar.c uicb.c window.c rules.c mouse.c awesome-client-common.c widget.c ewmh.c -OBJ = ${SRC:.c=.o} ${LAYOUTS:.c=.o} ${WIDGETS:.c=.o} -DOCS = awesome.1.txt awesome-client.1.txt awesomerc.1.txt - -SRCCLIENT = awesome-client.c awesome-client-common.c util.c -OBJCLIENT = ${SRCCLIENT:.c=.o} - -all: options awesome awesome-client - -options: - @echo awesome build options: - @echo "LAYOUTS = ${LAYOUTS}" - @echo "WIDGETS = ${WIDGETS}" - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" - -.c.o: - @echo -e "\t(CC) $<" - @${CC} -c ${CFLAGS} $< -o $@ - -${OBJ}: awesome.h config.mk - -${OBJCLIENT}: config.mk - -man: ${DOCS} - asciidoc -d manpage -b docbook awesome.1.txt - asciidoc -d manpage -b docbook awesome-client.1.txt - asciidoc -d manpage -b docbook awesomerc.1.txt - xmlto man awesome.1.xml - xmlto man awesome-client.1.xml - xmlto man awesomerc.1.xml - -awesome-client: ${OBJCLIENT} - @echo -e "\t(CC) ${OBJCLIENT} -o $@" - @${CC} -o $@ ${OBJCLIENT} ${CLIENTLDFLAGS} - -defconfig.h: awesomerc - @echo generating defconfig.h from awesomerc - @echo "#define AWESOME_DEFAULT_CONFIG \\" > defconfig.h - @echo -n "\"" >> defconfig.h - @sed 's,\\,\\\\,g;s/$$/ \\/;s/"/\\"/g' awesomerc >> defconfig.h - @echo "\"" >> defconfig.h - -awesome: defconfig.h ${OBJ} - @echo -e "\t(CC) ${OBJ} -o $@" - @${CC} -o $@ ${OBJ} ${LDFLAGS} - -clean: - @echo cleaning - @rm -f awesome awesome-client defconfig.h ${DOCS:.txt=} ${DOCS:.txt=.xml} ${OBJCLIENT} ${OBJ} awesome-${VERSION}.tar.gz - @rm -rf doc - -dist: clean - @echo creating dist tarball - @mkdir awesome-${VERSION} - @mkdir awesome-${VERSION}/layouts - @mkdir awesome-${VERSION}/widgets - @mkdir awesome-${VERSION}/icons - @mkdir awesome-${VERSION}/icons/layouts - @cp -fR STYLE LICENSE AUTHORS Makefile README awesomerc config.mk \ - awesome-client.1.txt awesome.1.txt awesomerc.1.txt ${SRCCLIENT} ${SRCCLIENT:.c=.h} ${SRC} ${SRC:.c=.h} \ - awesome-${VERSION} || true - @cp -R ${LAYOUTS} ${LAYOUTS:.c=.h} awesome-${VERSION}/layouts - @cp -R ${WIDGETS} awesome-${VERSION}/widgets - @cp -R icons/layouts/* awesome-${VERSION}/icons/layouts - @tar -cf awesome-${VERSION}.tar awesome-${VERSION} - @gzip -9 awesome-${VERSION}.tar - @rm -rf awesome-${VERSION} - -strip: awesome awesome-client - strip awesome - strip awesome-client - -install: strip install-unstrip - -install-unstrip: awesome awesome-client man - @echo installing executable file to ${DESTDIR}${PREFIX}/bin - @install -d ${DESTDIR}${PREFIX}/bin - @install -m 755 awesome awesome-client ${DESTDIR}${PREFIX}/bin - @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 - @install -d ${DESTDIR}${MANPREFIX}/man1 - @install -m 644 ${DOCS:.txt=} ${DESTDIR}${MANPREFIX}/man1 - @echo installing shared data to ${DESTDIR}${PREFIX}/share - @install -d ${DESTDIR}${PREFIX}/share/awesome/icons/layouts - @install icons/layouts/* ${DESTDIR}${PREFIX}/share/awesome/icons/layouts/ - -uninstall: - @echo removing executable file from ${DESTDIR}${PREFIX}/bin - @rm ${DESTDIR}${PREFIX}/bin/awesome ${DESTDIR}${PREFIX}/bin/awesome-client - @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 - @rm ${DESTDIR}${MANPREFIX}/man1/awesome.1 ${DESTDIR}${MANPREFIX}/man1/awesome-client.1 ${DESTDIR}${MANPREFIX}/man1/awesomerc.1 - @echo removing shared data from ${DESTDIR}${PREFIX}/share - @rm -rf ${DESTDIR}${PREFIX}/share/awesome - -doc: - @echo generating documentation - @doxygen awesome.doxygen - -.PHONY: all options clean dist install uninstall doc man diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..5a95b083 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,108 @@ +BUILT_SOURCES = +CLEANFILES = +EXTRA_DIST = +SUFFIXES = +bin_PROGRAMS = +doc_DATA = +man_MANS = + +LAYOUTS = +WIDGETS = + +include layouts/Makefile-files +include widgets/Makefile-files + +EXTRA_DIST += awesomerc +doc_DATA += awesomerc + +doc_DATA += README + +EXTRA_DIST += LICENSE +doc_DATA += LICENSE + +EXTRA_DIST += STYLE +doc_DATA += STYLE + +CLEANFILES += defconfig.h +BUILT_SOURCES += defconfig.h +defconfig.h: $(srcdir)/awesomerc + @echo "generating defconfig.h from $(srcdir)/awesomerc" + @echo "#define AWESOME_DEFAULT_CONFIG \\" > defconfig.h + @echo -n "\"" >> defconfig.h + @$(SED) 's,\\,\\\\,g;s/$$/ \\/;s/"/\\"/g' "$(srcdir)/awesomerc" >> defconfig.h + @echo "\"" >> defconfig.h + +AM_CPPFLAGS = $(XFT_CFLAGS) $(X_CFLAGS) $(CAIRO_CFLAGS) $(CONFUSE_CFLAGS) $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) + +bin_PROGRAMS += awesome +awesome_SOURCES = \ + client.c client.h \ + focus.c focus.h \ + draw.c draw.h \ + event.c event.h \ + layout.c layout.h \ + awesome.c awesome.h \ + tag.c tag.h \ + util.c util.h \ + xutil.c xutil.h \ + config.c config.h \ + screen.c screen.h \ + statusbar.c statusbar.h \ + uicb.c uicb.h \ + window.c window.h \ + rules.c rules.h \ + mouse.c mouse.h \ + awesome-client-common.c \ + widget.c widget.h \ + ewmh.c ewmh.h +awesome_SOURCES += $(LAYOUTS) +awesome_SOURCES += $(WIDGETS) +awesome_LDADD = $(XFT_LIBS) $(X_LIBS) $(CAIRO_LIBS) $(CONFUSE_LIBS) $(XRANDR_LIBS) $(XINERAMA_LIBS) + +bin_PROGRAMS += awesome-client +awesome_client_SOURCES = \ + awesome-client.c awesome-client.h \ + awesome-client-common.c \ + util.c util.h + +EXTRA_DIST += awesome.1.txt +man_MANS += awesome.1 + +EXTRA_DIST += awesome-client.1.txt +man_MANS += awesome-client.1 + +EXTRA_DIST += awesomerc.1.txt +man_MANS += awesomerc.1 + +clean-local: + rm -f awesome*.1 awesome*.1.xml + +SUFFIXES += .1.xml .1 +if HAVE_XMLTO +.1.xml.1: + $(XMLTO) man $< +endif + +SUFFIXES += .1.txt .1.xml +if HAVE_ASCIIDOC +.1.txt.1.xml: + $(ASCIIDOC) -d manpage -b docbook -o $@ $< +endif + +EXTRA_DIST += awesome.doxygen.in + +# Workaround for buggy pre-1.5.3 doxygen. +# +# Some pre-1.5.3 versions of doxygen segfault on reading these lines. +# Call make with DOXYGEN_SEGFAULT=-segfault as a workaround. +CLEANFILES += awesome.doxygen-segfault +awesome.doxygen-segfault: awesome.doxygen + $(SED) '/^QT_AUTOBRIEF/d; /^EXTRACT_ANON_NSPACES/d; /^HTML_DYNAMIC_SECTIONS/d' \ + < awesome.doxygen > awesome.doxygen-segfault + +if HAVE_DOXYGEN +doc: doc/html/index.html + +doc/html/index.html: awesome.doxygen$(DOXYGEN_SEGFAULT) $(awesome_SOURCES) $(awesome_client_SOURCES) + $(DOXYGEN) awesome.doxygen$(DOXYGEN_SEGFAULT) +endif diff --git a/README b/README index eefc9e79..0808e821 100644 --- a/README +++ b/README @@ -12,13 +12,17 @@ tools. Installation ------------ -Edit config.mk to match your local setup (awesome is installed into -the /usr/local namespace by default). +If building from git sources, run "autoreconf -vis .". When autoreconf has +finished, you can follow the following instructions for building a dist +tarball. -Afterwards enter the following command to build and install awesome (if -necessary as root): +After extracting the dist tarball, run "./configure --help" and figure out +what you might want to adapt for your system. Then run ./configure with the +proper parameters, and build and install: - make install + ./configure [...] + make + make install # might need root permissions Running awesome ----------- diff --git a/awesome.doxygen b/awesome.doxygen.in similarity index 99% rename from awesome.doxygen rename to awesome.doxygen.in index 9a356abb..b976dc4b 100644 --- a/awesome.doxygen +++ b/awesome.doxygen.in @@ -80,7 +80,7 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = . +INPUT = @top_srcdir@ @top_builddir@ INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c \ *.h \ diff --git a/config.mk b/config.mk deleted file mode 100644 index ea12cb26..00000000 --- a/config.mk +++ /dev/null @@ -1,29 +0,0 @@ -# awesome version -VERSION = $$(git describe 2>/dev/null || echo devel) -RELEASE = "Productivity Breaker" - -# Customize below to fit your system - -# additional layouts -LAYOUTS = layouts/tile.c layouts/floating.c layouts/max.c layouts/fibonacci.c -# additional widgets -WIDGETS = widgets/taglist.c widgets/layoutinfo.c widgets/textbox.c widgets/focustitle.c widgets/iconbox.c widgets/netwmicon.c widgets/progressbar.c widgets/tasklist.c - -# paths -PREFIX = /usr/local -MANPREFIX = ${PREFIX}/share/man - -X11INC = /usr/include/X11 -X11LIB = /usr/lib/X11 - -# includes and libs -INCS = -I. -I/usr/include -I${X11INC} `pkg-config --cflags libconfuse xft cairo` -LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 `pkg-config --libs libconfuse xft cairo` -lXext -lXrandr -lXinerama - -# flags -CFLAGS = -std=gnu99 -ggdb3 -pipe -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wsign-compare -Wunused -Winit-self -Wpointer-arith -Wredundant-decls -Wmissing-prototypes -Wmissing-format-attribute -Wmissing-noreturn -O3 ${INCS} -DVERSION=\"${VERSION}\" -DRELEASE=\"${RELEASE}\" -LDFLAGS = -ggdb3 ${LIBS} -CLIENTLDFLAGS = -ggdb3 - -# compiler and linker -CC = cc diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..00d7aae3 --- /dev/null +++ b/configure.ac @@ -0,0 +1,79 @@ +# -*- Autoconf -*- +# Process this file with autoreconf to produce a configure script. + +AC_PREREQ(2.61) +dnl Each time you want an updated version number for your build, you need to +dnl (re-)run autoreconf. +AC_INIT([awesome window manager], + [m4_esyscmd([{ git describe 2>/dev/null || echo devel; } | tr -d '\n'])], + [http://awesome.naquadah.org/bugs/], + [awesome]) +AC_CONFIG_AUX_DIR([auto-aux]) +AC_CONFIG_SRCDIR([awesome.c]) +dnl The AC_CONFIG_HEADER and awesome's own config.h are different beasts +dnl AC_CONFIG_HEADER([config.h]) +dnl Other options: +dnl check-news to check that NEWS has been adapted to current version +dnl std-options make sure shipped executables understand --help and --version +AM_INIT_AUTOMAKE([-Wall -Werror 1.10 dist-bzip2 foreign filename-length-max=99 foreign subdir-objects]) + +AC_DEFINE_UNQUOTED([RELEASE], ["Productivity Breaker"]) + +# Checks for programs. +AC_PROG_SED +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_INSTALL + +AC_ARG_VAR([ASCIIDOC], [asciidoc doc generation tool]) +AC_ARG_VAR([XMLTO], [xmlto converter from xml to other formats]) +AC_ARG_VAR([DOXYGEN], [doxygen source documentation system]) + +test "x$ASCIIDOC" = "x" && AC_PATH_PROG([ASCIIDOC], [asciidoc], [:]) +test "x$XMLTO" = "x" && AC_PATH_PROG([XMLTO], [xmlto], [:]) +test "x$DOXYGEN" = "x" && AC_PATH_PROG([DOXYGEN], [doxygen], [:]) + +test "x$ASCIIDOC" = "x:" && AC_MSG_WARN([awesome requires asciidoc]) +test "x$XMLTO" = "x:" && AC_MSG_WARN([awesome requires xmlto]) +test "x$DOXYGEN" = "x:" && AC_MSG_WARN([awesome requires doxygen]) + +AM_CONDITIONAL([HAVE_ASCIIDOC], [test "x$ASCIIDOC" != "x:"]) +AM_CONDITIONAL([HAVE_XMLTO], [test "x$XMLTO" != "x:"]) +AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "x:"]) + +# Checks for libraries. +AC_PATH_XTRA +PKG_CHECK_MODULES([CAIRO], [cairo],, + [AC_MSG_ERROR([awesome requires cairo.])]) +PKG_CHECK_MODULES([CONFUSE], [libconfuse >= 2.6],, + [AC_MSG_ERROR([awesome requires libconfuse >= 2.6.])]) +PKG_CHECK_MODULES([XFT], [xft],, + [AC_MSG_ERROR([awesome requires xft.])]) +PKG_CHECK_MODULES([XINERAMA], [xinerama],, + [AC_MSG_ERROR([awesome requires Xinerama.])]) +PKG_CHECK_MODULES([XRANDR], [xrandr],, + [AC_MSG_ERROR([awesome requires Xrandr.])]) + +# Checks for header files. +AC_PATH_X +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([fcntl.h limits.h locale.h stdlib.h string.h sys/socket.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T + +# Checks for library functions. +AC_FUNC_FORK +AC_FUNC_REALLOC +AC_FUNC_SELECT_ARGTYPES +AC_TYPE_SIGNAL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([memchr regcomp select setenv socket strchr strrchr strstr]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([awesome.doxygen]) +AC_OUTPUT diff --git a/layouts/Makefile-files b/layouts/Makefile-files new file mode 100644 index 00000000..be2de0e6 --- /dev/null +++ b/layouts/Makefile-files @@ -0,0 +1,13 @@ +# -*- Makefile -*- + +LAYOUTS += layouts/tile.c +LAYOUTS += layouts/tile.h + +LAYOUTS += layouts/floating.c +LAYOUTS += layouts/floating.h + +LAYOUTS += layouts/max.c +LAYOUTS += layouts/max.h + +LAYOUTS += layouts/fibonacci.c +LAYOUTS += layouts/fibonacci.h diff --git a/widgets/Makefile-files b/widgets/Makefile-files new file mode 100644 index 00000000..43fb4e24 --- /dev/null +++ b/widgets/Makefile-files @@ -0,0 +1,10 @@ +# -*- Makefile -*- + +WIDGETS += widgets/taglist.c +WIDGETS += widgets/layoutinfo.c +WIDGETS += widgets/textbox.c +WIDGETS += widgets/focustitle.c +WIDGETS += widgets/iconbox.c +WIDGETS += widgets/netwmicon.c +WIDGETS += widgets/progressbar.c +WIDGETS += widgets/tasklist.c