This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
45 lines (34 loc) · 1.42 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
INC_DIR = include
ELF_SRC_DIR = src
TESTSUITES_DIR = testsuites
CC = gcc
CXX = g++
OPT = -g
INC = -I$(INC_DIR)
#DDEBUG = -DLOG_RESULT
#DDEBUG = -DLOG_STATE
DDEBUG = -DDEBUG -DLOG_STATE
CFLAGS = ${OPT} ${INC} ${DDEBUG}
LDFLAGS = -lelf -ldisasm
.PHONY: all reverse test clean
all: main
main: $(ELF_SRC_DIR)/main.c $(ELF_SRC_DIR)/process_core.o $(ELF_SRC_DIR)/access_memory.o $(ELF_SRC_DIR)/common.o $(ELF_SRC_DIR)/process_binary.o $(ELF_SRC_DIR)/process_thread.o $(ELF_SRC_DIR)/disassemble.o
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(ELF_SRC_DIR)/process_core.o: $(ELF_SRC_DIR)/process_core.c
${CC} ${CFLAGS} -c $< -o $@ ${LDFLAGS}
$(ELF_SRC_DIR)/access_memory.o: $(ELF_SRC_DIR)/access_memory.c
${CC} ${CFLAGS} -c $< -o $@ ${LDFLAGS}
$(ELF_SRC_DIR)/common.o: $(ELF_SRC_DIR)/common.c
${CC} ${CFLAGS} -c $< -o $@ ${LDFLAGS}
$(ELF_SRC_DIR)/process_binary.o: $(ELF_SRC_DIR)/process_binary.c
${CC} ${CFLAGS} -c $< -o $@ ${LDFLAGS}
$(ELF_SRC_DIR)/process_thread.o: $(ELF_SRC_DIR)/process_thread.c
${CC} ${CFLAGS} -c $< -o $@ ${LDFLAGS}
$(ELF_SRC_DIR)/disassemble.o: $(ELF_SRC_DIR)/disassemble.c
${CC} ${CFLAGS} -c $< -o $@ ${LDFLAGS}
test:
./main $(TESTSUITES_DIR)/simple/core $(TESTSUITES_DIR)/simple/ $(TESTSUITES_DIR)/simple > $(TESTSUITES_DIR)/simple/result
./main $(TESTSUITES_DIR)/password/core $(TESTSUITES_DIR)/password/ $(TESTSUITES_DIR)/password/ > $(TESTSUITES_DIR)/password/result
clean:
rm -f $(ELF_SRC_DIR)/*.o
rm -f main