Set VERSION to 1.55
[platform/upstream/net-tools.git] / Makefile
1 #
2 # Makefile      Main Makefile for the net-tools Package
3 #
4 # NET-TOOLS     A collection of programs that form the base set of the
5 #               NET-3 Networking Distribution for the LINUX operating
6 #               system.
7 #
8 # Version:      Makefile 1.45 (1996-06-29)
9 #
10 # Author:       Bernd Eckenfels <net-tools@lina.inka.de>
11 #               Copyright 1995-1996 Bernd Eckebnfels, Germany
12 #
13 # URLs:         ftp://ftp.inka.de/pub/comp/Linux/networking/NetTools/ 
14 #               ftp://ftp.linux.org.uk/pub/linux/Networking/PROGRAMS/NetTools/
15 #               http://www.inka.de/sites/lina/linux/NetTools/index_en.html
16 #
17 # Based on:     Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
18 #               Copyright 1988-1993 MicroWalt Corporation
19 #
20 # Modifications:
21 #               Extensively modified from 01/21/94 onwards by
22 #               Alan Cox <A.Cox@swansea.ac.uk>
23 #               Copyright 1993-1994 Swansea University Computer Society
24 #
25 # Be careful! 
26 # This Makefile doesn't describe complete dependencies for all include files.
27 # If you change include files you might need to do make clean. 
28 #
29 #       {1.20}  Bernd Eckenfels:        Even more modifications for the new 
30 #                                       package layout
31 #       {1.21}  Bernd Eckenfels:        Check if config.in is newer than 
32 #                                       config.status
33 #       {1.22}  Bernd Eckenfels:        Include ypdomainname and nisdomainame
34 #
35 #       1.3.50-BETA6 private Release
36 #                               
37 #960125 {1.23}  Bernd Eckenfels:        Peter Tobias' rewrite for 
38 #                                       makefile-based installation
39 #       1.3.50-BETA6a private Release
40 #
41 #960201 {1.24}  Bernd Eckenfels:        net-features.h added
42 #
43 #960201 1.3.50-BETA6b private Release
44 #
45 #960203 1.3.50-BETA6c private Release
46 #
47 #960204 1.3.50-BETA6d private Release
48 #
49 #960204 {1.25}  Bernd Eckenfels:        DISTRIBUTION added
50 #
51 #960205 1.3.50-BETA6e private Release
52 #
53 #960206 {1.26}  Bernd Eckenfels:        afrt.o removed (cleaner solution)
54 #
55 #960215 1.3.50-BETA6f Release
56 #
57 #960216 {1.30}  Bernd Eckenfels:        net-lib support
58 #960322 {1.31}  Bernd Eckenfels:        moveable netlib, TOPDIR
59 #960424 {1.32}  Bernd Eckenfels:        included the URLs in the Comment
60 #
61 #960514 1.31-alpha release
62 #
63 #960518 {1.33}  Bernd Eckenfels:        -I/usr/src/linux/include comment added
64 #
65 #       This program is free software; you can redistribute it
66 #       and/or  modify it under  the terms of  the GNU General
67 #       Public  License as  published  by  the  Free  Software
68 #       Foundation;  either  version 2 of the License, or  (at
69 #       your option) any later version.
70 #
71
72 # set the base of the Installation 
73 # BASEDIR = /mnt
74
75 # path to the net-lib support library. Default: lib
76 NET_LIB_PATH = lib
77 NET_LIB_NAME = net-tools
78
79 PROGS   := ifconfig hostname arp netstat route rarp slattach plipconfig
80
81 -include config.make
82 ifeq ($(HAVE_IP_TOOLS),1)
83 PROGS   += iptunnel ipmaddr
84 endif
85
86 # Compiler and Linker Options
87 # You may need to uncomment and edit these if you are using libc5 and IPv6.
88 COPTS = -D_GNU_SOURCE -O2 -Wall -g # -I/usr/inet6/include
89 ifeq ($(origin LOPTS), undefined)
90 LOPTS = 
91 endif
92 RESLIB = # -L/usr/inet6/lib -linet6
93
94 ifeq ($(HAVE_AFDECnet),1)
95 DNLIB = -ldnet
96 endif
97
98 # -------- end of user definitions --------
99
100 MAINTAINER = Philip.Blundell@pobox.com
101 RELEASE    = 1.55
102
103 .EXPORT_ALL_VARIABLES:
104
105 ifeq ("$(NET_LIB_PATH)","lib2")
106 TOPDIR   = ..
107 else
108 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
109 endif
110
111 NET-LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
112
113 CFLAGS  = $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH)
114 LDFLAGS = $(LOPTS) -L$(NET_LIB_PATH)
115
116 SUBDIRS = man/ $(NET_LIB_PATH)/
117
118 ifeq ($(origin CC), undefined)
119 CC      = gcc
120 endif
121 LD      = $(CC)
122
123 NLIB    = -l$(NET_LIB_NAME)
124
125 MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)'
126
127 %.o:            %.c config.h version.h intl.h net-features.h $<
128                 $(CC) $(CFLAGS) -c $<
129
130 all:            config.h version.h subdirs $(PROGS)
131
132 config:         cleanconfig config.h
133
134 install:        all savebin installbin installdata
135
136 update:         all installbin installdata
137
138 mostlyclean:
139                 rm -f *.o DEADJOE config.new *~ *.orig lib/*.o
140
141 clean: mostlyclean
142                 rm -f $(PROGS)
143                 @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) ; done
144                 @cd po && $(MAKE) clean
145
146 cleanconfig:
147                 rm -f config.h
148
149 clobber:        clean
150                 rm -f $(PROGS) config.h version.h config.status config.make
151                 @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clobber) ; done
152
153
154 dist:           clobber
155                 @echo Creating net-tools-$(RELEASE) in ..
156                 @tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools
157
158
159 config.h:       config.in Makefile 
160                 @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
161                 @if [ config.status -nt config.in ]; \
162                         then ./configure.sh config.status; \
163                    else ./configure.sh config.in; \
164                  fi
165
166
167 version.h:      Makefile
168                 @echo "#define RELEASE \"net-tools $(RELEASE)\"" >version.h
169
170
171 $(NET-LIB):     config.h version.h intl.h libdir
172
173 i18n.h:         i18ndir
174
175 libdir:
176                 @$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES)
177
178 i18ndir:
179                 @$(MAKE) -C po
180
181 subdirs:
182                 @for i in $(SUBDIRS); do $(MAKE) -C $$i $(MDEFINES) ; done
183
184 ifconfig:       $(NET-LIB) ifconfig.o
185                 $(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB)
186
187 hostname:       hostname.o
188                 $(CC) $(LDFLAGS) -o hostname hostname.o $(DNLIB)
189
190 route:          $(NET-LIB) route.o
191                 $(CC) $(LDFLAGS) -o route route.o $(NLIB) $(RESLIB)
192
193 arp:            $(NET-LIB) arp.o
194                 $(CC) $(LDFLAGS) -o arp arp.o $(NLIB) $(RESLIB)
195
196 rarp:           $(NET-LIB) rarp.o
197                 $(CC) $(LDFLAGS) -o rarp rarp.o $(NLIB)
198
199 slattach:       $(NET-LIB) slattach.o
200                 $(CC) $(LDFLAGS) -o slattach slattach.o $(NLIB)
201
202 plipconfig:     $(NET-LIB) plipconfig.o
203                 $(CC) $(LDFLAGS) -o plipconfig plipconfig.o $(NLIB)
204
205 netstat:        $(NET-LIB) netstat.o statistics.o
206                 $(CC) $(LDFLAGS) -o netstat netstat.o statistics.o $(NLIB) $(RESLIB)
207
208 iptunnel:       $(NET-LIB) iptunnel.o
209                 $(CC) $(LDFLAGS) -o iptunnel iptunnel.o $(NLIB) $(RESLIB)
210
211 ipmaddr:        $(NET-LIB) ipmaddr.o
212                 $(CC) $(LDFLAGS) -o ipmaddr ipmaddr.o $(NLIB) $(RESLIB)
213
214 installbin:
215         install -m 0755 -d ${BASEDIR}/sbin
216         install -m 0755 -d ${BASEDIR}/bin
217         install -m 0755 arp        ${BASEDIR}/sbin
218         install -m 0755 ifconfig   ${BASEDIR}/sbin
219         install -m 0755 netstat    ${BASEDIR}/bin
220         install -m 0755 rarp       ${BASEDIR}/sbin
221         install -m 0755 route      ${BASEDIR}/sbin
222         install -m 0755 hostname   ${BASEDIR}/bin
223         install -m 0755 slattach   $(BASEDIR)/sbin
224         install -m 0755 plipconfig $(BASEDIR)/sbin
225 ifeq ($(HAVE_IP_TOOLS),1)
226         install -m 0755 ipmaddr    $(BASEDIR)/sbin
227         install -m 0755 iptunnel   $(BASEDIR)/sbin
228 endif
229         ln -fs hostname $(BASEDIR)/bin/dnsdomainname
230         ln -fs hostname $(BASEDIR)/bin/ypdomainname
231         ln -fs hostname $(BASEDIR)/bin/nisdomainname
232         ln -fs hostname $(BASEDIR)/bin/domainname
233 ifeq ($(HAVE_AFDECnet),1)
234         ln -fs hostname $(BASEDIR)/bin/nodename
235 endif
236
237 savebin:
238         @for i in ${BASEDIR}/sbin/arp ${BASEDIR}/sbin/ifconfig \
239                  ${BASEDIR}/bin/netstat \
240                  ${BASEDIR}/sbin/rarp ${BASEDIR}/sbin/route \
241                  ${BASEDIR}/bin/hostname ${BASEDIR}/bin/ypdomainname \
242                  ${BASEDIR}/bin/dnsdomainname ${BASEDIR}/bin/nisdomainname \
243                  ${BASEDIR}/bin/domainname ; do \
244                  [ -f $$i ] && cp -f $$i $$i.old ; done ; echo Saved.
245
246 installdata:
247         $(MAKE) -C man install
248         $(MAKE) -C po install
249
250 # End of Makefile.