--- Makefile.orig	2011-02-24 15:04:41.177936565 +0100
+++ Makefile	2011-02-24 15:07:25.127413480 +0100
@@ -197,25 +197,25 @@ INSTALL=install
 
 ifndef CONFIG_WIN32
 install: $(PROGS) $(LIBTCC1) $(BCHECK_O) libtcc.a tcc.1 tcc-doc.html
-	mkdir -p "$(bindir)"
-	$(INSTALL) -s -m755 $(PROGS) "$(bindir)"
-	mkdir -p "$(mandir)/man1"
-	$(INSTALL) tcc.1 "$(mandir)/man1"
-	mkdir -p "$(tccdir)"
-	mkdir -p "$(tccdir)/include"
+	$(INSTALL) -d "$(DESTDIR)$(bindir)"
+	$(INSTALL) -m755 $(PROGS) "$(DESTDIR)$(bindir)"
+	$(INSTALL) -d "$(DESTDIR)$(mandir)/man1"
+	$(INSTALL) -m644 tcc.1 "$(DESTDIR)$(mandir)/man1"
+	$(INSTALL) -d "$(DESTDIR)$(tccdir)"
+	$(INSTALL) -d "$(DESTDIR)$(tccdir)/include"
 ifneq ($(LIBTCC1),)
-	$(INSTALL) -m644 $(LIBTCC1) "$(tccdir)"
+	$(INSTALL) -m644 $(LIBTCC1) "$(DESTDIR)$(tccdir)"
 endif
 ifneq ($(BCHECK_O),)
-	$(INSTALL) -m644 $(BCHECK_O) "$(tccdir)"
+	$(INSTALL) -m644 $(BCHECK_O) "$(DESTDIR)$(tccdir)"
 endif
-	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(tccdir)/include"
-	mkdir -p "$(docdir)"
-	$(INSTALL) -m644 tcc-doc.html "$(docdir)"
-	mkdir -p "$(libdir)"
-	$(INSTALL) -m644 libtcc.a "$(libdir)"
-	mkdir -p "$(includedir)"
-	$(INSTALL) -m644 libtcc.h "$(includedir)"
+	$(INSTALL) -m644 $(addprefix include/,$(TCC_INCLUDES)) "$(DESTDIR)$(tccdir)/include"
+	$(INSTALL) -d "$(DESTDIR)$(docdir)"
+	$(INSTALL) -m644 tcc-doc.html "$(DESTDIR)$(docdir)"
+	$(INSTALL) -d "$(DESTDIR)$(libdir)"
+	$(INSTALL) -m644 libtcc.a "$(DESTDIR)$(libdir)"
+	$(INSTALL) -d "$(DESTDIR)$(includedir)"
+	$(INSTALL) -m644 libtcc.h "$(DESTDIR)$(includedir)"
 
 uninstall:
 	rm -fv $(foreach P,$(PROGS),"$(bindir)/$P")
