[Sheepdog] [PATCH 4/5] Makefile: add install target

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Nov 2 18:08:12 CET 2011


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 Makefile           |   10 ++++++++++
 conductor/Makefile |    7 +++++++
 include/Makefile   |   11 +++++++++++
 libacrd/Makefile   |    7 +++++++
 4 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 include/Makefile

diff --git a/Makefile b/Makefile
index af53e53..f43439c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
+PREFIX ?= /usr
+
+export PREFIX
+
 .PHONY:all
 all:
 	$(MAKE) -C libacrd
@@ -11,6 +15,12 @@ clean:
 	$(MAKE) -C test clean
 	$(MAKE) -C lib clean
 
+.PHONY:install
+install:
+	$(MAKE) -C libacrd install
+	$(MAKE) -C conductor install
+	$(MAKE) -C include install
+
 .PHONY:test
 test:
 	$(MAKE) -C libacrd
diff --git a/conductor/Makefile b/conductor/Makefile
index 0f1c512..d4cc692 100644
--- a/conductor/Makefile
+++ b/conductor/Makefile
@@ -1,3 +1,5 @@
+sbindir ?= $(PREFIX)/sbin
+
 CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../include
 CFLAGS += -D_GNU_SOURCE -DNDEBUG
 LIBS += -lpthread -ldb -lcpg
@@ -23,6 +25,11 @@ conductor: $(ACCORD_OBJS)
 clean:
 	rm -f *.[od] $(PROGRAMS)
 
+.PHONY:install
+install: $(PROGRAMS)
+	install -d -m 755 $(DESTDIR)$(sbindir)
+	install -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir)
+
 # support for GNU Flymake
 check-syntax:
 	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
diff --git a/include/Makefile b/include/Makefile
new file mode 100644
index 0000000..2e50dcd
--- /dev/null
+++ b/include/Makefile
@@ -0,0 +1,11 @@
+includedir ?= $(PREFIX)/include
+
+HEADERS = accord.h accord_proto.h
+
+.PHONY:all
+all:
+
+.PHONY:install
+install: $(HEADERS)
+	install -d -m 755 $(DESTDIR)$(includedir)
+	install -m 644 $(HEADERS) $(DESTDIR)$(includedir)
diff --git a/libacrd/Makefile b/libacrd/Makefile
index 35132e7..88ce65f 100644
--- a/libacrd/Makefile
+++ b/libacrd/Makefile
@@ -1,3 +1,5 @@
+libdir ?= $(PREFIX)/lib
+
 CFLAGS += -g -O3 -Wall -Wstrict-prototypes -I../include
 CFLAGS += -D_GNU_SOURCE -DNDEBUG -fPIC
 
@@ -31,6 +33,11 @@ clean:
 	echo $(RANLIB)
 	rm -f *.[od] $(LIBRARIES)
 
+.PHONY:install
+install: $(LIBRARIES)
+	install -d -m 755 $(DESTDIR)$(libdir)
+	install -m 644 $(LIBRARIES) $(DESTDIR)$(libdir)
+
 # support for GNU Flymake
 check-syntax:
 	$(CC) $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
-- 
1.7.1




More information about the sheepdog mailing list