blob: 8377c1b11e6d2b7f69aa7aa33bf37f5fafec8151 (
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
|
LIBS_DIR=./src/libs
INCLUDE_DIR=./include
ecat: bin/libs/libencrypt.a
cc -I $(INCLUDE_DIR) -L bin/libs -o bin/ecat src/ecat.c -lencrypt
# Create a lib archive
bin/libs/libencrypt.a: bin/libs/xor.o bin/libs/encrypt.o
ar -rcs bin/libs/libencrypt.a bin/libs/xor.o bin/libs/encrypt.o
bin/libs/xor.o: $(INCLUDE_DIR)/libs/xor.h src/libs/xor.c
cc -I $(INCLUDE_DIR) -c src/libs/xor.c -o bin/libs/xor.o
bin/libs/encrypt.o: $(INCLUDE_DIR)/libs/encrypt.h src/libs/encrypt.c
cc -I $(INCLUDE_DIR) -c src/libs/encrypt.c -o bin/libs/encrypt.o
# Create DSO and PIC versions
#
ecatS: bin/libs/libencrypt.a
cc -I $(INCLUDE_DIR) -L bin/libs -o bin/ecats src/ecat.c -lencrypts
bin/libs/libencrypts.so: bin/libs/xor-pic.o bin/libs/encrypt-pic.o
cc -I $(INCLUDE_DIR) -shared -o bin/libs/libencrypts.so bin/libs/xor-pic.o bin/libs/encrypt-pic.o
# This creates the same lib with a broken encrypt_arr call.
# We can run the same program passing the different lib at runtime
# and change the behavior of encrypt_arr at runtime
bin/broken_libs/libencrypts.so: bin/libs/xor-pic.o bin/libs/encrypt2-pic.o
cc -I $(INCLUDE_DIR) -shared -o bin/broken_libs/libencrypts.so bin/libs/xor-pic.o bin/libs/encrypt2-pic.o
bin/libs/xor-pic.o: $(INCLUDE_DIR)/libs/xor.h src/libs/xor.c
cc -fPIC -I $(INCLUDE_DIR) -c src/libs/xor.c -o bin/libs/xor-pic.o
bin/libs/encrypt-pic.o: $(INCLUDE_DIR)/libs/encrypt.h src/libs/encrypt.c
cc -fPIC -I $(INCLUDE_DIR) -c src/libs/encrypt.c -o bin/libs/encrypt-pic.o
bin/libs/encrypt2-pic.o: $(INCLUDE_DIR)/libs/encrypt.h src/libs/encrypt2.c
cc -fPIC -I $(INCLUDE_DIR) -c src/libs/encrypt2.c -o bin/libs/encrypt2-pic.o
|