summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-02-17 11:33:18 +0100
committerTobias Klauser <tklauser@distanz.ch>2015-02-17 11:33:18 +0100
commit78d5cad8aedf17d8687975c724bd71bbf2186ffe (patch)
treee5ef68e149b4e79c3f8d6e9ce897f8d9812ca837
parent92d5139ae0fd6313a003d5281a667ead44b33c31 (diff)
build: Add and document install target
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--Makefile21
-rw-r--r--README17
2 files changed, 34 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 120bc58..a94ea25 100644
--- a/Makefile
+++ b/Makefile
@@ -7,28 +7,41 @@ OBJS = llmnr.o iface.o socket.o util.o main.o
LIBS = -lpthread
CC = $(CROSS_COMPILE)gcc
+INSTALL = install
CFLAGS ?= -W -Wall -O2
LDFLAGS ?=
-CCQ = @echo -e " CC\t$<" && $(CC)
-LDQ = @echo -e " LD\t$@" && $(CC)
-
ifeq ($(DEBUG), 1)
CFLAGS += -g -DDEBUG
endif
+CCQ = @echo " CC $<" && $(CC)
+LDQ = @echo " LD $@" && $(CC)
+
+prefix ?= /usr/local
+
+BINDIR = $(prefix)/bin
+DESTDIR =
+
all: $(P)
$(P): $(OBJS)
$(LDQ) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+install_$(P): $(P)
+ @echo " INSTALL $(P)"
+ @$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
+ @$(INSTALL) -m 755 $(P) $(BINDIR)/$(P)
+
%.o: %.c %.h
$(CCQ) $(CFLAGS) -o $@ -c $<
%.o: %.c
$(CCQ) $(CFLAGS) -o $@ -c $<
+install: install_$(P)
+
clean:
- @echo -e " CLEAN"
+ @echo " CLEAN"
@rm -f $(OBJS) $(P)
diff --git a/README b/README
index 8415143..f60a984 100644
--- a/README
+++ b/README
@@ -5,6 +5,23 @@ llmnrd is a daemon implementing the Link-Local Multicast Name Resolution (LLMNR)
protocol according to RFC 4795. It currently only supports Linux, as it uses the
netlink kernel interface.
+Installation
+------------
+
+To build and install llmnrd use the following commands:
+
+$ make
+$ sudo make install
+
+By default, the llmnrd binary will be installed to /usr/local/sbin. To install
+the binary to a different installation path, use:
+
+$ make
+$ sudo make prefix=<path> install
+
+License
+-------
+
llmnrd is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, version 2 of the License.