aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 5937b640e3fbb0833a3861688ad84bd5c4f3e6db (plain)
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
46
47
48
RM := rm
CC := gcc
STRIP := strip
CFLAGS = -Wall -g
OCFLAGS = -z execstack -fno-stack-protector
X86_FLAGS = -m32 -mpreferred-stack-boundary=2
X64_FLAGS = -m64 -mpreferred-stack-boundary=4
SOURCES = $(wildcard *.c)
TARGETS = $(patsubst %.c,%.o,$(SOURCES))

all: $(SOURCES) $(TARGETS) shellcode crypter post-build

main: $(SOURCES) $(TARGETS)

shellcode:
	make -f shellcode/Makefile SUBDIR=shellcode

crypter:
	make -f crypter/Makefile SUBDIR=crypter SCDIR=.

post-build:
	@read -p "disable protection stuff? (y/N) " answ; \
	if [ "x$$answ" != "xy" ]; then \
		echo "abort .."; \
		return 0; \
	else \
		./disable_prot.sh; \
	fi

disable-prot:
	if [ `cat /proc/sys/kernel/randomize_va_space` -eq 0 ]; then \
		echo "not necessary to run ./disable_prot.sh"; \
	else \
		./disable_prot.sh; \
	fi

%.o : %.c
	$(CC) $(CFLAGS) $(X86_FLAGS) $(OCFLAGS) -o $(patsubst %.o,%,$@) $<
	-$(CC) $(CFLAGS) $(X64_FLAGS) $(OCFLAGS) -o $(patsubst %.o,%,$@)_x64 $<
	ln -s $< $@

clean:
	$(RM) -f $(patsubst %.o,%,$(TARGETS)) $(patsubst %.c,%_x64,$(wildcard *.c))
	$(RM) -f $(TARGETS)
	make -f shellcode/Makefile SUBDIR=shellcode clean
	make -f crypter/Makefile SUBDIR=crypter clean

.PHONY: shellcode crypter clean