-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
83 lines (61 loc) · 2.27 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
include ../common.mak
#CC = gcc
#CFLAGS = -I. -fPIC -O -g -Wall -Werror -Wno-unused-variable -Wno-unused-parameter
CFLAGS += -I. -fPIC -O -g -Wall -Werror -Wno-unused-variable -Wno-unused-parameter
CFLAGS += -D_GNU_SOURCE
COMMON_PROG_OBJS = \
call_qcsapi.o \
qcsapi_driver.o \
qcsapi_output.o \
qcsapi_sem.o \
SOCKET_PROG_OBJS = \
$(COMMON_PROG_OBJS) \
qcsapi_rpc/client/socket/qcsapi_socket_rpc_client.o \
qcsapi_rpc_common/client/find_host_addr.o \
SOCKET_C_SAMPLE_OBJS = \
qcsapi_rpc_sample/c_rpc_qcsapi_sample.o \
qcsapi_rpc_common/client/find_host_addr.o \
PCIE_PROG_OBJS = \
$(COMMON_PROG_OBJS) \
qcsapi_rpc/client/pcie/qcsapi_pcie_rpc_client.o \
qcsapi_rpc_common/client/rpc_pci_clnt.o \
SOCKET_RAW_PROG_OBJS = \
$(COMMON_PROG_OBJS) \
qcsapi_rpc/client/socket_raw/qcsapi_socketraw_rpc_client.o \
qcsapi_rpc_common/client/rpc_raw_clnt.o \
qcsapi_rpc_common/common/rpc_raw.o
LIB_OBJS = \
qcsapi_rpc/generated/qcsapi_rpc_xdr.o \
qcsapi_rpc/generated/qcsapi_rpc_clnt_adapter.o \
TARGETS = qcsapi_sockrpc \
qcsapi_sockraw \
$(LIB_REALNAME)
all: $(TARGETS)
-include $(shell find . -name \*.d)
LIB_NAME = qcsapi_client
LIB_LDNAME = lib$(LIB_NAME).so
LIB_SONAME = $(LIB_LDNAME).1
LIB_REALNAME = $(LIB_LDNAME).1.0.1
c_rpc_qcsapi_sample: ${SOCKET_C_SAMPLE_OBJS:%=build/%} $(LIB_REALNAME)
${CC} $(filter %.o, $^) -L. -l$(LIB_NAME) -o $@
qcsapi_pcie: ${PCIE_PROG_OBJS:%=build/%} $(LIB_REALNAME)
${CC} $(filter %.o, $^) -L. -l$(LIB_NAME) -o $@
qcsapi_pcie_static: ${PCIE_PROG_OBJS:%=build/%} ${LIB_OBJS}
${CC} $(filter %.o, $^) -o $@
qcsapi_sockrpc: ${SOCKET_PROG_OBJS:%=build/%} $(LIB_REALNAME)
${CC} $(filter %.o, $^) -L. -l$(LIB_NAME) -o $@
qcsapi_sockrpc_static: ${SOCKET_PROG_OBJS:%=build/%} ${LIB_OBJS}
${CC} $(filter %.o, $^) -o $@
qcsapi_sockraw: ${SOCKET_RAW_PROG_OBJS:%=build/%} $(LIB_REALNAME)
${CC} $(filter %.o, $^) -L. -l$(LIB_NAME) -o $@
qcsapi_sockraw_static: ${SOCKET_RAW_PROG_OBJS:%=build/%} ${LIB_OBJS}
${CC} $(filter %.o, $^) -o $@
$(LIB_REALNAME): ${LIB_OBJS:%=build/%}
${CC} -shared -s -o $@ -Wl,-soname,$(LIB_SONAME) -lc $^
cd ${@D} ; ln -fs $(LIB_REALNAME) $(LIB_SONAME)
cd ${@D} ; ln -fs $(LIB_SONAME) $(LIB_LDNAME)
build/%.o: %.c
@mkdir -p ${@D}
${CC} ${CFLAGS} $< -c -o $@ -MD -MF [email protected]
clean:
rm -rf build $(LIB_LDNAME)* $(TARGETS) $(LIB_OBJS)