1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-11-26 17:41:08 +01:00
metasploit-payloads/c/meterpreter/Makefile.common
2015-03-24 10:56:33 -05:00

47 lines
1.5 KiB
Makefile

.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 $<