summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2007-05-19 23:05:56 +0200
committerDavid Härdeman <david@hardeman.nu>2007-05-19 23:05:56 +0200
commit1909b3b79e530a6d44bdab41a9e95501fc7f30d4 (patch)
treeaec706c0dd002fc631634587a831099c7c00a84e /Makefile
parentb852f04e1d9c401399b2fab121fa614f0f1ebfbb (diff)
Add (un)install targets
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile48
1 files 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