--- a/config.mk
+++ b/config.mk
@@ -28,8 +28,20 @@
 # It is included by every Makefile
 #
 #
-SYS  := $(shell uname -s)
-ARCH := $(shell uname -m)
+SYS  := Linux
+ifeq (i686,$(findstring i686,$(XBPS_TARGET_MACHINE)))
+ARCH := i386
+else ifeq (x86_64,$(findstring x86_64,$(XBPS_TARGET_MACHINE)))
+ARCH := x86_64
+else ifeq (arm,$(findstring arm,$(XBPS_TARGET_MACHINE)))
+ARCH := arm
+else ifeq (aarch64,$(findstring aarch64,$(XBPS_TARGET_MACHINE)))
+ARCH := arm64
+else ifeq (ppc,$(findstring ppc,$(XBPS_TARGET_MACHINE)))
+ARCH := powerpc
+else ifeq (mips,$(findstring mips,$(XBPS_TARGET_MACHINE)))
+ARCH := mips
+endif
 ifeq (i686,$(findstring i686,$(ARCH)))
 override ARCH=i386
 endif
@@ -116,7 +128,7 @@ AGE=0
 #
 # Where should things (lib, headers, man) go in the end.
 #
-PREFIX?=/usr/local
+PREFIX?=/usr
 LIBDIR=$(PREFIX)/lib
 INCDIR=$(PREFIX)/include
 MANDIR=$(PREFIX)/share/man
@@ -198,7 +210,7 @@ PFMLIBDIR=$(TOPDIR)/lib
 # -Wextra: to enable extra compiler sanity checks (e.g., signed vs. unsigned)
 # -Wno-unused-parameter: to avoid warnings on unused foo(void *this) parameter
 #
-DBG?=-g -Wall -Werror -Wextra -Wno-unused-parameter
+DBG?=-g -Wall -Wextra -Wno-unused-parameter
 
 ifeq ($(SYS),Darwin)
 # older gcc-4.2 does not like -Wextra and some of our initialization code
