Add make install and uninstall targets.

It accepts a prefix= parameter (default: /usr/local).

Signed-off-by: Steve Frécinaux <code@istique.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Steve Frécinaux 2008-12-30 12:10:00 +01:00 committed by Shawn O. Pearce
parent 3d3552e8fd
commit 5ddbd5edf8

View File

@ -2,6 +2,8 @@ all::
DOXYGEN = doxygen DOXYGEN = doxygen
prefix=/usr/local
CFLAGS = -g -O2 -Wall CFLAGS = -g -O2 -Wall
OS = unix OS = unix
@ -44,6 +46,21 @@ install-headers: $(PUBLIC_HEADERS)
@mkdir -p /tmp/gitinc/git @mkdir -p /tmp/gitinc/git
@for i in $^; do cat .HEADER $$i > /tmp/gitinc/$${i##src/}; done @for i in $^; do cat .HEADER $$i > /tmp/gitinc/$${i##src/}; done
install: $(GIT_LIB) $(PUBLIC_HEADERS)
@mkdir -p $(prefix)/include/git
@for i in $(PUBLIC_HEADERS); do \
cat .HEADER $$i > $(prefix)/include/$${i##src/}; \
done
@mkdir -p $(prefix)/lib
@cp -f $(GIT_LIB) $(prefix)/lib/libgit2.a
uninstall:
@rm -f $(prefix)/lib/libgit2.a
@for i in $(PUBLIC_HEADERS); do \
rm -f $(prefix)/include/$${i##src/}; \
done
@rmdir $(prefix)/include/git
.c.o: .c.o:
$(CC) $(ALL_CFLAGS) -c $< -o $@ $(CC) $(ALL_CFLAGS) -c $< -o $@
@ -93,4 +110,5 @@ $(TEST_RUN): tests/%.run: tests/%.exe
.PHONY: test $(TEST_RUN) .PHONY: test $(TEST_RUN)
.PHONY: apidocs .PHONY: apidocs
.PHONY: install-headers .PHONY: install-headers
.PHONY: install uninstall
.PHONY: sparse .PHONY: sparse