Makefile 6.67 KB
Newer Older
Phil Blundell's avatar
Phil Blundell committed
1 2 3 4 5 6 7
#
# Makefile	Main Makefile for the net-tools Package
#
# NET-TOOLS	A collection of programs that form the base set of the
#		NET-3 Networking Distribution for the LINUX operating
#		system.
#
8
# Version:	Makefile 1.45 (1996-06-29)
Phil Blundell's avatar
Phil Blundell committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#
# Author:	Bernd Eckenfels <net-tools@lina.inka.de>
#		Copyright 1995-1996 Bernd Eckebnfels, Germany
#
# URLs:		ftp://ftp.inka.de/pub/comp/Linux/networking/NetTools/ 
#		ftp://ftp.linux.org.uk/pub/linux/Networking/PROGRAMS/NetTools/
#		http://www.inka.de/sites/lina/linux/NetTools/index_en.html
#
# Based on:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
#		Copyright 1988-1993 MicroWalt Corporation
#
# Modifications:
#		Extensively modified from 01/21/94 onwards by
#		Alan Cox <A.Cox@swansea.ac.uk>
#		Copyright 1993-1994 Swansea University Computer Society
24 25 26 27
#
# Be careful! 
# This Makefile doesn't describe complete dependencies for all include files.
# If you change include files you might need to do make clean. 
Phil Blundell's avatar
Phil Blundell committed
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
#
#	{1.20}	Bernd Eckenfels:	Even more modifications for the new 
#					package layout
#	{1.21}	Bernd Eckenfels:	Check if config.in is newer than 
#					config.status
#	{1.22}  Bernd Eckenfels:	Include ypdomainname and nisdomainame
#
#	1.3.50-BETA6 private Release
#				
#960125	{1.23}	Bernd Eckenfels:	Peter Tobias' rewrite for 
#					makefile-based installation
#	1.3.50-BETA6a private Release
#
#960201 {1.24}	Bernd Eckenfels:	net-features.h added
#
#960201 1.3.50-BETA6b private Release
#
#960203 1.3.50-BETA6c private Release
#
#960204 1.3.50-BETA6d private Release
#
#960204 {1.25}	Bernd Eckenfels:	DISTRIBUTION added
#
#960205 1.3.50-BETA6e private Release
#
#960206	{1.26}	Bernd Eckenfels:	afrt.o removed (cleaner solution)
#
#960215 1.3.50-BETA6f Release
#
#960216 {1.30}	Bernd Eckenfels:	net-lib support
#960322 {1.31}	Bernd Eckenfels:	moveable netlib, TOPDIR
#960424 {1.32}	Bernd Eckenfels:	included the URLs in the Comment
#
#960514 1.31-alpha release
#
#960518 {1.33}	Bernd Eckenfels:	-I/usr/src/linux/include comment added
#
#	This program is free software; you can redistribute it
#	and/or  modify it under  the terms of  the GNU General
#	Public  License as  published  by  the  Free  Software
#	Foundation;  either  version 2 of the License, or  (at
#	your option) any later version.
#

# set the base of the Installation 
# BASEDIR = /mnt

# path to the net-lib support library. Default: lib
76 77
NET_LIB_PATH = lib
NET_LIB_NAME = net-tools
Phil Blundell's avatar
Phil Blundell committed
78

79 80 81 82 83 84
PROGS	:= ifconfig hostname arp netstat route rarp slattach plipconfig

-include config.make
ifeq ($(HAVE_IP_TOOLS),1)
PROGS   += iptunnel ipmaddr
endif
Phil Blundell's avatar
Phil Blundell committed
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)
Phil Blundell's avatar
Phil Blundell committed
90
LOPTS = 
91
endif
Phil Blundell's avatar
Phil Blundell committed
92 93
RESLIB = # -L/usr/inet6/lib -linet6

94 95 96 97
ifeq ($(HAVE_AFDECnet),1)
DNLIB = -ldnet
endif

Phil Blundell's avatar
Phil Blundell committed
98 99 100
# -------- end of user definitions --------

