summaryrefslogtreecommitdiff
path: root/other/burneye/src/Makefile
blob: 55cf561e638b42976df6380ed8adae27453d9cbb (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

ifeq ($(debug),on)
CFLAGS += -g -ggdb
DFLAGS += -DDEBUG -DVDEBUG
MPASS += debug=on
endif

CFLAGS += -Wall $(DFLAGS)

CC=gcc
OBJS =	common.o \
	cipher-glfsr.o cipher-rc4.o cipher-sha1.o fingerprint.o rs.o

# basic targets
#

all:	debug fingerprint stub/stub.bin burneye.c $(OBJS)
	$(CC) $(CFLAGS) -o burneye burneye.c $(OBJS)

harddist:	clean stub/stub.bin burneye.c $(OBJS)
	diet $(CC) -DSTANDALONE $(CFLAGS) -o fingerprint -static \
		stub/fingerprint.c rs.o cipher-sha1.o
	strip fingerprint
	stub/utils/sstrip fingerprint

	diet $(CC) $(CFLAGS) -o burneye burneye.c -static $(OBJS)
	strip burneye
	stub/utils/sstrip burneye

	./burneye fingerprint
	mv output fingerprint
	chmod 700 fingerprint
	readelf -l fingerprint

	# burneye itself should be the last binary, for that it will
	# modify itself
	./burneye -B BANNER-BURNEYE -p accept burneye
	mv output burneye
	chmod 700 burneye
	readelf -l burneye


# release=release-string should be set ;)
release:	clean harddist
	mkdir ../dist/burneye-$(release)/
	cp burneye fingerprint ../dist/burneye-$(release)/
	cp ../doc/DIST-README ../dist/burneye-$(release)/README
	chmod 600 ../dist/burneye-$(release)/README
	chmod 700 ../dist/burneye-$(release)/burneye \
		../dist/burneye-$(release)/fingerprint

# clean targets
#

clean:
	rm -f debug/memdump
	rm -f *.o burneye
	rm -f fingerprint
	rm -f rstest
	rm -f output date.eye
	make -C stub clean


# debug targets
#

debug:	debug/memdump

debug/memdump:	debug/memdump.c
	$(CC) $(CFLAGS) -o debug/memdump debug/memdump.c

regress:	regress-clean all date.eye regress.sh
	./regress.sh

regress-clean:	clean
	rm -f date.eye
	rm -f date.*.0x* date.*.regs

date.eye:	date all
	./burneye date
	mv output date.eye
	chmod 700 date.eye


# sub object-targets
#

cipher-glfsr.o:	stub/cipher-glfsr.asm
	nasm $(DFLAGS) -f elf -o cipher-glfsr.o stub/cipher-glfsr.asm

cipher-rc4.o:	stub/cipher-rc4.c
	$(CC) $(CFLAGS) -c stub/cipher-rc4.c -o cipher-rc4.o

cipher-sha1.o:	stub/cipher-sha1.c
	$(CC) $(CFLAGS) -c stub/cipher-sha1.c -o cipher-sha1.o

fingerprint.o:	stub/fingerprint.c
	$(CC) $(CFLAGS) -c stub/fingerprint.c -o fingerprint.o

rs.o:	stub/rs.c
	$(CC) $(CFLAGS) -c stub/rs.c -o rs.o

stub/stub.bin:
	make -C stub rel=on $(MPASS) clean all


# testing tool targets
#

fingerprint:	stub/fingerprint.c cipher-sha1.o rs.o
	$(CC) -DSTANDALONE $(CFLAGS) -o fingerprint \
		stub/fingerprint.c rs.o cipher-sha1.o

rstest:	rstest.c rs.o
	$(CC) $(CFLAGS) -o rstest rstest.c rs.o