commit
177fc30484
@ -15,7 +15,7 @@ addons:
|
|||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: false
|
sudo: false
|
||||||
language: c
|
language: c
|
||||||
script: make && make test
|
script: CFLAGS=-Werror make all dunstify test
|
||||||
compiler:
|
compiler:
|
||||||
- gcc
|
- gcc
|
||||||
- clang
|
- clang
|
||||||
|
80
Makefile
80
Makefile
@ -3,14 +3,36 @@
|
|||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
CFLAGS += -I.
|
VERSION := "1.2.0-non-git"
|
||||||
LDFLAGS += -L.
|
ifneq ($(wildcard ./.git/.),)
|
||||||
|
VERSION := $(shell git describe --tags)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIBS := $(shell pkg-config --libs ${pkg_config_packs})
|
||||||
|
INCS := $(shell pkg-config --cflags ${pkg_config_packs})
|
||||||
|
|
||||||
|
ifneq (clean, $(MAKECMDGOALS))
|
||||||
|
ifeq ($(and $(INCS),$(LIBS)),)
|
||||||
|
$(error "pkg-config failed!")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += -I. ${INCS}
|
||||||
|
LDFLAGS+= -L. ${LIBS}
|
||||||
|
|
||||||
SRC := $(sort $(shell find src/ -name '*.c'))
|
SRC := $(sort $(shell find src/ -name '*.c'))
|
||||||
OBJ := ${SRC:.c=.o}
|
OBJ := ${SRC:.c=.o}
|
||||||
|
TEST_SRC := $(sort $(shell find test/ -name '*.c'))
|
||||||
|
TEST_OBJ := $(TEST_SRC:.c=.o)
|
||||||
|
|
||||||
|
.PHONY: all debug
|
||||||
all: doc dunst service
|
all: doc dunst service
|
||||||
|
|
||||||
|
debug: CFLAGS += ${CFLAGS_DEBUG}
|
||||||
|
debug: LDFLAGS += ${LDFLAGS_DEBUG}
|
||||||
|
debug: CPPFLAGS += ${CPPFLAGS_DEBUG}
|
||||||
|
debug: all
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
${CC} -o $@ -c $< ${CFLAGS}
|
${CC} -o $@ -c $< ${CFLAGS}
|
||||||
|
|
||||||
@ -19,6 +41,29 @@ ${OBJ}: config.mk
|
|||||||
dunst: ${OBJ} main.o
|
dunst: ${OBJ} main.o
|
||||||
${CC} ${CFLAGS} -o $@ ${OBJ} main.o ${LDFLAGS}
|
${CC} ${CFLAGS} -o $@ ${OBJ} main.o ${LDFLAGS}
|
||||||
|
|
||||||
|
dunstify: dunstify.o
|
||||||
|
${CC} ${CFLAGS} -o $@ dunstify.o ${LDFLAGS}
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: test/test
|
||||||
|
cd test && ./test
|
||||||
|
|
||||||
|
test/test: ${OBJ} ${TEST_OBJ}
|
||||||
|
${CC} ${CFLAGS} -o $@ ${TEST_OBJ} ${OBJ} ${LDFLAGS}
|
||||||
|
|
||||||
|
.PHONY: doc
|
||||||
|
doc: docs/dunst.1
|
||||||
|
docs/dunst.1: docs/dunst.pod
|
||||||
|
pod2man --name=dunst -c "Dunst Reference" --section=1 --release=${VERSION} $< > $@
|
||||||
|
|
||||||
|
.PHONY: service
|
||||||
|
service:
|
||||||
|
@sed "s|##PREFIX##|$(PREFIX)|" org.knopwob.dunst.service.in > org.knopwob.dunst.service
|
||||||
|
@sed "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service
|
||||||
|
|
||||||
|
.PHONY: clean clean-dunst clean-dunstify clean-doc clean-tests
|
||||||
|
clean: clean-dunst clean-dunstify clean-doc clean-tests
|
||||||
|
|
||||||
clean-dunst:
|
clean-dunst:
|
||||||
rm -f dunst ${OBJ} main.o
|
rm -f dunst ${OBJ} main.o
|
||||||
rm -f org.knopwob.dunst.service
|
rm -f org.knopwob.dunst.service
|
||||||
@ -31,15 +76,11 @@ clean-dunstify:
|
|||||||
clean-doc:
|
clean-doc:
|
||||||
rm -f docs/dunst.1
|
rm -f docs/dunst.1
|
||||||
|
|
||||||
clean: clean-dunst clean-dunstify clean-doc test-clean
|
clean-tests:
|
||||||
|
rm -f test/test test/*.o
|
||||||
|
|
||||||
doc: docs/dunst.1
|
.PHONY: install install-dunst install-doc install-service uninstall
|
||||||
docs/dunst.1: docs/dunst.pod
|
install: install-dunst install-doc install-service
|
||||||
pod2man --name=dunst -c "Dunst Reference" --section=1 --release=${VERSION} $< > $@
|
|
||||||
|
|
||||||
service:
|
|
||||||
@sed "s|##PREFIX##|$(PREFIX)|" org.knopwob.dunst.service.in > org.knopwob.dunst.service
|
|
||||||
@sed "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service
|
|
||||||
|
|
||||||
install-dunst: dunst doc
|
install-dunst: dunst doc
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||||
@ -56,28 +97,9 @@ install-service: service
|
|||||||
install -m644 org.knopwob.dunst.service ${DESTDIR}${PREFIX}/share/dbus-1/services
|
install -m644 org.knopwob.dunst.service ${DESTDIR}${PREFIX}/share/dbus-1/services
|
||||||
install -Dm644 dunst.systemd.service ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service
|
install -Dm644 dunst.systemd.service ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service
|
||||||
|
|
||||||
install: install-dunst install-doc install-service
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dunst
|
rm -f ${DESTDIR}${PREFIX}/bin/dunst
|
||||||
rm -f ${DESTDIR}${MANPREFIX}/man1/dunst.1
|
rm -f ${DESTDIR}${MANPREFIX}/man1/dunst.1
|
||||||
rm -f ${DESTDIR}${PREFIX}/share/dbus-1/services/org.knopwob.dunst.service
|
rm -f ${DESTDIR}${PREFIX}/share/dbus-1/services/org.knopwob.dunst.service
|
||||||
rm -f ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service
|
rm -f ${DESTDIR}${PREFIX}/lib/systemd/user/dunst.service
|
||||||
rm -rf ${DESTDIR}${PREFIX}/share/dunst
|
rm -rf ${DESTDIR}${PREFIX}/share/dunst
|
||||||
|
|
||||||
test: test/test
|
|
||||||
cd test && ./test
|
|
||||||
|
|
||||||
TEST_SRC := $(shell find test/ -name '*.c')
|
|
||||||
TEST_OBJ := $(TEST_SRC:.c=.o)
|
|
||||||
|
|
||||||
test/test: ${OBJ} ${TEST_OBJ}
|
|
||||||
${CC} ${CFLAGS} -o $@ ${TEST_OBJ} ${OBJ} ${LDFLAGS}
|
|
||||||
|
|
||||||
test-clean:
|
|
||||||
rm -f test/test test/*.o
|
|
||||||
|
|
||||||
dunstify: dunstify.o
|
|
||||||
${CC} ${CFLAGS} -o $@ dunstify.o $(shell pkg-config --libs --cflags glib-2.0 libnotify gdk-3.0)
|
|
||||||
|
|
||||||
.PHONY: all clean dist install uninstall
|
|
||||||
|
43
config.mk
43
config.mk
@ -2,28 +2,28 @@
|
|||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
MANPREFIX = ${PREFIX}/share/man
|
MANPREFIX = ${PREFIX}/share/man
|
||||||
|
|
||||||
VERSION := "1.2.0-non-git"
|
|
||||||
ifneq ($(wildcard ./.git/.),)
|
|
||||||
VERSION := $(shell git describe --tags)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Warning: This is deprecated behavior
|
|
||||||
# uncomment to disable parsing of dunstrc
|
# uncomment to disable parsing of dunstrc
|
||||||
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
||||||
#STATIC= -DSTATIC_CONFIG
|
#STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior
|
||||||
|
|
||||||
PKG_CONFIG:=$(shell which pkg-config)
|
|
||||||
ifeq (${PKG_CONFIG}, ${EMPTY})
|
|
||||||
$(error "Failed to find pkg-config, please make sure it is installed")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS += -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
CPPFLAGS += -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
||||||
CFLAGS += -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${CPPFLAGS}
|
CFLAGS += -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${CPPFLAGS}
|
||||||
|
LDFLAGS += -lm -L${X11LIB}
|
||||||
|
|
||||||
pkg_config_packs := dbus-1 x11 xscrnsaver \
|
CPPFLAGS_DEBUG := -DDEBUG_BUILD
|
||||||
"glib-2.0 >= 2.36" gio-2.0 \
|
CFLAGS_DEBUG := -O0
|
||||||
pangocairo gdk-3.0 xrandr xinerama
|
LDFLAGS_DEBUG :=
|
||||||
|
|
||||||
|
pkg_config_packs := dbus-1 \
|
||||||
|
gio-2.0 \
|
||||||
|
gdk-3.0 \
|
||||||
|
"glib-2.0 >= 2.36" \
|
||||||
|
pangocairo \
|
||||||
|
x11 \
|
||||||
|
xinerama \
|
||||||
|
xrandr \
|
||||||
|
xscrnsaver
|
||||||
|
|
||||||
# check if we need libxdg-basedir
|
# check if we need libxdg-basedir
|
||||||
ifeq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
ifeq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
||||||
@ -32,14 +32,7 @@ else
|
|||||||
$(warning STATIC_CONFIG is deprecated behavior. It will get removed in future releases)
|
$(warning STATIC_CONFIG is deprecated behavior. It will get removed in future releases)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# includes and libs
|
# dunstify also needs libnotify
|
||||||
INCS := $(shell ${PKG_CONFIG} --cflags ${pkg_config_packs})
|
ifneq (,$(findstring dunstify,${MAKECMDGOALS}))
|
||||||
CFLAGS += ${INCS}
|
pkg_config_packs += libnotify
|
||||||
LDFLAGS += -lm -L${X11LIB} -lXss $(shell ${PKG_CONFIG} --libs ${pkg_config_packs})
|
|
||||||
|
|
||||||
# only make this an fatal error when where not cleaning
|
|
||||||
ifneq (clean, $(MAKECMDGOALS))
|
|
||||||
ifeq (${INCS}, ${EMPTY})
|
|
||||||
$(error "pkg-config failed, see errors above")
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user