MAINTAINER = Philip.Blundell@pobox.com
Phil Blundell's avatar
Phil Blundell committed
101
RELEASE	   = 1.55
Phil Blundell's avatar
Phil Blundell committed
102 103 104

.EXPORT_ALL_VARIABLES:

105
ifeq ("$(NET_LIB_PATH)","lib2")
Phil Blundell's avatar
Phil Blundell committed
106 107 108 109 110
TOPDIR   = ..
else
TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
endif

111
NET-LIB = $(NET_LIB_PATH)/lib$(NET_LIB_NAME).a
Phil Blundell's avatar
Phil Blundell committed
112

113
CFLAGS	= $(COPTS) -I. -idirafter ./include/ -I$(NET_LIB_PATH)
114
LDFLAGS	= $(LOPTS) -L$(NET_LIB_PATH)
Phil Blundell's avatar
Phil Blundell committed
115

116
SUBDIRS	= man/ $(NET_LIB_PATH)/
Phil Blundell's avatar
Phil Blundell committed
117

118
ifeq ($(origin CC), undefined)
Phil Blundell's avatar
Phil Blundell committed
119
CC	= gcc
120 121
endif
LD	= $(CC)
Phil Blundell's avatar
Phil Blundell committed
122

123
NLIB	= -l$(NET_LIB_NAME)
Phil Blundell's avatar
Phil Blundell committed
124 125 126

MDEFINES = COPTS='$(COPTS)' LOPTS='$(LOPTS)' TOPDIR='$(TOPDIR)'

127
%.o:		%.c config.h version.h intl.h net-features.h $<
Phil Blundell's avatar
Phil Blundell committed
128 129 130 131 132 133 134 135 136 137
		$(CC) $(CFLAGS) -c $<

all:		config.h version.h subdirs $(PROGS)

config: 	cleanconfig config.h

install:	all savebin installbin installdata

update: 	all installbin installdata

