APUE Learning Example Source Code
guowenxue
2019-06-26 157be0b0d4c7d4809cfcafc76235cc18388378c8
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
include ../config.mk
 
.PHONY: all install uninstall clean reallyclean
 
ifeq ($(WITH_TLS),yes)
all : mosquitto mosquitto_passwd
else
all : mosquitto
endif
 
OBJS=    mosquitto.o \
        alias_mosq.o \
        bridge.o \
        conf.o \
        conf_includedir.o \
        context.o \
        database.o \
        handle_auth.o \
        handle_connack.o \
        handle_connect.o \
        handle_disconnect.o \
        handle_ping.o \
        handle_pubackcomp.o \
        handle_publish.o \
        handle_pubrec.o \
        handle_pubrel.o \
        handle_suback.o \
        handle_subscribe.o \
        handle_unsuback.o \
        handle_unsubscribe.o \
        logging.o \
        loop.o \
        memory_mosq.o \
        net.o \
        net_mosq.o \
        net_mosq_ocsp.o \
        packet_datatypes.o \
        packet_mosq.o \
        property_broker.o \
        property_mosq.o \
        persist_read.o \
        persist_read_v234.o \
        persist_read_v5.o \
        persist_write.o \
        persist_write_v5.o \
        plugin.o \
        read_handle.o \
        security.o \
        security_default.o \
        send_auth.o \
        send_connack.o \
        send_connect.o \
        send_disconnect.o \
        send_mosq.o \
        send_publish.o \
        send_suback.o \
        send_subscribe.o \
        send_unsuback.o \
        send_unsubscribe.o \
        service.o \
        session_expiry.o \
        signals.o \
        subs.o \
        sys_tree.o \
        time_mosq.o \
        tls_mosq.o \
        utf8_mosq.o \
        util_mosq.o \
        util_topic.o \
        websockets.o \
        will_delay.o \
        will_mosq.o
 
mosquitto : ${OBJS}
    ${CROSS_COMPILE}${CC} ${BROKER_LDFLAGS} $^ -o $@ $(BROKER_LDADD)
 
mosquitto.o : mosquitto.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
alias_mosq.o : ../lib/alias_mosq.c ../lib/alias_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
bridge.o : bridge.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
conf.o : conf.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
conf_includedir.o : conf_includedir.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
context.o : context.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
database.o : database.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_auth.o : handle_auth.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_connack.o : handle_connack.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_connect.o : handle_connect.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_disconnect.o : handle_disconnect.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_ping.o : ../lib/handle_ping.c ../lib/read_handle.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_pubackcomp.o : ../lib/handle_pubackcomp.c ../lib/read_handle.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_publish.o : handle_publish.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_pubrec.o : ../lib/handle_pubrec.c ../lib/read_handle.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_pubrel.o : ../lib/handle_pubrel.c ../lib/read_handle.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_suback.o : ../lib/handle_suback.c ../lib/read_handle.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_subscribe.o : handle_subscribe.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_unsuback.o : ../lib/handle_unsuback.c ../lib/read_handle.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
handle_unsubscribe.o : handle_unsubscribe.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
logging.o : logging.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
loop.o : loop.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
memory_mosq.o : ../lib/memory_mosq.c ../lib/memory_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
net.o : net.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
net_mosq_ocsp.o : ../lib/net_mosq_ocsp.c ../lib/net_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
net_mosq.o : ../lib/net_mosq.c ../lib/net_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
persist_read.o : persist_read.c persist.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
persist_read_v234.o : persist_read_v234.c persist.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
persist_read_v5.o : persist_read_v5.c persist.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
persist_write.o : persist_write.c persist.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
persist_write_v5.o : persist_write_v5.c persist.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
packet_datatypes.o : ../lib/packet_datatypes.c ../lib/packet_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
packet_mosq.o : ../lib/packet_mosq.c ../lib/packet_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
property_broker.o : property_broker.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
property_mosq.o : ../lib/property_mosq.c ../lib/property_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
plugin.o : plugin.c mosquitto_plugin.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
read_handle.o : read_handle.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
security.o : security.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
security_default.o : security_default.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_auth.o : send_auth.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_connect.o : ../lib/send_connect.c ../lib/send_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_disconnect.o : ../lib/send_disconnect.c ../lib/send_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_connack.o : send_connack.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_mosq.o : ../lib/send_mosq.c ../lib/send_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_publish.o : ../lib/send_publish.c ../lib/send_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_suback.o : send_suback.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_subscribe.o : ../lib/send_subscribe.c ../lib/send_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_unsuback.o : send_unsuback.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
send_unsubscribe.o : ../lib/send_unsubscribe.c ../lib/send_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
service.o : service.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
session_expiry.o : session_expiry.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
signals.o : signals.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
subs.o : subs.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
sys_tree.o : sys_tree.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
time_mosq.o : ../lib/time_mosq.c ../lib/time_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
tls_mosq.o : ../lib/tls_mosq.c
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
util_mosq.o : ../lib/util_mosq.c ../lib/util_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
util_topic.o : ../lib/util_topic.c ../lib/util_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
utf8_mosq.o : ../lib/utf8_mosq.c
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
websockets.o : websockets.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
will_delay.o : will_delay.c mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
will_mosq.o : ../lib/will_mosq.c ../lib/will_mosq.h
    ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@
 
mosquitto_passwd : mosquitto_passwd.o
    ${CROSS_COMPILE}${CC} ${LDFLAGS} $^ -o $@ $(PASSWD_LDADD)
 
mosquitto_passwd.o : mosquitto_passwd.c
    ${CROSS_COMPILE}${CC} -I.. $(CPPFLAGS) $(CFLAGS) -c $< -o $@
 
plugin_defer.so : plugin_defer.c mosquitto_plugin.h mosquitto_broker.h mosquitto_broker_internal.h
    ${CROSS_COMPILE}${CC} -I. -I../lib -fPIC -shared $< -o $@
 
install : all
    $(INSTALL) -d "${DESTDIR}$(prefix)/sbin"
    $(INSTALL) ${STRIP_OPTS} mosquitto "${DESTDIR}${prefix}/sbin/mosquitto"
    $(INSTALL) -d "${DESTDIR}$(prefix)/include"
    $(INSTALL) mosquitto_broker.h "${DESTDIR}${prefix}/include/mosquitto_broker.h"
    $(INSTALL) mosquitto_plugin.h "${DESTDIR}${prefix}/include/mosquitto_plugin.h"
ifeq ($(WITH_TLS),yes)
    $(INSTALL) -d "${DESTDIR}$(prefix)/bin"
    $(INSTALL) ${STRIP_OPTS} mosquitto_passwd "${DESTDIR}${prefix}/bin/mosquitto_passwd"
endif
 
uninstall :
    -rm -f "${DESTDIR}${prefix}/sbin/mosquitto"
    -rm -f "${DESTDIR}${prefix}/include/mosquitto_broker.h"
    -rm -f "${DESTDIR}${prefix}/include/mosquitto_plugin.h"
    -rm -f "${DESTDIR}${prefix}/bin/mosquitto_passwd"
 
clean : 
    -rm -f *.o mosquitto mosquitto_passwd *.gcda *.gcno
 
reallyclean : clean
    -rm -rf *.orig *.db