diff --git a/Makefile b/Makefile
index bfff71e..072cbc6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,18 @@
-LIBSECRET_FLAGS := $(shell pkg-config --cflags --libs libsecret-1)
+LIBSECRET_CFLAGS := $(shell pkg-config --cflags libsecret-1)
+LIBSECRET_LIBS := $(shell pkg-config --libs libsecret-1)
+CXXFLAGS := -O3
+LDFLAGS :=
 
 all: lssecret
 
-lssecret: lssecret.cpp
-	$(CXX) -O3 -o $@ $^ $(LIBSECRET_FLAGS)
+lssecret: lssecret.o
+	$(CXX) -o $@ $(LDFLAGS) $^ $(LIBSECRET_LIBS)
+
+lssecret.o: lssecret.cpp
+	$(CXX) -c -o $@ $(CXXFLAGS) $^ $(LIBSECRET_CFLAGS)
 
 install: lssecret
-	install -Dsm777 $< $(DESTDIR)/bin/$<
+	install -Dm0755 $< $(DESTDIR)/bin/$<
 
 clean:
 	rm -f lssecret
