-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (42 loc) · 1.49 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
# determine board
ifeq ($(host),pc)
CROSS_COMPILE=
ROOT_PATH=
else
CROSS_COMPILE=ppc_6xx-
ROOT_PATH=
endif
DEFINES=
CLIENT_OUTPUT=cryptoenc
SERVER_OUTPUT=cryptodec
# shell directives
CXX = g++
CC = gcc
AR = ar
CP = cp
# determine source codes to be compiled
MAIN_C_CLIENT_SOURCES=$(shell find src -name "*.c" | grep -v src/main_dec.c)
MAIN_CPP_CLIENT_SOURCES=$(shell find src -name "*.cpp")
MAIN_C_CLIENT_OBJECTS=$(MAIN_C_CLIENT_SOURCES:.c=.o)
MAIN_CPP_CLIENT_OBJECTS=$(MAIN_CPP_CLIENT_SOURCES:.cpp=.o)
MAIN_C_SERVER_SOURCES=$(shell find src -name "*.c" | grep -v src/main_enc.c)
MAIN_CPP_SERVER_SOURCES=$(shell find src -name "*.cpp")
MAIN_C_SERVER_OBJECTS=$(MAIN_C_SERVER_SOURCES:.c=.o)
MAIN_CPP_SERVER_OBJECTS=$(MAIN_CPP_SERVER_SOURCES:.cpp=.o)
MAIN_APP_CLIENT_OBJECTS=${MAIN_C_CLIENT_OBJECTS} ${MAIN_CPP_CLIENT_OBJECTS}
MAIN_APP_SERVER_OBJECTS=${MAIN_C_SERVER_OBJECTS} ${MAIN_CPP_SERVER_OBJECTS}
INCLUDE= -Isrc/
LINK= -lcrypto -lssl
CFLAGS= -Wall
CPPFLAGS= -Wall
all : $(CLIENT_OUTPUT) $(SERVER_OUTPUT)
${CLIENT_OUTPUT}: ${MAIN_APP_CLIENT_OBJECTS}
$(CROSS_COMPILE)$(CC) ${MAIN_APP_CLIENT_OBJECTS} $(DEFINES) -o ${CLIENT_OUTPUT} $(LINK)
${SERVER_OUTPUT}: ${MAIN_APP_SERVER_OBJECTS}
$(CROSS_COMPILE)$(CC) ${MAIN_APP_SERVER_OBJECTS} $(DEFINES) -o ${SERVER_OUTPUT} $(LINK)
%.o : %.c
$(CROSS_COMPILE)$(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c $< -o $@
%.o : %.cpp
$(CROSS_COMPILE)$(CXX) $(CPPFLAGS) $(INCLUDE) $(DEFINES) -c $< -o $@
clean:
rm -f `find src -name "*.o"` $(CLIENT_OUTPUT) $(SERVER_OUTPUT)