Merge master changes into release candidate branch.
[gitweb.git] / tools / Makefile
index 8e7252e592e1eab9cdacdb12a09ce9cd5ab5528e..779177c5a990fd71d0cacb86dc95d9034f09bfd3 100644 (file)
@@ -1,14 +1,25 @@
+#
+# Make Linus git-tools
+#
 CC=gcc
-CFLAGS=-Wall -O2
-HOME=$(shell echo $$HOME)
+CFLAGS = -O2 -g -Wall
+ALL_CFLAGS = $(CFLAGS)
+INSTALL=install
+prefix=$(HOME)
+bindir=$(prefix)/bin
+# DESTDIR=
 
-PROGRAMS=mailsplit mailinfo
-SCRIPTS=applymbox applypatch
+PROGRAMS=git-mailsplit git-mailinfo
+SCRIPTS=git-applymbox git-applypatch
+
+git-%: %.c
+       $(CC) $(ALL_CFLAGS) -o $@ $(filter %.c,$^)
 
 all: $(PROGRAMS)
 
 install: $(PROGRAMS) $(SCRIPTS)
-       cp -f $(PROGRAMS) $(SCRIPTS) $(HOME)/bin/
+       $(INSTALL) -m755 -d $(dest)$(bindir)
+       $(INSTALL) $(PROGRAMS) $(SCRIPTS) $(DESTDIR)$(bindir)
 
 clean:
        rm -f $(PROGRAMS) *.o