--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,20 @@
 DESTDIR=
 CC=gcc
-CFLAGS=-O2 -Wall -W -pipe -D_GNU_SOURCE
+CFLAGS_ALL=$(CFLAGS) -Wall -W -pipe -D_GNU_SOURCE
 MANDIR=/usr/share/man/man8
 SBINDIR=/sbin
 
 all:		mingetty
 
 install:	all
-		install -m 0755 mingetty $(DESTDIR)$(SBINDIR)
-		install -m 0644 mingetty.8 $(DESTDIR)$(MANDIR)
+		install -D -m 0755 mingetty -t $(DESTDIR)$(SBINDIR)
+		install -D -m 0644 mingetty.8 -t $(DESTDIR)$(MANDIR)
 
 mingetty:	mingetty.o
+	$(CC) $(CFLAGS_ALL) $(LDFLAGS) -o $@ $< $(LDLIBS)
 
+%.o:		%.c
+	$(CC) $(CFLAGS_ALL) -c -o $@ $<
+
 clean:
 		rm -f *.o mingetty
-
