X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=Makefile;h=16b444c4e2b63b5058073a43afcbd95f1db772e0;hb=0e752070ac2bed02d0858bbc450ddcee36e3b9b5;hp=a42099d47eb01a02f3ee7a250045696789488c55;hpb=28c4b045d69284d19cdbae01cf6a9e9f91889e04;p=i3%2Fi3 diff --git a/Makefile b/Makefile index a42099d4..16b444c4 100644 --- a/Makefile +++ b/Makefile @@ -1,113 +1,62 @@ -UNAME=$(shell uname) -DEBUG=1 -INSTALL=install -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 -# Check if pkg-config is installed, because without pkg-config, the following -# check for the version of libxcb cannot be done. -ifeq ($(shell which pkg-config 2>/dev/null 1>/dev/null || echo 1),1) -$(error "pkg-config was not found") -endif +SUBDIRS:= -ifeq ($(shell pkg-config --exists xcb-keysyms || echo 1),1) -$(error "pkg-config could not find xcb-keysyms.pc") -endif +ALL_TARGETS = +INSTALL_TARGETS = +CLEAN_TARGETS = +DISTCLEAN_TARGETS = -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 +all: real-all -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 += -lev -LDFLAGS += -L/usr/local/lib -L/usr/pkg/lib +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),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 +real-all: $(ALL_TARGETS) -ifeq ($(UNAME),FreeBSD) -LDFLAGS += -liconv -endif +install: $(INSTALL_TARGETS) -ifeq ($(UNAME),Linux) -CFLAGS += -D_GNU_SOURCE -endif - -ifeq ($(DEBUG),1) -# Extended debugging flags, macros shall be available in gcc -CFLAGS += -gdwarf-2 -CFLAGS += -g3 -else -CFLAGS += -O2 -endif - -# 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 +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 RELEASE-* i3.config i3.desktop pseudo-doc.doxygen i3-${VERSION} - cp -r src include man i3-${VERSION} + 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 - find docs -maxdepth 1 -type f ! -name "*.xcf" -exec cp '{}' i3-${VERSION}/docs \; - 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 + # 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