-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
64 lines (50 loc) · 1.36 KB
/
makefile
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
58
59
60
61
62
63
64
TARGET_CC ?= gcc
TARGET_STRIP ?= strip
TARGET_ARCH ?= x86_64
TARGET_SHELL ?= /bin/sh
TARGET_ARGV ?= "-i"
TARGET_ENVP ?= "TERM=linux"
TARGET_ARTIFACT ?= shaas.$(TARGET_ARCH).payload
TARGET_OPTLEVEL ?= z
TARGET_CCFLAGS ?=
MASTER_CC ?= gcc
MASTER_ARCH ?= x86_64
MASTER_IP ?= 127.0.0.1
MASTER_TARGET_PORT ?= 1337
MASTER_REQUEST_PORT ?= 6969
MASTER_ARTIFACT ?= shaas.$(MASTER_ARCH).master
MASTER_PROXY ?= 0
CLIENT_CC ?= gcc
CLIENT_ARCH ?= x86_64
CLIENT_PORT ?= 4200
CLIENT_ARTIFACT ?= shaas.$(CLIENT_ARCH).client
defines = \
-DTARGET_ARCH_$(TARGET_ARCH) \
-DTARGET_SHELL='"$(TARGET_SHELL)"' \
-DTARGET_ARGV='$(TARGET_ARGV)' \
-DTARGET_ENVP='$(TARGET_ENVP)' \
-DMASTER_IP='"$(MASTER_IP)"' \
-DMASTER_TARGET_PORT=$(MASTER_TARGET_PORT) \
-DMASTER_REQUEST_PORT=$(MASTER_REQUEST_PORT) \
-DCLIENT_PORT=$(CLIENT_PORT)
ifneq ($(MASTER_PROXY),0)
defines += -DMASTER_PROXY
endif
ccflags = \
-Wall \
-I./include \
$(defines)
ldflags = \
-lpthread
.PHONY: all clean client master payload
all: client master payload
clean:
rm -f $(MASTER_ARTIFACT) $(CLIENT_ARTIFACT) $(TARGET_ARTIFACT)
client: $(CLIENT_ARTIFACT)
master: $(MASTER_ARTIFACT)
payload: $(TARGET_ARTIFACT)
$(MASTER_ARTIFACT): master.c
$(MASTER_CC) $(ccflags) -o $@ $^ $(ldflags)
$(CLIENT_ARTIFACT): client.c
$(CLIENT_CC) $(ccflags) -o $@ $^
include ./payload/payload.mk