138
mostlyclean:
Phil Blundell's avatar
Phil Blundell committed
139
		rm -f *.o DEADJOE config.new *~ *.orig lib/*.o
140 141 142

clean: mostlyclean
		rm -f $(PROGS)
143 144
		@for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean) ; done
		@cd po && $(MAKE) clean
Phil Blundell's avatar
Phil Blundell committed
145 146 147 148 149

cleanconfig:
		rm -f config.h

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
Phil Blundell's avatar
Phil Blundell committed
152 153 154 155


dist: 		clobber
		@echo Creating net-tools-$(RELEASE) in ..
156
		@tar -cvz -f ../net-tools-$(RELEASE).tar.gz -C .. net-tools
Phil Blundell's avatar
Phil Blundell committed
157 158 159 160 161


config.h: 	config.in Makefile 
		@echo "Configuring the Linux net-tools (NET-3 Base Utilities)..." ; echo
		@if [ config.status -nt config.in ]; \
162 163
			then ./configure.sh config.status; \
		   else ./configure.sh config.in; \
Phil Blundell's avatar
Phil Blundell committed
164 165 166 167 168 169 170
		 fi


version.h:	Makefile
		@echo "#define RELEASE \"net-tools $(RELEASE)\"" >version.h


171
$(NET-LIB):	config.h version.h intl.h libdir
Phil Blundell's avatar
Phil Blundell committed
172

173
i18n.h:		i18ndir
Phil Blundell's avatar
Phil Blundell committed
174 175

libdir:
176
		@$(MAKE) -C $(NET_LIB_PATH) $(MDEFINES)
Phil Blundell's avatar
Phil Blundell committed
177

178 179
i18ndir:
		@$(MAKE) -C po
Phil Blundell's avatar
Phil Blundell committed
180 181 182 183

subdirs:
		@for i in $(SUBDIRS); do $(MAKE) -C $$i $(MDEFINES) ; done

184 185
ifconfig:	$(NET-LIB) ifconfig.o
		$(CC) $(LDFLAGS) -o ifconfig ifconfig.o $(NLIB) $(RESLIB)
Phil Blundell's avatar
Phil Blundell committed
186 187

hostname:	hostname.o
188
		$(CC) $(LDFLAGS) -o hostname hostname.o $(DNLIB)
Phil Blundell's avatar
Phil Blundell committed
189 190 191 192 193 194 195 196 197 198

route:		$(NET-LIB) route.o
		$(CC) $(LDFLAGS) -o route route.o $(NLIB) $(RESLIB)

arp:		$(NET-LIB) arp.o
		$(CC) $(LDFLAGS) -o arp arp.o $(NLIB) $(RESLIB)

rarp:		$(NET-LIB) rarp.o
		$(CC) $(LDFLAGS) -o rarp rarp.o $(NLIB)

199 200 201 202 203 204 205 206 207 208 209 210 211 212
slattach:	$(NET-LIB) slattach.o
		$(CC) $(LDFLAGS) -o slattach slattach.o $(NLIB)

plipconfig:	$(NET-LIB) plipconfig.o
		$(CC) $(LDFLAGS) -o plipconfig plipconfig.o $(NLIB)

netstat:	$(NET-LIB) netstat.o statistics.o
		$(CC) $(LDFLAGS) -o netstat netstat.o statistics.o $(NLIB) $(RESLIB)

iptunnel:	$(NET-LIB) iptunnel.o
		$(CC) $(LDFLAGS) -o iptunnel iptunnel.o $(NLIB) $(RESLIB)

ipmaddr:	$(NET-LIB) ipmaddr.o
		$(CC) $(LDFLAGS) -o ipmaddr ipmaddr.o $(NLIB) $(RESLIB)
Phil Blundell's avatar
Phil Blundell committed
213 214

installbin:
215 216
	install -m 0755 -d ${BASEDIR}/sbin
	install -m 0755 -d ${BASEDIR}/bin
217 218 219 220 221 222 223 224
	install -m 0755 arp        ${BASEDIR}/sbin
	install -m 0755 ifconfig   ${BASEDIR}/sbin
	install -m 0755 netstat    ${BASEDIR}/bin
	install -m 0755 rarp       ${BASEDIR}/sbin
	install -m 0755 route      ${BASEDIR}/sbin
	install -m 0755 hostname   ${BASEDIR}/bin
	install -m 0755 slattach   $(BASEDIR)/sbin
	install -m 0755 plipconfig $(BASEDIR)/sbin
225
ifeq ($(HAVE_IP_TOOLS),1)
226 227
	install -m 0755 ipmaddr    $(BASEDIR)/sbin
	install -m 0755 iptunnel   $(BASEDIR)/sbin
228
endif
Phil Blundell's avatar
Phil Blundell committed
229 230 231 232
	ln -fs hostname $(BASEDIR)/bin/dnsdomainname
	ln -fs hostname $(BASEDIR)/bin/ypdomainname
	ln -fs hostname $(BASEDIR)/bin/nisdomainname
	ln -fs hostname $(BASEDIR)/bin/domainname
233 234 235
ifeq ($(HAVE_AFDECnet),1)
	ln -fs hostname $(BASEDIR)/bin/nodename
endif
Phil Blundell's avatar
Phil Blundell committed
236 237 238 239 240 241 242 243 244 245 246

savebin:
	@for i in ${BASEDIR}/sbin/arp ${BASEDIR}/sbin/ifconfig \
                 ${BASEDIR}/bin/netstat \
		 ${BASEDIR}/sbin/rarp ${BASEDIR}/sbin/route \
		 ${BASEDIR}/bin/hostname ${BASEDIR}/bin/ypdomainname \
                 ${BASEDIR}/bin/dnsdomainname ${BASEDIR}/bin/nisdomainname \
		 ${BASEDIR}/bin/domainname ; do \
		 [ -f $$i ] && cp -f $$i $$i.old ; done ; echo Saved.

installdata:
247 248
	$(MAKE) -C man install
	$(MAKE) -C po install
Phil Blundell's avatar
Phil Blundell committed
249 250

# End of Makefile.