forked from rapid7/meterpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
46 lines (39 loc) · 1.51 KB
/
Makefile.common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.SUFFIXES: .S .c
CC = gcc
AR = ar
RM = rm
CFLAGS = -nostdinc -nostdlib
CFLAGS += -I $(ROOT)/source/bionic/libc/include
CFLAGS += -I $(ROOT)/source/bionic/libc/kernel/common/linux/
CFLAGS += -I $(ROOT)/source/bionic/libc/kernel/common/
CFLAGS += -I $(ROOT)/source/bionic/libc/arch-x86/include/
CFLAGS += -I $(ROOT)/source/bionic/libc/kernel/arch-x86/
CFLAGS += -I $(ROOT)/source/common
CFLAGS += -I $(ROOT)/source/common/malloc
CFLAGS += -I $(ROOT)/source/common/crypto
CFLAGS += -I $(ROOT)/source/common/stdlib
CFLAGS += -I $(ROOT)/source/common/zlib
CFLAGS += -I $(ROOT)/deps/libressl/include
CFLAGS += -I $(ROOT)/deps/libpcap
CFLAGS += -Dwchar_t='char' -D_SIZE_T_DECLARED -DElf_Size='u_int32_t'
CFLAGS += -D_BYTE_ORDER=_LITTLE_ENDIAN
CFLAGS += -D_UNIX -DMALLOC_PRODUCTION
CFLAGS += -D_POSIX_C_SOURCE=200809 -D__BSD_VISIBLE=1 -D__XSI_VISIBLE=1 -D__linux__
CFLAGS += -fno-stack-protector -fno-builtin
CFLAGS += -march=i386 -m32
CFLAGS += -g -Os
CFLAGS += -DPIC -fPIC
LDFLAGS = -lgcc -lc
LDFLAGS += -L$(ROOT)/source/bionic/compiled
# 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
LDFLAGS += -Wl,--hash-style=sysv
# Specify the gold linker because newer versions of the BFD linker strip
# important symbols from the shared libraries.
GCCGOLD = $(shell (echo "int main(){}" | gcc -fuse-ld=gold -o/dev/null -xc -); echo $$?)
ifeq "$(GCCGOLD)" "0"
LDFLAGS += -fuse-ld=gold
endif
%.o: %.c Makefile
@echo [CC] $@
@$(CC) $(CFLAGS) -o $@ -c $<