aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-01-08 13:30:44 +0100
committerGravatar Christian Hesse <mail@eworm.de>2018-01-08 13:30:44 +0100
commit54378a355c31bf2e05fa90100ea3df6fc3ad56a1 (patch)
tree9cb21d137c073261164c1e14d746550c1521cc09 /Makefile
downloadudp514-journal-54378a355c31bf2e05fa90100ea3df6fc3ad56a1.tar.gz
udp514-journal-54378a355c31bf2e05fa90100ea3df6fc3ad56a1.tar.zst
initial commit0.0.1
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile48
1 files changed, 48 insertions, 0 deletions
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