# Acess 2 Applications
# General Makefile
--include ../../../Makefile.cfg
-# satisfying 2 deep applications
-if $(ACESSDIR) == "" then
- -include ../../../../Makefile.cfg
-#endif
-ACESSUSERDIR := $(ACESSDIR)/Usermode
-
-ASFLAGS = -felf
-CPPFLAGS = -I$(ACESSUSERDIR)/include/
-CFLAGS = -fno-stack-protector $(CPPFLAGS)
-LDFLAGS = -T $(ACESSUSERDIR)/Libraries/acess.ld -L $(ACESSUSERDIR)/Libraries -I /Acess/Libs/ld-acess.so -lc
+# Include Usermode Makefile.cfg
+_appsdir := $(dir $(lastword $(MAKEFILE_LIST)))
+include $(_appsdir)../Makefile.cfg
+
+ifeq ($(ARCHDIR),native)
+ ASFLAGS = -felf
+ LDFLAGS :=
+ LIBS := -lacess-native -lc_acess
+else
+ ASFLAGS = -felf
+ LDFLAGS :=
+ LIBS = -lld-acess
+endif
+
+LDFLAGS += -rpath-link $(OUTPUTDIR)Libs # Needed so that dynamic libraries are linked correctly
+CXXFLAGS += -std=gnu++11
+CPPFLAGS +=
+CFLAGS += -Wall
+
+-include $(_appsdir)../common_settings.mk
+
+# Extra-verbose errors!
+#CFLAGS += -Wall -Wextra -Wwrite-strings -Wshadow -Wswitch-default -Wswitch-enum -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wmissing-declarations -Wlogical-op -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wsync-nand -Wunused -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wno-endif-labels -Wshadow -Wunsafe-loop-optimizations -Wbad-function-cast -Wc++-compat -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-declarations -Wnormalized=nfc -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wdisabled-optimization -Woverlength-strings
+
+DIR = Bin
+
+# vim: ft=make