From 54378a355c31bf2e05fa90100ea3df6fc3ad56a1 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 8 Jan 2018 13:30:44 +0100 Subject: initial commit --- Makefile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e81a83c --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +# udp514-journal - forward syslog from network (udp/514) to journal + +# commands +CC := gcc +MD := markdown +INSTALL := install +RM := rm +CP := cp + +# flags +CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror +CFLAGS += $(shell pkg-config --cflags --libs libsystemd 2>/dev/null) +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.0.1 + +all: udp514-journal README.html + +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}) > $@ + +udp514-journal: udp514-journal.c udp514-journal.h version.h + $(CC) $(CFLAGS) $(LDFLAGS) -o udp514-journal udp514-journal.c + +README.html: README.md + $(MD) README.md > README.html + +install: install-bin install-doc + +install-bin: udp514-journal + $(INSTALL) -D -m0755 udp514-journal $(DESTDIR)/usr/bin/udp514-journal + $(INSTALL) -D -m0644 udp514-journal.service $(DESTDIR)/usr/lib/systemd/system/udp514-journal.service + +install-doc: README.html + $(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/share/doc/udp514-journal/README.md + $(INSTALL) -D -m0644 README.html $(DESTDIR)/usr/share/doc/udp514-journal/README.html + +clean: + $(RM) -f *.o *~ udp514-journal README.html version.h + +distclean: + $(RM) -f *.o *~ udp514-journal README.html version.h config.h + +release: + git archive --format=tar.xz --prefix=udp514-journal-$(VERSION)/ $(VERSION) > udp514-journal-$(VERSION).tar.xz + gpg -ab udp514-journal-$(VERSION).tar.xz -- cgit v1.2.3-70-g09d2