-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
37 lines (29 loc) · 1.17 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
CC?=gcc
SRC=src
INC=include
LIB=lib
OBJS=$(SRC)/*.o
INSTALLINC=/usr/include
INSTALLLIB=/lib
INSTALLBIN=/usr/bin
librwelf:
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/elf.o $(SRC)/elf.c
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/ehdr.o $(SRC)/ehdr.c
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/shdr.o $(SRC)/shdr.c
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/sym.o $(SRC)/sym.c
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/phdr.o $(SRC)/phdr.c
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/dyn.o $(SRC)/dyn.c
$(CC) -fPIC -g -c -Wall -pedantic -I$(INC)/ -o$(SRC)/rela.o $(SRC)/rela.c
mkdir -p $(LIB)
$(CC) -shared -Wl,-soname,$(LIB)/librwelf.so.0 -o$(LIB)/librwelf.so.0.1.0 $(OBJS)
ln -sf librwelf.so.0.1.0 $(LIB)/librwelf.so.0
ln -sf librwelf.so.0.1.0 $(LIB)/librwelf.so
$(CC) -orwelf -I$(INC)/ $(SRC)/rwelf/main.c -L$(LIB)/ -lrwelf
clean:
rm -rf rwelf $(LIB) $(SRC)/*.o
install:
cp $(LIB)/* $(INSTALLLIB)
ln -sf librwelf.so.0.1.0 $(INSTALLLIB)/librwelf.so.0
ln -sf librwelf.so.0.1.0 $(INSTALLLIB)/librwelf.so
cp $(INC)/* $(INSTALLINC)
$(CC) -o$(INSTALLBIN)/rwelf -I$(INSTALLINC)/ $(SRC)/rwelf/main.c -L$(INSTALLLIB)/ -lrwelf