--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,8 @@
 BINDIR?=$(PREFIX)/bin
 MANDIR?=$(PREFIX)/share/man
 PCDIR?=$(PREFIX)/share/pkgconfig
-OUTDIR=.build
-HOST_SCDOC=./scdoc
+OUTDIR?=.build
+HOST_SCDOC?=$(OUTDIR)/scdoc
 .DEFAULT_GOAL=all
 
 OBJECTS=\
@@ -25,29 +25,29 @@
 	@mkdir -p $(OUTDIR)
 	$(CC) -std=c99 -pedantic -c -o $@ $(CFLAGS) $(MAINFLAGS) $(INCLUDE) $<
 
-scdoc: $(OBJECTS)
+$(OUTDIR)/scdoc: $(OBJECTS)
 	$(CC) $(LDFLAGS) -o $@ $^
 
-scdoc.1: scdoc.1.scd $(HOST_SCDOC)
+$(OUTDIR)/scdoc.1: scdoc.1.scd $(HOST_SCDOC)
 	$(HOST_SCDOC) < $< > $@
 
-scdoc.5: scdoc.5.scd $(HOST_SCDOC)
+$(OUTDIR)/scdoc.5: scdoc.5.scd $(HOST_SCDOC)
 	$(HOST_SCDOC) < $< > $@
 
-scdoc.pc: scdoc.pc.in
+$(OUTDIR)/scdoc.pc: scdoc.pc.in
 	sed -e 's:@prefix@:$(PREFIX):g' -e 's:@version@:$(VERSION):g' < $< > $@
 
-all: scdoc scdoc.1 scdoc.5 scdoc.pc
+all: $(OUTDIR)/scdoc $(OUTDIR)/scdoc.1 $(OUTDIR)/scdoc.5 $(OUTDIR)/scdoc.pc
 
 clean:
-	rm -rf $(OUTDIR) scdoc scdoc.1 scdoc.5 scdoc.pc
+	rm -rf $(OUTDIR)
 
 install: all
 	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(MANDIR)/man5 $(DESTDIR)$(PCDIR)
-	install -m755 scdoc $(DESTDIR)$(BINDIR)/scdoc
-	install -m644 scdoc.1 $(DESTDIR)$(MANDIR)/man1/scdoc.1
-	install -m644 scdoc.5 $(DESTDIR)$(MANDIR)/man5/scdoc.5
-	install -m644 scdoc.pc $(DESTDIR)$(PCDIR)/scdoc.pc
+	install -m755 $(OUTDIR)/scdoc $(DESTDIR)$(BINDIR)/scdoc
+	install -m644 $(OUTDIR)/scdoc.1 $(DESTDIR)$(MANDIR)/man1/scdoc.1
+	install -m644 $(OUTDIR)/scdoc.5 $(DESTDIR)$(MANDIR)/man5/scdoc.5
+	install -m644 $(OUTDIR)/scdoc.pc $(DESTDIR)$(PCDIR)/scdoc.pc
 
 uninstall:
 	rm -f $(DESTDIR)$(BINDIR)/scdoc
