# Acess 2 Libraries
# General Makefile
--include ../../../Makefile.cfg
+_libsdir := $(dir $(lastword $(MAKEFILE_LIST)))
+-include $(_libsdir)../Makefile.cfg
MAKEDEP = $(CC) -M
-ASFLAGS = -felf
-CPPFLAGS = -I../../include/
-CFLAGS = -Wall -fPIC -fno-builtin -fno-stack-protector $(CPPFLAGS)
-LDFLAGS = -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain -x -L.. -lacess
+ifeq ($(ARCHDIR),native)
+ ASFLAGS += -D ARCHDIR=$(ARCHDIR) -D __ASSEMBLER__=1
+ LDFLAGS := -lacess-native
+ #CPPFLAGS := -D SoMain="__attribute__ ((constructor(101))) libacessnative_init"
+ ifeq ($(PLATFORM),windows)
+ else
+ LDFLAGS += -Wl,-init,SoMain
+ CFLAGS += -fPIC
+ CXXFLAGS += -fPIC
+ endif
+else ifneq ($(HOST_ARCH),)
+ ASFLAGS += -D ARCHDIR=$(ARCHDIR) -D __ASSEMBLER__=1
+ #CPPFLAGS := -D SoMain="__attribute__ ((constructor(101))) libacessnative_init"
+ LD := $(CC)
+ ifeq ($(PLATFORM),windows)
+ else
+ LDFLAGS += -Wl,-init,SoMain
+ CFLAGS += -fPIC
+ CXXFLAGS += -fPIC
+ endif
+else
+ CPPFLAGS := -ffreestanding
+ CFLAGS := -fno-stack-protector -fPIC
+ CXXFLAGS := -fno-stack-protector -fPIC
+ LDFLAGS := -I/Acess/Libs/ld-acess.so -lld-acess `$(CC) -print-libgcc-file-name`
+endif
+LDFLAGS += -g -nostdlib -shared -eSoMain -x --no-undefined -L$(OUTPUTDIR)Libs/ --defsym __dso_handle=SoMain
+CXXFLAGS += -std=gnu++11
+
+-include $(_libsdir)../common_settings.mk
+
+# vim: ft=make