2 # Makefile Main Makefile for the net-tools Package
4 # NET-TOOLS A collection of programs that form the base set of the
5 # NET-3 Networking Distribution for the LINUX operating
10 # Author: Bernd Eckenfels <net-tools@lina.inka.de>
11 # Copyright 1995-1996 Bernd Eckenfels, Germany
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
17 # Based on: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
18 # Copyright 1988-1993 MicroWalt Corporation
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
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.
29 # {1.20} Bernd Eckenfels: Even more modifications for the new
31 # {1.21} Bernd Eckenfels: Check if config.in is newer than
33 # {1.22} Bernd Eckenfels: Include ypdomainname and nisdomainame
35 # 1.3.50-BETA6 private Release
37 #960125 {1.23} Bernd Eckenfels: Peter Tobias' rewrite for
38 # makefile-based installation
39 # 1.3.50-BETA6a private Release
41 #960201 {1.24} Bernd Eckenfels: net-features.h added
43 #960201 1.3.50-BETA6b private Release
45 #960203 1.3.50-BETA6c private Release
47 #960204 1.3.50-BETA6d private Release
49 #960204 {1.25} Bernd Eckenfels: DISTRIBUTION added
51 #960205 1.3.50-BETA6e private Release
53 #960206 {1.26} Bernd Eckenfels: afrt.o removed (cleaner solution)
55 #960215 1.3.50-BETA6f Release
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
61 #960514 1.31-alpha release
63 #960518 {1.33} Bernd Eckenfels: -I/usr/src/linux/include comment added
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.
72 # set the base of the Installation
76 # path to the net-lib support library. Default: lib
78 NET_LIB_NAME = net-tools
80 PROGS := ifconfig hostname arp netstat route rarp slattach plipconfig nameif
83 ifeq ($(HAVE_IP_TOOLS),1)
84 PROGS += iptunnel ipmaddr
90 # Compiler and Linker Options
91 # You may need to uncomment and edit these if you are using libc5 and IPv6.
94 CFLAGS += -fno-strict-aliasing # code needs a lot of work before strict aliasing is safe
95 CPPFLAGS += -D_GNU_SOURCE
96 RESLIB = # -L/usr/inet6/lib -linet6
98 ifeq ($(HAVE_AFDECnet),1)
102 # -------- end of user definitions --------
104 MAINTAINER = Philip.Blundell@pobox.com
107 .EXPORT_ALL_VARIABLES:
109 ifeq ("$(NET_LIB_PATH)","lib2")
112 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
115 NET_LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
117 CPPFLAGS += -I. -I$(TOPDIR)/include -I$(NET_LIB_PATH)
118 LDFLAGS += -L$(NET_LIB_PATH)
120 SUBDIRS = man/ $(NET_LIB_PATH)/
122 ifeq ($(origin CC), undefined)
127 NLIB = -l$(NET_LIB_NAME)
129 %.o: %.c config.h version.h intl.h lib/net-features.h $<
130 $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
132 all: config.h version.h subdirs $(PROGS)
134 config: cleanconfig config.h
136 install: all savebin installbin installdata
138 update: all installbin installdata
141 rm -f *.o DEADJOE config.new *~ *.orig lib/*.o
145 @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) ; done
146 @cd po && $(MAKE) clean
152 rm -f $(PROGS) config.h version.h config.status config.make
153 @for i in $(SUBDIRS); do (cd $$i && $(MAKE) clobber) ; done
158 @echo Creating net-tools-$(RELEASE) in ..
159 @tar -cvz -f ../net-tools-$(RELEASE).tar.gz . \
160 --transform='s,^[.],net-tools-$(RELEASE),' \
161 --exclude=CVS --exclude=.cvsignore \
165 config.h: config.in Makefile
166 @echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
167 @if [ config.status -nt config.in ]; \
168 then ./configure.sh config.status; \
169 else ./configure.sh config.in; \
174 @echo "#define RELEASE \"net-tools $(RELEASE)\"" >version.h
177 $(NET_LIB): config.h version.h intl.h libdir
182 @$(MAKE) -C $(NET_LIB_PATH)
187 # use libdir target for lib/ to avoid parallel build issues
189 @for i in $(SUBDIRS:$(NET_LIB_PATH)/=); do $(MAKE) -C $$i || exit $$? ; done
191 ifconfig: $(NET_LIB) ifconfig.o
192 $(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB)
195 $(CC) $(LDFLAGS) -o nameif nameif.o
198 $(CC) $(LDFLAGS) -o hostname hostname.o $(DNLIB)
200 route: $(NET_LIB) route.o
201 $(CC) $(LDFLAGS) -o route route.o $(NLIB) $(RESLIB)
203 arp: $(NET_LIB) arp.o
204 $(CC) $(LDFLAGS) -o arp arp.o $(NLIB) $(RESLIB)
206 rarp: $(NET_LIB) rarp.o
207 $(CC) $(LDFLAGS) -o rarp rarp.o $(NLIB)
209 slattach: $(NET_LIB) slattach.o
210 $(CC) $(LDFLAGS) -o slattach slattach.o $(NLIB)
212 plipconfig: $(NET_LIB) plipconfig.o
213 $(CC) $(LDFLAGS) -o plipconfig plipconfig.o $(NLIB)
215 netstat: $(NET_LIB) netstat.o statistics.o
216 $(CC) $(LDFLAGS) -o netstat netstat.o statistics.o $(NLIB) $(RESLIB)
218 iptunnel: $(NET_LIB) iptunnel.o
219 $(CC) $(LDFLAGS) -o iptunnel iptunnel.o $(NLIB) $(RESLIB)
221 ipmaddr: $(NET_LIB) ipmaddr.o
222 $(CC) $(LDFLAGS) -o ipmaddr ipmaddr.o $(NLIB) $(RESLIB)
225 $(CC) $(LDFLAGS) -o mii-tool mii-tool.o
228 install -m 0755 -d ${BASEDIR}/sbin
229 install -m 0755 -d ${BASEDIR}/bin
230 install -m 0755 arp ${BASEDIR}/sbin
231 install -m 0755 hostname ${BASEDIR}/bin
232 install -m 0755 ifconfig ${BASEDIR}/sbin
233 install -m 0755 nameif ${BASEDIR}/sbin
234 install -m 0755 netstat ${BASEDIR}/bin
235 install -m 0755 plipconfig $(BASEDIR)/sbin
236 install -m 0755 rarp ${BASEDIR}/sbin
237 install -m 0755 route ${BASEDIR}/sbin
238 install -m 0755 slattach $(BASEDIR)/sbin
239 ifeq ($(HAVE_IP_TOOLS),1)
240 install -m 0755 ipmaddr $(BASEDIR)/sbin
241 install -m 0755 iptunnel $(BASEDIR)/sbin
244 install -m 0755 mii-tool $(BASEDIR)/sbin
246 ln -fs hostname $(BASEDIR)/bin/dnsdomainname
247 ln -fs hostname $(BASEDIR)/bin/ypdomainname
248 ln -fs hostname $(BASEDIR)/bin/nisdomainname
249 ln -fs hostname $(BASEDIR)/bin/domainname
250 ifeq ($(HAVE_AFDECnet),1)
251 ln -fs hostname $(BASEDIR)/bin/nodename
255 @for i in ${BASEDIR}/sbin/arp ${BASEDIR}/sbin/ifconfig \
256 ${BASEDIR}/bin/netstat \
257 ${BASEDIR}/sbin/rarp ${BASEDIR}/sbin/route \
258 ${BASEDIR}/bin/hostname ${BASEDIR}/bin/ypdomainname \
259 ${BASEDIR}/bin/dnsdomainname ${BASEDIR}/bin/nisdomainname \
260 ${BASEDIR}/bin/domainname ; do \
261 [ -f $$i ] && cp -f $$i $$i.old ; done ; echo Saved.
264 $(MAKE) -C man install
265 $(MAKE) -C po install