-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
65 lines (54 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
TOOL=g++
DIR_BUILD=build
INCLUDE=-I./include
MACRO=-DDEBUG -DLOG_ERROR -DLOG_INFO
LIB_MAIN=`pkg-config --libs libzip` -lm
EXEC=cruise
LOG="Tool : "${TOOL}"\r\nMacros : "${MACRO}"\r\nTarget : "${DIR_BUILD}/${EXEC}"\r\n"
cruise: main.c java.c include/java.h attr.c
@make init
@clear;clear
@echo ${LOG}
@${TOOL} -g -o ${DIR_BUILD}/${EXEC} \
main.c \
java.c \
attr.c \
${DIR_BUILD}/input.so \
${DIR_BUILD}/log.so \
${DIR_BUILD}/mem.so \
${DIR_BUILD}/vrf.so \
${DIR_BUILD}/rt.so \
${INCLUDE} ${LIB_MAIN} ${MACRO};
init:
@if [ ! -d ${DIR_BUILD} ]; then mkdir ${DIR_BUILD}; fi
@make input
@make log
@make mem
@make vrf
@make rt
# Modules
input: include/input.h input.c
@${TOOL} -shared -o ${DIR_BUILD}/input.so \
input.c \
${INCLUDE} ${MACRO} ${LIB_MAIN}
log: include/log.h log.c
@${TOOL} -shared -o ${DIR_BUILD}/log.so log.c \
${INCLUDE} ${MACRO}
mem:
@${TOOL} -shared -o ${DIR_BUILD}/mem.so memory.c \
${INCLUDE} ${MACRO}
rt: include/rt.h rt.cpp
@${TOOL} -g -shared -o ${DIR_BUILD}/rt.so rt.cpp \
${INCLUDE} ${MACRO}
vrf: include/vrf.h vrf.c
@${TOOL} -g -shared -o ${DIR_BUILD}/vrf.so vrf.c \
${INCLUDE} ${MACRO}
# Test
test: test.c
@clear
@if [ ! -d ${DIR_BUILD} ]; then mkdir ${DIR_BUILD}; fi
${TOOL} -g -o ${DIR_BUILD}/test test.c
# Clean
clean:
@clear;clear
@find ${DIR_BUILD} -type f -executable -delete