-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
87 lines (70 loc) · 2.85 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
CC = gcc
CFLAGS = -I. -g -Wall -Wextra -std=gnu99 -nostdlib -fPIC
all: hw mycat stt oc env_test margs args2 elfauxv elfauxv_dynamic \
example ulexec.so
mycat: mycat.o libstatic/libstatic.h libstatic/crt.o libstatic/libstatic.a
gcc -I. -g -std=gnu99 -nostdlib \
libstatic/crt.o mycat.o -o mycat -Llibstatic -lstatic
mycat.o: mycat.c
gcc -fPIC -I. -g -Wall -std=gnu99 -nostdlib -c mycat.c
stt: stt.o libstatic/libstatic.h libstatic/crt.o
gcc -I. -g -std=gnu99 -nostdlib stt.o libstatic/crt.o -Llibstatic -lstatic
stt.o: stt.c
gcc -fPIC -I. -g -Wall -std=gnu99 -nostdlib -c stt.c
oc: oc.c libstatic/libstatic.h libstatic/crt.o
gcc -fPIC -I. -g -Wall -std=gnu99 -nostdlib -c oc.c
gcc -fPIC -I. -g -std=gnu99 -nostdlib \
-o oc libstatic/crt.o oc.o -Llibstatic -lstatic
ulexec.so: ulexec.c load_elf.o map_file.o stack_fix.o ulexec.h unmap.o \
libstatic/libstatic.h libstatic/libstatic.a
gcc -I. -g -Wall -std=gnu99 -nostdlib -fPIC -c ulexec.c
gcc -fPIC -shared -I. -g -std=gnu99 -nostdlib \
ulexec.o load_elf.o map_file.o unmap.o stack_fix.o -o ulexec.so -Llibstatic -lstatic
env_test: env_test.o libstatic/libstatic.a libstatic/crt.o
gcc -g -I. -std=gnu99 -nostdlib -fPIC \
libstatic/crt.o env_test.o -o env_test \
-Llibstatic -lstatic
env_test.o: env_test.c
gcc -g -I. -std=gnu99 -nostdlib -fPIC -c env_test.c
margs: margs.o libstatic/crt.o libstatic/libstatic.a
gcc -g -I. -std=gnu99 -nostdlib -fPIC \
libstatic/crt.o margs.o -o margs \
-Llibstatic -lstatic
chmod ugo-x margs
margs.o: margs.c
gcc -g -I. -std=gnu99 -nostdlib -fPIC -c margs.c
hw: hw.c libstatic/libstatic.a libstatic/crt.o
gcc -I. -g -Wall -std=gnu99 -nostdlib -fPIC -c hw.c
gcc -I. -g -std=gnu99 -nostdlib \
libstatic/crt.o hw.o -o hw -Llibstatic -lstatic
chmod ugo-x hw
elfauxv: elfauxv.o libstatic/libstatic.a libstatic/crt.o
gcc -I. -g -std=gnu99 -nostdlib \
libstatic/crt.o elfauxv.o -o elfauxv -Llibstatic -lstatic
chmod ugo-x elfauxv
elfauxv.o: elfauxv.c
gcc -I. -g -std=gnu99 -nostdlib -fPIC -c elfauxv.c
getaux: getaux.c
gcc -fPIC -g -Wall -Wextra -o getaux getaux.c
args2: args2.c
gcc -I. -g -Wall -Wextra -o args2 args2.c
chmod ugo-x args2
example: example.c
gcc -fPIC -I. -g -Wall -Wextra -o example example.c -ldl
elfauxv_dynamic: elfauxv_dynamic.c
gcc -I. -g -Wall -Wextra -o elfauxv_dynamic elfauxv_dynamic.c
chmod ugo-x elfauxv_dynamic
libstatic/libstatic.a:
cd libstatic; make
libstatic/crt.o:
cd libstatic; make
load_elf.o: load_elf.c ulexec.h libstatic/libstatic.h
map_file.o: map_file.c ulexec.h libstatic/libstatic.h
unmap.o: unmap.c ulexec.h libstatic/libstatic.h
elfauxv.o: elfauxv.c ulexec.h libstatic/libstatic.h
stack_fix.o: stack_fix.c ulexec.h libstatic/libstatic.h
clean:
-rm -rf *.o *.a *core
-rm -rf margs hw args2 env_test dyn_unmap_run mycat stt getaux
-rm -rf elfauxv elfauxv_dynamic hw example ulexec.so errno_set
cd libstatic; make clean