diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 38 |
1 files changed, 20 insertions, 18 deletions
@@ -8,38 +8,39 @@ CP := cp RM := rm # flags -CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror -ifneq ($(wildcard /usr/include/iniparser),) -CFLAGS += -I/usr/include/iniparser -endif -CFLAGS += -liniparser -CFLAGS_SYSTEMD := $(shell pkg-config --cflags --libs libsystemd 2>/dev/null) +CFLAGS_EXTRA += -std=c11 -O2 -fPIC -Wall -Werror +CFLAGS_EXTRA += $(shell pkg-config --cflags --libs iniparser) +CFLAGS_SYSTEMD := $(shell pkg-config --cflags --libs libsystemd 2>/dev/null) ifneq ($(CFLAGS_SYSTEMD),) -CFLAGS += -DHAVE_SYSTEMD $(CFLAGS_SYSTEMD) +CFLAGS_EXTRA += -DHAVE_SYSTEMD $(CFLAGS_SYSTEMD) endif -CFLAGS += $(shell pkg-config --cflags --libs libmpdclient) -CFLAGS += $(shell pkg-config --cflags --libs libnotify) -CFLAGS_LIBAV := $(shell pkg-config --cflags --libs libavformat libavutil 2>/dev/null) +CFLAGS_EXTRA += $(shell pkg-config --cflags --libs libmpdclient) +CFLAGS_EXTRA += $(shell pkg-config --cflags --libs libnotify) +CFLAGS_LIBAV := $(shell pkg-config --cflags --libs libavformat libavutil 2>/dev/null) ifneq ($(CFLAGS_LIBAV),) -CFLAGS += -DHAVE_LIBAV $(CFLAGS_LIBAV) -CFLAGS += -lmagic +CFLAGS_EXTRA += -DHAVE_LIBAV $(CFLAGS_LIBAV) +CFLAGS_MAGIC := $(shell pkg-config --cflags --libs libmagic 2>/dev/null) +ifneq ($(CFLAGS_MAGIC),) +CFLAGS_EXTRA += -DHAVE_MAGIC $(CFLAGS_MAGIC) +endif endif LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie # this is just a fallback in case you do not use git but downloaded # a release tarball... -VERSION := 0.8.5 +DISTVER := 0.9.3 +VERSION ?= $(shell git describe --long 2>/dev/null || echo $(DISTVER)) all: mpd-notification README.html mpd-notification: mpd-notification.c mpd-notification.h config.h version.h - $(CC) $(CFLAGS) $(LDFLAGS) -o mpd-notification mpd-notification.c + $(CC) mpd-notification.c $(CFLAGS) $(CFLAGS_EXTRA) $(LDFLAGS) -o mpd-notification config.h: $(CP) config.def.h config.h version.h: $(wildcard .git/HEAD .git/index .git/refs/tags/*) Makefile - printf "#ifndef VERSION\n#define VERSION \"%s\"\n#endif\n" $(shell git describe --long 2>/dev/null || echo ${VERSION}) > $@ + printf "#ifndef VERSION\n#define VERSION \"%s\"\n#endif\n" "$(VERSION)" > $@ README.html: README.md $(MD) README.md > README.html @@ -50,6 +51,7 @@ install-bin: mpd-notification $(INSTALL) -D -m0755 mpd-notification $(DESTDIR)/usr/bin/mpd-notification ifneq ($(CFLAGS_SYSTEMD),) $(INSTALL) -D -m0644 systemd/mpd-notification.service $(DESTDIR)/usr/lib/systemd/user/mpd-notification.service + $(INSTALL) -D -m0644 systemd/Upholds-mpd-notification.conf $(DESTDIR)/usr/lib/systemd/user/mpd.service.d/Upholds-mpd-notification.conf endif install-doc: README.html @@ -65,6 +67,6 @@ distclean: $(RM) -f *.o *~ README.html mpd-notification version.h config.h release: - git archive --format=tar.xz --prefix=mpd-notification-$(VERSION)/ $(VERSION) > mpd-notification-$(VERSION).tar.xz - gpg --armor --detach-sign --comment mpd-notification-$(VERSION).tar.xz mpd-notification-$(VERSION).tar.xz - git notes --ref=refs/notes/signatures/tar add -C $$(git archive --format=tar --prefix=mpd-notification-$(VERSION)/ $(VERSION) | gpg --armor --detach-sign --comment mpd-notification-$(VERSION).tar | git hash-object -w --stdin) $(VERSION) + git archive --format=tar.xz --prefix=mpd-notification-$(DISTVER)/ $(DISTVER) > mpd-notification-$(DISTVER).tar.xz + gpg --armor --detach-sign --comment mpd-notification-$(DISTVER).tar.xz mpd-notification-$(DISTVER).tar.xz + git notes --ref=refs/notes/signatures/tar add -C $$(git archive --format=tar --prefix=mpd-notification-$(DISTVER)/ $(DISTVER) | gpg --armor --detach-sign --comment mpd-notification-$(DISTVER).tar | git hash-object -w --stdin) $(DISTVER) |