forked from haad/net-snmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.rules
475 lines (431 loc) · 14.6 KB
/
Makefile.rules
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
#
# standard target definitions. Set appropriate variables to make use of them.
#
# note: the strange use of the "it" variable is for shell parsing when
# there is no targets to install for that rule.
#
# the standard items to build: libraries, bins, and sbins
STANDARDTARGETS =$(INSTALLLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
STANDARDCLEANTARGETS=$(INSTALLLIBS) $(INSTALLPOSTLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS) $(INSTALLUCDLIBS)
standardall: subdirs $(STANDARDTARGETS)
objs: ${OBJS} ${LOBJS}
# features require that subdirs be made *first* to get dependency
# collection processed in the right order
.PHONY: features ftobjs ftsubdirs
features: $(FTOTHERTARGS) ftsubdirs ftobjs $(FEATUREFILE)
ftobjs: $(FTOBJS)
$(FEATUREFILE): $(FTOBJS) $(top_builddir)/include/net-snmp/feature-details.h
cat $(FTOBJS) > $(FEATUREFILE).in
$(FEATUREPROCESS) $(FEATUREFILE) $(top_builddir)/include/net-snmp/feature-details.h @FEATURE_REMOVE_FLAGS@ @FEATURE_ADD_FLAGS@
ftsubdirs:
@if test "$(FTSUBDIRS)" != ""; then \
SUBDIRS="$(FTSUBDIRS)" ; \
else \
SUBDIRS="$(SUBDIRS)" ; \
fi ; \
if test "$$SUBDIRS" != ""; then \
it="$$SUBDIRS" ; \
for i in $$it ; do \
echo "making features in `pwd`/$$i"; \
( cd $$i ; $(MAKE) features ) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
.PHONY: cleanfeatures cleanfeaturessubdirs
cleanfeatures: cleanfeaturessubdirs
$(RM) $(FTOBJS)
$(RM) $(FEATUREFILE)
$(RM) $(top_builddir)/include/net-snmp/feature-details.h
cleanfeaturessubdirs:
@if test "$(FTSUBDIRS)" != ""; then \
SUBDIRS="$(FTSUBDIRS)" ; \
else \
SUBDIRS="$(SUBDIRS)" ; \
fi ; \
if test "$$SUBDIRS" != ""; then \
it="$$SUBDIRS" ; \
for i in $$it ; do \
echo "making cleanfeatures in `pwd`/$$i"; \
( cd $$i ; $(MAKE) cleanfeatures ) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
# feature-check definitions
.SUFFIXES: .ft
.c.ft:
@test -f $(top_builddir)/include/net-snmp/feature-details.h || \
echo "/* Generated by make. Do not modify directly */" \
> $(top_builddir)/include/net-snmp/feature-details.h
$(FEATURECHECK) --feature-global $(top_builddir)/include/net-snmp/feature-details.h $(mysubdir) $< $@ $(CC) -E $(CPPFLAGS) $(CFLAGS) -c
subdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making all in `pwd`/$$i"; \
( cd $$i ; $(MAKE) ) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
# installlibs handles local, ucd and subdir libs. need to do subdir libs
# before bins, sinze those libs may be needed for successful linking
install: installlocalheaders @installucdheaders@ \
installlibs \
installlocalbin installlocalsbin \
installsubdirs $(OTHERINSTALL)
uninstall: uninstalllibs uninstallbin uninstallsbin uninstallheaders \
uninstallsubdirs $(OTHERUNINSTALL)
installprogs: installbin installsbin
#
# headers
#
# set INSTALLHEADERS to a list of things to install in each makefile.
# set INSTALLBUILTINCLUDEHEADERS a list built and placed into include/net-snmp/
# set INSTALLBUILTHEADERS to a list of things to install from builddir
# set INSTALLSUBDIRHEADERS and INSTALLSUBDIR to subdirectory headers
# set INSTALLSUBDIRHEADERS2 and INSTALLSUBDIR2 to more subdirectory headers
# set INSTALLBUILTSUBDIRHEADERS and INSTALLBUILTSUBDIR to a list from builddir
#
installheaders: installlocalheaders @installucdheaders@ installsubdirheaders
installlocalheaders:
@if test "$(INSTALLBUILTINCLUDEHEADERS)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(includedir) ; \
it="$(INSTALLBUILTINCLUDEHEADERS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/library ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/agent ; \
for i in $$it ; do \
$(INSTALL_DATA) include/net-snmp/$$i $(INSTALL_PREFIX)$(includedir)/$$i ; \
echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$$i" ; \
done \
fi
@if test "$(INSTALLHEADERS)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(includedir) ; \
it="$(INSTALLHEADERS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir) ; \
for i in $$it ; do \
$(INSTALL_DATA) $(top_srcdir)/include/net-snmp/$$i $(INSTALL_PREFIX)$(includedir) ; \
echo "installing $$i in $(INSTALL_PREFIX)$(includedir)" ; \
done \
fi
@if test "$(INSTALLBUILTHEADERS)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(includedir) ; \
it="$(INSTALLBUILTHEADERS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir) ; \
for i in $$it ; do \
$(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(includedir) ; \
echo "installing $$i in $(INSTALL_PREFIX)$(includedir)" ; \
done \
fi
@if test "$(INCLUDESUBDIRHEADERS)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR) ; \
it="$(INCLUDESUBDIRHEADERS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR) ; \
for i in $$it ; do \
$(INSTALL_DATA) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR)/$$i $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR) ; \
echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR)" ; \
done \
fi
@if test "$(INCLUDESUBDIRHEADERS2)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2) ; \
it="$(INCLUDESUBDIRHEADERS2)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2) ; \
for i in $$it ; do \
$(INSTALL_DATA) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR2)/$$i $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2) ; \
echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2)" ; \
done \
fi
@if test "$(INSTALLBUILTSUBDIRHEADERS)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR) ; \
it="$(INSTALLBUILTSUBDIRHEADERS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR) ; \
for i in $$it ; do \
$(INSTALL_DATA) $$i $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR) ; \
echo "installing $$i in $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR)" ; \
done \
fi
installucdheaders:
@if test "$(INSTALLUCDHEADERS)" != "" ; then \
echo creating directory $(INSTALL_PREFIX)$(ucdincludedir) ; \
it="$(INSTALLUCDHEADERS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(ucdincludedir) ; \
for i in $$it ; do \
$(INSTALL_DATA) $(top_srcdir)/include/ucd-snmp/$$i $(INSTALL_PREFIX)$(ucdincludedir) ; \
echo "installing $$i in $(INSTALL_PREFIX)$(ucdincludedir)" ; \
done \
fi
installsubdirheaders:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making installheaders in `pwd`/$$i"; \
( cd $$i ; $(MAKE) installheaders) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
uninstallheaders:
@if test "$(INSTALLHEADERS)" != "" ; then \
it="$(INSTALLHEADERS)" ; \
for i in $$it ; do \
rm -f $(INSTALL_PREFIX)$(includedir)/$$i ; \
echo "removing $$i from $(INSTALL_PREFIX)$(includedir)" ; \
done \
fi
@if test "$(INSTALLBUILTHEADERS)" != "" ; then \
it="$(INSTALLBUILTHEADERS)" ; \
for i in $$it ; do \
rm -f $(INSTALL_PREFIX)$(includedir)/`basename $$i` ; \
echo "removing $$i from $(INSTALL_PREFIX)$(includedir)" ; \
done \
fi
@if test "$(INCLUDESUBDIRHEADERS)" != "" ; then \
it="$(INCLUDESUBDIRHEADERS)" ; \
for i in $$it ; do \
rm -f $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR)/$$i ; \
echo "removing $$i from $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR)" ; \
done \
fi
@if test "$(INCLUDESUBDIRHEADERS2)" != "" ; then \
it="$(INCLUDESUBDIRHEADERS2)" ; \
for i in $$it ; do \
rm -f $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2)/$$i ; \
echo "removing $$i from $(INSTALL_PREFIX)$(includedir)/$(INCLUDESUBDIR2)" ; \
done \
fi
@if test "$(INSTALLBUILTSUBDIRHEADERS)" != "" ; then \
it="$(INSTALLBUILTSUBDIRHEADERS)" ; \
for i in $$it ; do \
rm -f $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR)/`basename $$i` ; \
echo "removing $$i from $(INSTALL_PREFIX)$(includedir)/$(INSTALLBUILTSUBDIR)" ; \
done \
fi
#
# libraries
#
# set INSTALLLIBS to a list of things to install in each makefile.
#
installlibs: installlocallibs @installucdlibs@ installsubdirlibs installpostlibs
installlocallibs: $(INSTALLLIBS)
@if test "$(INSTALLLIBS)" != ""; then \
it="$(INSTALLLIBS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir) ; \
$(INSTALL) $(INSTALLLIBS) $(INSTALL_PREFIX)$(libdir) ; \
for i in $$it ; do \
echo "installing $$i in $(INSTALL_PREFIX)$(libdir)"; \
$(RANLIB) $(INSTALL_PREFIX)$(libdir)/$$i ; \
done ; \
$(LIB_LDCONFIG_CMD) ; \
fi
installpostlibs: $(INSTALLPOSTLIBS)
@if test "$(INSTALLPOSTLIBS)" != ""; then \
it="$(INSTALLPOSTLIBS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir) ; \
$(INSTALL) $(INSTALLPOSTLIBS) $(INSTALL_PREFIX)$(libdir) ; \
for i in $$it ; do \
echo "installing $$i in $(INSTALL_PREFIX)$(libdir)"; \
$(RANLIB) $(INSTALL_PREFIX)$(libdir)/$$i ; \
done ; \
$(LIB_LDCONFIG_CMD) ; \
fi
installucdlibs: $(INSTALLUCDLIBS)
@if test "$(INSTALLUCDLIBS)" != ""; then \
it="$(INSTALLUCDLIBS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(libdir) ; \
$(INSTALL) $(INSTALLUCDLIBS) $(INSTALL_PREFIX)$(libdir) ; \
for i in $$it ; do \
echo "installing $$i in $(INSTALL_PREFIX)$(libdir)"; \
$(RANLIB) $(INSTALL_PREFIX)$(libdir)/$$i ; \
done ; \
$(LIB_LDCONFIG_CMD) ; \
fi
installsubdirlibs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making installlibs in `pwd`/$$i"; \
( cd $$i ; $(MAKE) installlibs) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
uninstalllibs:
@if test "$(INSTALLLIBS)" != ""; then \
it="$(INSTALLLIBS)" ; \
for i in $$it ; do \
$(UNINSTALL) $(INSTALL_PREFIX)$(libdir)/$$i ; \
echo "removing $$i from $(INSTALL_PREFIX)$(libdir)"; \
done \
fi
#
# normal bin binaries
#
# set INSTALLBINPROGS to a list of things to install in each makefile.
#
installbin: installlocalbin installsubdirbin
installlocalbin: $(INSTALLBINPROGS)
@if test "$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" != " "; then \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(bindir) ; \
it="$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" ; \
$(INSTALL) $(INSTALLBINPROGS) $(INSTALLBINSCRIPTS) $(INSTALL_PREFIX)$(bindir) ; \
for i in $$it ; do \
echo "installing $$i in $(INSTALL_PREFIX)$(bindir)"; \
done \
fi
installsubdirbin:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making installbin in `pwd`/$$i"; \
( cd $$i ; $(MAKE) installbin) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
uninstallbin:
@if test "$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" != " "; then \
it="$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" ; \
for i in $$it ; do \
$(UNINSTALL) $(INSTALL_PREFIX)$(bindir)/$$i ; \
echo "removing $$i from $(INSTALL_PREFIX)$(bindir)"; \
done \
fi
#
# sbin binaries
#
# set INSTALLSBINPROGS to a list of things to install in each makefile.
#
installsbin: installlocalsbin installsubdirsbin
installlocalsbin: $(INSTALLSBINPROGS)
@if test "$(INSTALLSBINPROGS)" != ""; then \
it="$(INSTALLSBINPROGS)" ; \
$(SHELL) $(top_srcdir)/mkinstalldirs $(INSTALL_PREFIX)$(sbindir) ; \
$(INSTALL) $(INSTALLSBINPROGS) $(INSTALL_PREFIX)$(sbindir) ; \
for i in $$it ; do \
echo "installing $$i in $(INSTALL_PREFIX)$(sbindir)"; \
done \
fi
installsubdirsbin:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making installsbin in `pwd`/$$i"; \
( cd $$i ; $(MAKE) installsbin) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
uninstallsbin:
@if test "$(INSTALLSBINPROGS)" != ""; then \
it="$(INSTALLSBINPROGS)" ; \
for i in $$it ; do \
$(UNINSTALL) $(INSTALL_PREFIX)$(sbindir)/$$i ; \
echo "removing $$i from $(INSTALL_PREFIX)$(sbindir)"; \
done \
fi
#
# general make install target for subdirs
#
installsubdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making install in `pwd`/$$i"; \
( cd $$i ; $(MAKE) install) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
uninstallsubdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making uninstall in `pwd`/$$i"; \
( cd $$i ; $(MAKE) uninstall) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
#
# cleaning targets
#
clean: cleansubdirs $(OTHERCLEANTODOS)
$(LIBTOOLCLEAN) ${OBJS} ${LOBJS} ${FTOBJS} core $(STANDARDCLEANTARGETS) $(OTHERCLEANTARGETS)
cleansubdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making clean in `pwd`/$$i"; \
( cd $$i ; $(MAKE) clean) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
lint:
lint -nhx $(CSRCS)
#
# wacky dependency building.
#
depend: dependdirs
@if test -f Makefile.depend ; then \
makedepend `echo $(CPPFLAGS) | sed 's/-f[-a-z]*//g'` -o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
fi
nosysdepend: nosysdependdirs
@if test -f Makefile.depend ; then \
makedepend `echo $(CPPFLAGS) | sed 's/-f[-a-z]*//g'` -o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
$(PERL) -n -i.bak $(top_srcdir)/makenosysdepend.pl Makefile ; \
fi
distdepend: nosysdepend distdependdirs
@if test -f Makefile.depend ; then \
$(PERL) $(top_srcdir)/makefileindepend.pl ; \
fi
dependdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making depend in `pwd`/$$i"; \
( cd $$i ; $(MAKE) depend) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
nosysdependdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making nosysdepend in `pwd`/$$i"; \
( cd $$i ; $(MAKE) nosysdepend) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
distdependdirs:
@if test "$(SUBDIRS)" != ""; then \
it="$(SUBDIRS)" ; \
for i in $$it ; do \
echo "making distdepend in `pwd`/$$i"; \
( cd $$i ; $(MAKE) distdepend) ; \
if test $$? != 0 ; then \
exit 1 ; \
fi \
done \
fi
# These aren't real targets, let gnu's make know that.
.PHONY: clean cleansubdirs lint \
install installprogs installheaders installlibs \
installbin installsbin installsubdirs \
all subdirs standardall objs features \
depend nosysdepend distdepend dependdirs nosysdependdirs distdependdirs