2009-08-01 14:21:58 +00:00
|
|
|
.SUFFIXES: .S .c
|
|
|
|
|
|
|
|
SOURCEPATH=../../source/common
|
|
|
|
SSLPATH=../../source/openssl/include
|
|
|
|
MALLOC_PATH=../../source/common/malloc
|
|
|
|
XOR_PATH=../../source/common/crypto
|
|
|
|
STDLIBPATH=../../source/common/stdlib
|
2010-06-10 06:10:15 +00:00
|
|
|
ZLIB_PATH=../../source/common/zlib
|
2009-08-01 14:21:58 +00:00
|
|
|
|
2010-08-26 05:16:27 +00:00
|
|
|
|
|
|
|
CFLAGS=-nostdinc -nostdlib
|
|
|
|
CFLAGS+= -I ../../source/bionic/libc/include -I ../../source/bionic/libc/kernel/common/linux/ -I ../../source/bionic/libc/kernel/common/
|
|
|
|
CFLAGS+= -I ../../source/bionic/libc/arch-x86/include/
|
|
|
|
CFLAGS+= -I ../../source/bionic/libc/kernel/arch-x86/
|
|
|
|
CFLAGS+= -Dwchar_t="char" -fno-builtin -D_SIZE_T_DECLARED -DElf_Size="u_int32_t" -D_BYTE_ORDER=_LITTLE_ENDIAN
|
|
|
|
CFLAGS+= -lgcc -L../../source/bionic/compiled
|
|
|
|
|
|
|
|
CFLAGS+= -D_UNIX -I$(SOURCEPATH) -I$(MALLOC_PATH) -I$(XOR_PATH) -DMALLOC_PRODUCTION -DPIC -I$(SSLPATH) -I$(STDLIBPATH) -I$(ZLIB_PATH)
|
2009-08-01 14:21:58 +00:00
|
|
|
CFLAGS+= -g -fPIC -Os -D_POSIX_C_SOURCE=200809 -D__BSD_VISIBLE=1 -D__XSI_VISIBLE=1
|
|
|
|
|
2012-01-27 22:14:47 +00:00
|
|
|
CFLAGS+= -march=i386 -m32
|
2012-01-23 22:13:10 +00:00
|
|
|
|
2009-08-01 14:21:58 +00:00
|
|
|
|
|
|
|
CC=gcc
|
|
|
|
AR=ar
|
|
|
|
RM=rm
|
|
|
|
|
|
|
|
objects = args.o base.o base_dispatch.o base_dispatch_common.o buffer.o \
|
2011-07-25 07:59:51 +00:00
|
|
|
channel.o common.o core.o list.o remote.o thread.o xor.o zlib.o
|
2009-08-01 14:21:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####### check platform
|
|
|
|
OSNAME= $(shell uname -s)
|
2010-06-10 06:10:15 +00:00
|
|
|
ARCH= $(shell uname -m | sed 's/i[456]86/i386/g')
|
2009-08-01 14:21:58 +00:00
|
|
|
|
|
|
|
ifeq ($(OSNAME), FreeBSD)
|
|
|
|
OS= bsd
|
|
|
|
libc_objects+= cerror.o
|
|
|
|
else
|
|
|
|
CFLAGS+= -fno-stack-protector -D__linux__
|
|
|
|
CFLAGS+= -D_POSIX_C_SOURCE=200809 -D__BSD_VISIBLE=1 -D__XSI_VISIBLE=1
|
|
|
|
OS=$(OSNAME)
|
|
|
|
# requires tls - which we don't have
|
|
|
|
# libc_objects+= errno.o
|
|
|
|
endif
|
|
|
|
|
2010-09-13 14:44:00 +00:00
|
|
|
BASEVPATH=../../source/common:../../source/common/crypto:../../source/common/arch/posix:../../source/common/zlib:
|
2009-08-01 14:21:58 +00:00
|
|
|
OSVPATH= ../../source/common/arch/$(OS)
|
|
|
|
ARCHVPATH= $(OSVPATH)/$(ARCH)
|
|
|
|
VPATH=$(BASEVPATH):$(OSVPATH):$(ARCHVPATH)
|
|
|
|
|
|
|
|
CFLAGS+= -I$(ARCHVPATH)
|
2011-07-25 07:59:51 +00:00
|
|
|
|
2009-08-01 14:21:58 +00:00
|
|
|
|
2010-08-26 07:25:15 +00:00
|
|
|
all: libsupport.so
|
2009-08-01 14:21:58 +00:00
|
|
|
|
2012-02-10 20:57:59 +00:00
|
|
|
debug: CFLAGS+=-ggdb
|
|
|
|
debug: all
|
|
|
|
|
|
|
|
|
2010-08-26 07:25:15 +00:00
|
|
|
libsupport.so: $(objects)
|
2011-07-25 07:59:51 +00:00
|
|
|
# Specify that we only want sysv aka DT_HASH hash tables, not DT_GNU_HASH,
|
|
|
|
# because that's what msflinker (modified bionic linker) can handle
|
|
|
|
$(CC) -Wl,--hash-style=sysv $(CFLAGS) -shared $(objects) -lc -lssl -lcrypto -o $@
|
2009-08-01 14:21:58 +00:00
|
|
|
|
|
|
|
clean:
|
2010-08-26 05:16:27 +00:00
|
|
|
$(RM) -f *.o *.a *.so zlib/zlib.o
|
2009-08-01 14:21:58 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|