]> git.sur5r.net Git - i3/i3/blobdiff - Makefile
explicitly set filenames to $(basename __FILE__)
[i3/i3] / Makefile
index 1ddfb23b06e5deb1545295f692cdbd55a8bdab1c..16b444c4e2b63b5058073a43afcbd95f1db772e0 100644 (file)
--- a/Makefile
+++ b/Makefile
-UNAME=$(shell uname)
-DEBUG=1
-INSTALL=install
-MAKE=make
-GIT_VERSION=$(shell git describe --tags --always)
-VERSION=$(shell git describe --tags --abbrev=0)
+TOPDIR=$(shell pwd)
 
-CFLAGS += -std=c99
-CFLAGS += -pipe
-CFLAGS += -Wall
-CFLAGS += -Wunused
-CFLAGS += -Iinclude
-CFLAGS += -I/usr/local/include
-CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
+include $(TOPDIR)/common.mk
 
-ifeq ($(shell pkg-config --exact-version=0.3.3 xcb-keysyms && echo 1),1)
-# xcb-keysyms fixed API from 0.3.3 to 0.3.4, so for some months, we will
-# have this here. Distributions should upgrade their libxcb in the meantime.
-CFLAGS += -DOLD_XCB_KEYSYMS_API
-endif
+SUBDIRS:=
 
-LDFLAGS += -lm
-LDFLAGS += -lxcb-event
-LDFLAGS += -lxcb-property
-LDFLAGS += -lxcb-keysyms
-LDFLAGS += -lxcb-atom
-LDFLAGS += -lxcb-aux
-LDFLAGS += -lxcb-icccm
-LDFLAGS += -lxcb-xinerama
-LDFLAGS += -lX11
-LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib
+ALL_TARGETS =
+INSTALL_TARGETS =
+CLEAN_TARGETS =
+DISTCLEAN_TARGETS =
 
-ifeq ($(UNAME),NetBSD)
-# We need -idirafter instead of -I to prefer the system’s iconv over GNU libiconv
-CFLAGS += -idirafter /usr/pkg/include
-LDFLAGS += -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/pkg/lib
-endif
+all: real-all
 
-ifeq ($(UNAME),FreeBSD)
-LDFLAGS += -liconv
-endif
+include libi3/libi3.mk
+include src/i3.mk
+include i3-config-wizard/i3-config-wizard.mk
+include i3-msg/i3-msg.mk
+include i3-input/i3-input.mk
+include i3-nagbar/i3-nagbar.mk
+include i3bar/i3bar.mk
+include i3-dump-log/i3-dump-log.mk
+include docs/docs.mk
+include man/man.mk
 
-ifeq ($(UNAME),Linux)
-CFLAGS += -D_GNU_SOURCE
-endif
+real-all: $(ALL_TARGETS)
 
-ifeq ($(DEBUG),1)
-# Extended debugging flags, macros shall be available in gcc
-CFLAGS += -gdwarf-2
-CFLAGS += -g3
-else
-CFLAGS += -O2
-endif
+install: $(INSTALL_TARGETS)
 
-# Don’t print command lines which are run
-.SILENT:
-
-# Always remake the following targets
-.PHONY: install clean dist distclean
-
-# Depend on the object files of all source-files in src/*.c and on all header files
-FILES=$(patsubst %.c,%.o,$(wildcard src/*.c))
-HEADERS=$(wildcard include/*.h)
-
-# Depend on the specific file (.c for each .o) and on all headers
-src/%.o: src/%.c ${HEADERS}
-       echo "CC $<"
-       $(CC) $(CFLAGS) -c -o $@ $<
-
-all: ${FILES}
-       echo "LINK i3"
-       $(CC) -o i3 ${FILES} $(LDFLAGS)
-
-install: all
-       echo "INSTALL"
-       $(INSTALL) -d -m 0755 $(DESTDIR)/usr/bin
-       $(INSTALL) -d -m 0755 $(DESTDIR)/etc/i3
-       $(INSTALL) -d -m 0755 $(DESTDIR)/usr/share/xsessions
-       $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/
-       test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config
-       $(INSTALL) -m 0644 i3.desktop $(DESTDIR)/usr/share/xsessions/
-
-dist: clean
-       [ ! -f i3-${VERSION} ] || rm -rf i3-${VERSION}
+dist: distclean
+       [ ! -d i3-${VERSION} ] || rm -rf i3-${VERSION}
        [ ! -e i3-${VERSION}.tar.bz2 ] || rm i3-${VERSION}.tar.bz2
        mkdir i3-${VERSION}
-       cp DEPENDS GOALS LICENSE PACKAGE-MAINTAINER TODO i3.config i3-${VERSION}
-       cp -r src include docs man i3-${VERSION}
-       sed -e 's/^GIT_VERSION=\(.*\)/GIT_VERSION=${GIT_VERSION}/g;s/^VERSION=\(.*\)/VERSION=${VERSION}/g' Makefile > i3-${VERSION}/Makefile
-       tar cf i3-${VERSION}.tar i3-${VERSION}
-       bzip2 -9 i3-${VERSION}.tar
+       cp i3-migrate-config-to-v4 generate-command-parser.pl i3-sensible-* i3.config.keycodes DEPENDS LICENSE PACKAGE-MAINTAINER RELEASE-NOTES-${VERSION} i3.config i3.xsession.desktop i3.applications.desktop pseudo-doc.doxygen common.mk Makefile i3-${VERSION}
+       cp -r src libi3 i3-msg i3-nagbar i3-config-wizard i3bar i3-dump-log yajl-fallback include man parser-specs i3-${VERSION}
+       # Only copy toplevel documentation (important stuff)
+       mkdir i3-${VERSION}/docs
+       # Pre-generate documentation
+       $(MAKE) docs
+       # Cleanup τεχ output files
+       find docs -regex ".*\.\(aux\|out\|log\|toc\|bm\|dvi\|log\)" -exec rm '{}' \;
+       find docs -maxdepth 1 -type f ! \( -name "*.xcf" -or -name "*.svg" \) -exec cp '{}' i3-${VERSION}/docs \;
+       # Only copy source code from i3-input
+       mkdir i3-${VERSION}/i3-input
+       find i3-input -maxdepth 1 -type f \( -name "*.c" -or -name "*.mk" -or -name "*.h" -or -name "Makefile" \) -exec cp '{}' i3-${VERSION}/i3-input \;
+       echo -n ${I3_VERSION} > i3-${VERSION}/I3_VERSION
+       echo -n ${VERSION} > i3-${VERSION}/VERSION
+       # Pre-generate a manpage to allow distributors to skip this step and save some dependencies
+       $(MAKE) mans
+       cp man/*.1 i3-${VERSION}/man/
+       tar cfj i3-${VERSION}.tar.bz2 i3-${VERSION}
        rm -rf i3-${VERSION}
 
-clean:
-       rm -f src/*.o
-       $(MAKE) -C docs clean
-       $(MAKE) -C man clean
+clean: $(CLEAN_TARGETS)
+       (which lcov >/dev/null 2>&1 && lcov -d . --zerocounters) || true
+
+distclean: clean $(DISTCLEAN_TARGETS)
 
-distclean: clean
-       rm -f i3
+coverage:
+       rm -f /tmp/i3-coverage.info
+       rm -rf /tmp/i3-coverage
+       lcov -d . -b . --capture -o /tmp/i3-coverage.info
+       genhtml -o /tmp/i3-coverage/ /tmp/i3-coverage.info