--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@
 # $Id: Makefile 236 2007-09-05 20:40:59Z Joerg Mayer $
 
 DESTDIR=
-PREFIX=/usr/local
+PREFIX=/usr
 ETCDIR=/etc/vpnc
 BINDIR=$(PREFIX)/bin
 SBINDIR=$(PREFIX)/sbin
@@ -50,14 +50,11 @@
 #OPENSSLLIBS = -lcrypto
 
 CC=gcc
-CFLAGS ?= -O3 -g
-CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings
-CFLAGS +=  $(shell libgcrypt-config --cflags)
+CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include $(OFLAGS) '-DVERSION="$(shell cat VERSION)"'
 CPPFLAGS += -DVERSION=\"$(VERSION)\" $(OPENSSL_GPL_VIOLATION)
-LDFLAGS ?= -g
-LDFLAGS += $(shell libgcrypt-config --libs) $(OPENSSLLIBS)
+LDFLAGS = -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -lgcrypt -lgpg-error
 
-ifeq ($(shell uname -s), SunOS)
+ifeq ($(OS), SunOS)
 LDFLAGS += -lnsl -lresolv -lsocket
 endif
 ifneq (,$(findstring Apple,$(shell $(CC) --version)))
