and added files
[bcm963xx.git] / userapps / opensource / net-snmp / Makefile.rules
1
2 #
3 # standard target definitions.  Set appropriate variables to make use of them.
4 #
5 # note: the strange use of the "it" variable is for shell parsing when
6 # there is no targets to install for that rule.
7 #
8
9 # the standard items to build: libraries, bins, and sbins
10 STANDARDTARGETS     =$(INSTALLLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS)
11 STANDARDCLEANTARGETS=$(INSTALLLIBS) $(INSTALLBINPROGS) $(INSTALLSBINPROGS) $(INSTALLUCDLIBS)
12
13 standardall: subdirs $(STANDARDTARGETS)
14
15 subdirs:
16         @if test "$(SUBDIRS)" != ""; then \
17                 it="$(SUBDIRS)" ; \
18                 for i in $$it ; do       \
19                         echo "making all in `pwd`/$$i"; \
20                         ( cd $$i ; $(MAKE) ) ; \
21                         if test $$? != 0 ; then \
22                                 exit 1 ; \
23                         fi  \
24                 done \
25         fi
26
27 install: installlocalheaders @installucdheaders@ \
28          installlocallibs    @installucdlibs@    \
29          installlocalbin      installlocalsbin   \
30          installsubdirs      $(OTHERINSTALL)
31
32 installprogs: installbin installsbin
33
34 #
35 # headers
36 #
37 # set INSTALLHEADERS to a list of things to install in each makefile.
38 # set INSTALLBUILTHEADERS to a list of things to install from builddir
39 # set INSTALLSUBDIRHEADERS and INSTALLSUBDIR to subdirectory headers
40 # set INSTALLSUBDIRHEADERS2 and INSTALLSUBDIR2 to more subdirectory headers
41 # set INSTALLBUILTSUBDIRHEADERS and INSTALLBUILTSUBDIR to a list from builddir
42 #
43 installheaders: installlocalheaders @installucdheaders@ installsubdirheaders
44
45 installlocalheaders:
46         @if test "$(INSTALLHEADERS)" != "" ; then \
47                 echo creating directory $(includedir) ; \
48                 it="$(INSTALLHEADERS)" ; \
49                 $(SHELL) $(top_srcdir)/mkinstalldirs $(includedir) ; \
50                 for i in $$it ; do \
51                         $(INSTALL) $(top_srcdir)/include/net-snmp/$$i $(includedir) ; \
52                         echo "installing $$i in $(includedir)" ; \
53                 done \
54         fi
55         @if test "$(INSTALLBUILTHEADERS)" != "" ; then \
56                 echo creating directory $(includedir) ; \
57                 it="$(INSTALLBUILTHEADERS)" ; \
58                 $(SHELL) $(top_srcdir)/mkinstalldirs $(includedir) ; \
59                 for i in $$it ; do \
60                         $(INSTALL) $$i $(includedir) ; \
61                         echo "installing $$i in $(includedir)" ; \
62                 done \
63         fi
64         @if test "$(INCLUDESUBDIRHEADERS)" != "" ; then \
65                 echo creating directory $(includedir)/$(INCLUDESUBDIR) ; \
66                 it="$(INCLUDESUBDIRHEADERS)" ; \
67                 $(SHELL) $(top_srcdir)/mkinstalldirs $(includedir)/$(INCLUDESUBDIR) ; \
68                 for i in $$it ; do \
69                         $(INSTALL) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR)/$$i $(includedir)/$(INCLUDESUBDIR) ; \
70                         echo "installing $$i in $(includedir)/$(INCLUDESUBDIR)" ; \
71                 done \
72         fi
73         @if test "$(INCLUDESUBDIRHEADERS2)" != "" ; then \
74                 echo creating directory $(includedir)/$(INCLUDESUBDIR2) ; \
75                 it="$(INCLUDESUBDIRHEADERS2)" ; \
76                 $(SHELL) $(top_srcdir)/mkinstalldirs $(includedir)/$(INCLUDESUBDIR2) ; \
77                 for i in $$it ; do \
78                         $(INSTALL) $(top_srcdir)/include/net-snmp/$(INCLUDESUBDIR2)/$$i $(includedir)/$(INCLUDESUBDIR2) ; \
79                         echo "installing $$i in $(includedir)/$(INCLUDESUBDIR2)" ; \
80                 done \
81         fi
82         @if test "$(INSTALLBUILTSUBDIRHEADERS)" != "" ; then \
83                 echo creating directory $(includedir)/$(INSTALLBUILTSUBDIR) ; \
84                 it="$(INSTALLBUILTSUBDIRHEADERS)" ; \
85                 $(SHELL) $(top_srcdir)/mkinstalldirs $(includedir)/$(INSTALLBUILTSUBDIR) ; \
86                 for i in $$it ; do \
87                         $(INSTALL) $$i $(includedir)/$(INSTALLBUILTSUBDIR) ; \
88                         echo "installing $$i in $(includedir)/$(INSTALLBUILTSUBDIR)" ; \
89                 done \
90         fi
91
92 installsubdirheaders:
93         @if test "$(SUBDIRS)" != ""; then \
94                 it="$(SUBDIRS)" ; \
95                 for i in $$it ; do       \
96                         echo "making installheaders in `pwd`/$$i"; \
97                         ( cd $$i ; $(MAKE) installheaders) ;   \
98                         if test $$? != 0 ; then \
99                                 exit 1 ; \
100                         fi  \
101                 done \
102         fi
103
104 installucdheaders:
105         @if test "$(INSTALLUCDHEADERS)" != "" ; then \
106                 echo creating directory $(ucdincludedir) ; \
107                 it="$(INSTALLUCDHEADERS)" ; \
108                 $(SHELL) $(top_srcdir)/mkinstalldirs $(ucdincludedir) ; \
109                 for i in $$it ; do \
110                         $(INSTALL) $(top_srcdir)/include/ucd-snmp/$$i $(ucdincludedir) ; \
111                         echo "installing $$i in $(ucdincludedir)" ; \
112                 done \
113         fi
114
115 #
116 # libraries
117 #
118 # set INSTALLLIBS to a list of things to install in each makefile.
119 #
120 installlibs: installlocallibs @installucdlibs@ installsubdirlibs
121
122 installlocallibs: $(INSTALLLIBS)
123         @if test "$(INSTALLLIBS)" != ""; then \
124                 it="$(INSTALLLIBS)" ; \
125                 $(SHELL) $(top_srcdir)/mkinstalldirs $(libdir) ; \
126                 $(INSTALL) $(INSTALLLIBS) $(libdir) ;              \
127                 for i in $$it ; do    \
128                         echo "installing $$i in $(libdir)"; \
129                         $(RANLIB) $(libdir)/$$i ; \
130                 done ; \
131                 $(LIB_LDCONFIG_CMD) ; \
132         fi
133
134 installucdlibs: $(INSTALLUCDLIBS)
135         @if test "$(INSTALLUCDLIBS)" != ""; then \
136                 it="$(INSTALLUCDLIBS)" ; \
137                 $(SHELL) $(top_srcdir)/mkinstalldirs $(libdir) ; \
138                 $(INSTALL) $(INSTALLUCDLIBS) $(libdir) ;              \
139                 for i in $$it ; do    \
140                         echo "installing $$i in $(libdir)"; \
141                         $(RANLIB) $(libdir)/$$i ; \
142                 done ; \
143                 $(LIB_LDCONFIG_CMD) ; \
144         fi
145
146 installsubdirlibs:
147         @if test "$(SUBDIRS)" != ""; then \
148                 it="$(SUBDIRS)" ; \
149                 for i in $$it ; do       \
150                         echo "making installlibs in `pwd`/$$i"; \
151                         ( cd $$i ; $(MAKE) installlibs) ;   \
152                         if test $$? != 0 ; then \
153                                 exit 1 ; \
154                         fi  \
155                 done \
156         fi
157
158 #
159 # normal bin binaries
160 #
161 # set INSTALLBINPROGS to a list of things to install in each makefile.
162 #
163 installbin: installlocalbin installsubdirbin
164
165 installlocalbin: $(INSTALLBINPROGS)
166         @if test "$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" != " "; then \
167                 $(SHELL) $(top_srcdir)/mkinstalldirs $(bindir) ; \
168                 it="$(INSTALLBINPROGS) $(INSTALLBINSCRIPTS)" ; \
169                 $(INSTALL) $(INSTALLBINPROGS) $(INSTALLBINSCRIPTS) $(bindir) ;              \
170                 for i in $$it ; do   \
171                         echo "installing $$i in $(bindir)"; \
172                 done \
173         fi
174
175 installsubdirbin:
176         @if test "$(SUBDIRS)" != ""; then \
177                 it="$(SUBDIRS)" ; \
178                 for i in $$it ; do       \
179                         echo "making installbin in `pwd`/$$i"; \
180                         ( cd $$i ; $(MAKE) installbin) ;   \
181                         if test $$? != 0 ; then \
182                                 exit 1 ; \
183                         fi  \
184                 done \
185         fi
186
187 #
188 # sbin binaries
189 #
190 # set INSTALLSBINPROGS to a list of things to install in each makefile.
191 #
192 installsbin: installlocalsbin installsubdirsbin
193
194 installlocalsbin: $(INSTALLSBINPROGS)
195         @if test "$(INSTALLSBINPROGS)" != ""; then \
196                 it="$(INSTALLSBINPROGS)" ; \
197                 $(SHELL) $(top_srcdir)/mkinstalldirs $(sbindir) ; \
198                 $(INSTALL) $(INSTALLSBINPROGS) $(sbindir) ;              \
199                 for i in $$it ; do   \
200                         echo "installing $$i in $(sbindir)"; \
201                 done \
202         fi
203
204 installsubdirsbin:
205         @if test "$(SUBDIRS)" != ""; then \
206                 it="$(SUBDIRS)" ; \
207                 for i in $$it ; do       \
208                         echo "making installsbin in `pwd`/$$i"; \
209                         ( cd $$i ; $(MAKE) installsbin) ;   \
210                         if test $$? != 0 ; then \
211                                 exit 1 ; \
212                         fi  \
213                 done \
214         fi
215
216 #
217 # general make install target for subdirs
218 #
219 installsubdirs:
220         @if test "$(SUBDIRS)" != ""; then \
221                 it="$(SUBDIRS)" ; \
222                 for i in $$it ; do       \
223                         echo "making install in `pwd`/$$i"; \
224                         ( cd $$i ; $(MAKE) install) ;   \
225                         if test $$? != 0 ; then \
226                                 exit 1 ; \
227                         fi  \
228                 done \
229         fi
230
231 #
232 # cleaning targets
233 #
234 clean: cleansubdirs $(OTHERCLEANTODOS)
235         rm -f core ${OBJS} ${LOBJS} $(STANDARDCLEANTARGETS) $(OTHERCLEANTARGETS)
236         rm -rf .libs
237
238 cleansubdirs:
239         @if test "$(SUBDIRS)" != ""; then \
240                 it="$(SUBDIRS)" ; \
241                 for i in $$it ; do       \
242                         echo "making clean in `pwd`/$$i"; \
243                         ( cd $$i ; $(MAKE) clean) ;   \
244                         if test $$? != 0 ; then \
245                                 exit 1 ; \
246                         fi  \
247                 done \
248         fi
249
250 lint:
251         lint -nhx $(CSRCS)
252
253 #
254 # wacky dependency building.
255 #
256 depend: dependdirs
257         @if test -f Makefile.depend ; then \
258                 makedepend `echo $(CPPFLAGS) | sed 's/-f[-a-z]*//g'` -o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
259         fi
260
261
262 nosysdepend: nosysdependdirs
263         @if test -f Makefile.depend ; then \
264                 makedepend `echo $(CPPFLAGS) | sed 's/-f[-a-z]*//g'` -o .lo $(srcdir)/*.c $(srcdir)/*/*.c ; \
265                 perl -n -i.bak $(top_srcdir)/makenosysdepend.pl Makefile ; \
266         fi
267
268 distdepend: nosysdepend distdependdirs
269         @if test -f Makefile.depend ; then \
270                 perl $(top_srcdir)/makefileindepend.pl ; \
271         fi
272
273 dependdirs:
274         @if test "$(SUBDIRS)" != ""; then \
275                 it="$(SUBDIRS)" ; \
276                 for i in $$it ; do       \
277                         echo "making depend in `pwd`/$$i"; \
278                         ( cd $$i ; $(MAKE) depend) ;   \
279                         if test $$? != 0 ; then \
280                                 exit 1 ; \
281                         fi  \
282                 done \
283         fi
284
285 nosysdependdirs:
286         @if test "$(SUBDIRS)" != ""; then \
287                 it="$(SUBDIRS)" ; \
288                 for i in $$it ; do       \
289                         echo "making nosysdepend in `pwd`/$$i"; \
290                         ( cd $$i ; $(MAKE) nosysdepend) ;   \
291                         if test $$? != 0 ; then \
292                                 exit 1 ; \
293                         fi  \
294                 done \
295         fi
296
297 distdependdirs:
298         @if test "$(SUBDIRS)" != ""; then \
299                 it="$(SUBDIRS)" ; \
300                 for i in $$it ; do       \
301                         echo "making distdepend in `pwd`/$$i"; \
302                         ( cd $$i ; $(MAKE) distdepend) ;   \
303                         if test $$? != 0 ; then \
304                                 exit 1 ; \
305                         fi  \
306                 done \
307         fi
308
309 # These aren't real targets, let gnu's make know that.
310 .PHONY: clean cleansubdirs lint \
311         install installprogs installheaders installlibs \
312         installbin installsbin installsubdirs \
313         all subdirs standardall \
314         depend nosysdepend distdepend dependdirs nosysdependdirs distdependdirs