From 1909b3b79e530a6d44bdab41a9e95501fc7f30d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Sat, 19 May 2007 23:05:56 +0200 Subject: Add (un)install targets --- Makefile | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 8f5e1ea..a2581c6 100644 --- a/Makefile +++ b/Makefile @@ -17,30 +17,52 @@ # # Generic settings # -CC = gcc -CFLAGS = -g -Wall -LDFLAGS = -INCLUDES = -COMPILE = $(CC) $(INCLUDES) $(CFLAGS) -LINK = $(CC) $(CFLAGS) $(LDFLAGS) -OBJECTS = utils.o metastore.o metaentry.o -HEADERS = utils.h metastore.h metaentry.h +CC = gcc +CFLAGS = -g -Wall +LDFLAGS = +INCLUDES = +INSTALL = install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +COMPILE = $(CC) $(INCLUDES) $(CFLAGS) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) +OBJECTS = utils.o metastore.o metaentry.o +HEADERS = utils.h metastore.h metaentry.h + +DESTDIR ?= +prefix = /usr +usrbindir = ${prefix}/bin +mandir = ${prefix}/share/man # # Targets # +all: metastore +.DEFAULT: all + + %.o: %.c $(HEADERS) $(COMPILE) -o $@ -c $< + metastore: $(OBJECTS) $(LINK) -o $@ $^ -all: metastore -.PHONY: all -.DEFAULT: all + +install: all + $(INSTALL_DATA) -D metastore.1 $(DESTDIR)$(mandir)/man1/metastore.1 + $(INSTALL_PROGRAM) -D metastore $(DESTDIR)$(usrbindir)/metastore + + +uninstall: + - rm -f $(DESTDIR)$(mandir)/man1/metastore.1 + - rm -f $(DESTDIR)$(usrbindir)/metastore + clean: - rm -f *.o metastore -.PHONY: clean + - rm -f *.o metastore + + +.PHONY: install uninstall clean all -- cgit v1.2.1