summaryrefslogtreecommitdiff
path: root/src/GNUmakefile
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-09-13 17:05:54 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-09-13 17:05:54 +0200
commit6627513d260e807f99fd02cc6571601d794437de (patch)
tree0a434b98f24af212671f952ee211a2382f223c2c /src/GNUmakefile
downloadbiruda-6627513d260e807f99fd02cc6571601d794437de.tar.gz
biruda-6627513d260e807f99fd02cc6571601d794437de.tar.bz2
added command line and config parsing
Diffstat (limited to 'src/GNUmakefile')
-rw-r--r--src/GNUmakefile42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile
new file mode 100644
index 0000000..cd74947
--- /dev/null
+++ b/src/GNUmakefile
@@ -0,0 +1,42 @@
+.PHONY: all clean install
+
+all: biruda
+
+CFLAGS = -g -std=c99 -Wall -pedantic
+LDFLAGS =
+LIBS = -lconfuse
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+biruda: biruda.o biruda_cmdline.o
+ $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
+
+biruda_cmdline.o: biruda_cmdline.c
+biruda.o: biruda.c biruda_cmdline.h
+
+biruda_cmdline.c: biruda.ggo
+ gengetopt -F biruda_cmdline --unamed-opts --conf-parser --include-getopt -i $<
+
+biruda_cmdline.h: biruda.ggo
+ gengetopt -F biruda_cmdline --unamed-opts --conf-parser --include-getopt -i $<
+
+clean:
+ @-rm *.o
+ @-rm biruda
+ @-rm biruda_cmdline.[ch]
+
+# default values
+DESTDIR ?=
+prefix ?= /usr
+
+# standard directories following FHS
+execdir=$(prefix)
+sbindir=$(execdir)/sbin
+sysconfdir=$(execdir)/etc
+
+install:
+ @test -d $(DESTDIR)$(sbindir) || install -d -m 0755 $(DESTDIR)$(sbindir)
+ install -m 0775 biruda $(DESTDIR)$(sbindir)
+ @test -d $(DESTDIR)$(sysconfdir)/biruda || install -d -m 0755 $(DESTDIR)$(sysconfdir)/biruda
+ install -m 0644 biruda.conf $(DESTDIR)$(sysconfdir)/biruda