File: Makefile

package info (click to toggle)
rpld 1.8beta1-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 832 kB
  • ctags: 621
  • sloc: ansic: 2,230; asm: 434; yacc: 225; makefile: 169; sh: 40
file content (305 lines) | stat: -rw-r--r-- 6,906 bytes parent folder | download | duplicates (3)
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
# 
# /*************************************************
# *     rpld - an IBM style RIPL server            *
# *************************************************/
# 
# /* Copyright (c) 1999,2000,2001 James McKenzie.
#  *                      All rights reserved
#  * Copyright (c) 1998,2000,2001 Christopher Lightfoot.
#  *                      All rights reserved
#  *
#  * NetBSD and BPF support by Takashi YAMAMOTO
#  * Copyright (C) 2001 YAMAMOTO Takashi <yamt@netbsd.org>.
#  *
#  * By using this file, you agree to the terms and conditions set
#  * forth in the LICENCE file which can be found at the top level of
#  * the rpld distribution.
#  *
#  * IBM is a trademark of IBM corp.
#  *
#  */

#
# $Id: Makefile,v 1.26 2001/11/01 15:26:30 root Exp $
#
# $Log: Makefile,v $
# Revision 1.26  2001/11/01 15:26:30  root
# #
#
# Revision 1.25  2001/11/01 15:24:28  root
# #
#
# Revision 1.24  2001/11/01 15:24:00  root
# #
#
# Revision 1.23  2000/09/26 03:46:20  root
# #
#
# Revision 1.22  2000/09/26 02:32:47  root
# #
#
# Revision 1.21  2000/09/26 02:31:39  root
# #
#
# Revision 1.20  2000/09/26 01:03:22  root
# #
#
#

#

# Important you need to choose a driver for rpld
# there are two sorts of driver for rpld:
#   nit: easy to write and dirty
#        these drivers send a copy of
#        every (LLC) packet transmitted
#        or received to rpld, and greatly
#        increase CPU load.
#
#   llc: these are for systems which have
#        native LLC support, the kernel
#        takes care of the LLC layer and
#        passes decoded data down to rpld  
#

# Available NIT drivers: choose from
#  linux-nit.c:	  For modern kerenels, attempts to persuade the
#		  kernel to send rpld only 802.2 frames thus 
#		  greatly reducing system load. However some
#		  bad voodo magic is required to get it to
#		  send properly.
#
#  linux-old-nit.c:  For older kernels and those with problems.
#                    this is the simplest possible form of driver
#                    it receives every frame tranmitted of received
#                    from the host and places a large extra load on
#                    busy machines.
#                    
#  bpf-nit.c:  For NetBSD and possibly other BPF implementations
#              this version seems to do no filtering, so it receives
#              every frame - increasing system load.
#                    
#  llc-nit.c implements the LLC 802.2 layer ontop of the raw packet (nit)
#  layer and is needed in all cases
#
#  Newer driver
NIT=linux-nit.c
#  Older driver
#NIT=linux-old-nit.c
#  BPF driver for NetBSD (may old work on SunOS, havent checked)
#NIT=bpf-nit.c

DRIVER=llc-nit.c ${NIT}

# Native LLC drivers, to use these you require a kernel with native
# llc support, for linux 2.2 you can use the patches in ./kernel
# for linux 2.3 and 2.4 you can use the LLC stack that comes as 
# part of the linux-sna package available at www.linux-sna.org 
# 
# To use this driver comment out the DRIVER line above and
# uncomment this one
# DRIVER=llc-linux.c

DEFINES=

# where do you want all this stuff

DESTDIR=/usr/local

# Stuff
CC	 = gcc
INCLUDES = 
OPT	 = -O
CFLAGS   = ${OPT} ${INCLUDES} ${DEFINES}
LIBS     = 
LDFLAGS  =

# Where to find yacc and lex
YACC=yacc
LEX=lex

# Where to find BSD compatible install
INSTALL=install

################# NO USER SERVICABLE PARTS BELOW HERE

VERSION=1.8

COFLAGS = -l

default:do-it-all

ifeq (.depend,$(wildcard .depend))
include .depend
do-it-all: all
	@echo " " Now type make install to install rpld
	@echo " " or make nics to assemble the adapter utilities
	@echo " " or make realtime to capture and analyse RPL traffic

else
do-it-all: depend
	@echo " " Now type make again to build rpld
endif

BINDIR= ${DESTDIR}/sbin
NROFF=  groff -Tascii
NRCLN = sed 's/.//g'
MANDOC= -mandoc
BINOWN= root
BINGRP= kmem
BINMODE=555

MANOWN= bin
MANGRP= bin
MANMODE=444

MANROOT=${DESTDIR}/man/man
MAN8=   ${MANROOT}8
MAN8EXT=8
MAN8SRC=man
MAN5=   ${MANROOT}5
MAN5EXT=5
MAN5SRC=man


PROTOSRC = protocol.c rpld.c util.c rpl.c client.c config.c  
HSRCS=rpl.h project.h rpl.h llc.h client.h  nit.h

CSRCS=${PROTOSRC} ${DRIVER}

YSRCS=rpld_conf.y
LSRCS=rpld_conf.lex
MANSRCS=rpld.man rpld.conf.man

ALLSRCS=${CSRCS}

RCSCFILES=${CSRCS} ${HSRCS} linux-nit.c linux-old-nit.c llc-linux.c bpf-nit.c
RCSFILES=${RCSCFILES} ${YSRCS} ${LSRCS} ${MANSRCS} ana.c


PROTOH=prototypes.h

PROG=rpld

OBJS=${CSRCS:%.c=%.o} ${YSRCS:%.y=%.yy.o} ${LSRCS:%.lex=%.tab.o}

YGUFF=${YSRCS:%.y=%.yy.c} ${LSRCS:%.lex=%.tab.c} ${LSRCS:%.lex=%.tab.h}

all:${PROG} ana doc




install: install-prog install-docs
	@echo " " you can find a sample configuration file
	@echo " " in this directory called rpld.conf.sample
	@echo " " your config file should be placed in /etc/rpld.conf

MEN=rpld.conf.5 rpld.8
TXTMEN=${MEN:%=doc/%}

doc:${MEN} 

doc/rpld.8:rpld.man
	${NROFF} ${MANDOC} $< | ${NRCLN} > $@
doc/rpld.conf.5:rpld.conf.man
	${NROFF} ${MANDOC} $< | ${NRCLN} > $@

%.${MAN8EXT}:%.${MAN8SRC}
	cp $< $@

%.${MAN5EXT}:%.${MAN5SRC}
	cp $< $@

install-prog:${PROG}
	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} ${PROG} ${BINDIR}

install-docs: doc
	${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} rpld.${MAN8EXT} ${MAN8}/rpld.${MAN8EXT}
	${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} rpld.conf.${MAN5EXT} ${MAN5}/rpld.conf.${MAN5EXT}

ana:ana.c ${NIT}
#linux-old-nit.c

realtime: ana
	./ana

#capture: 
#	tcpdump -x -s 2048 ether[14]=0xfc and ether[15]=0xfc -w capture.dat

#replay: ana capture.dat
#	tcpdump -x -r capture.dat | ana


nics: nics.doesntexist

nics.doesntexist:
	${MAKE} -C nics

${PROG}:${OBJS}
	${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}

clean: nodep
	/bin/rm -rf ${OBJS} *% *~ *.o *.BAK core a.out ${PROG}
	/bin/rm -rf ${YSRCS:%.y=%.yy.c} ${LSRCS:%.lex=%.tab.c}
	/bin/rm -rf ${LSRCS:%.lex=%.tab.h}
	/bin/rm -rf ana capture.dat
	/bin/rm -rf nics.stamp
	/bin/rm -rf ${MEN} Makefile.bak
	${MAKE} -C nics clean

proto: ${PROTOSRCS} ${HSRCS} ${LSRCS:%.lex=%.tab.h}
	echo -n > ${PROTOH}
	echo -n > ${PROTOH}.tmp
	for i in ${PROTOSRC}; do cproto -e -v $$i | grep -v inline >> ${PROTOH}.tmp  ; done
	/bin/mv -f ${PROTOH}.tmp ${PROTOH}



depend: ${RCSFILES} ${YSRCS:%.y=%.tab.h} 
	makedepend -f- ${INCLUDES} ${ALLSRCS} > .depend

nodep:
	/bin/rm -rf .depend

tidy:
	ci -l -m\# ${RCSFILES}
	indent -ts0 -i2 ${RCSCFILES}
	ci -l -m\# ana.c
	indent -ts0 -i2 ana.c
	/bin/rm -rf nics.stamp
	${MAKE} -C nics tidy
	ci -l -m\# Makefile

checkin:
	ci -m\# ${RCSFILES}
checkout:
	ci -l ${RCSFILES}

MYDIR=rpld-${VERSION}

distrib: 
	${MAKE} tidy
	${MAKE} proto
	${MAKE} doc
	${MAKE} clean
	${MAKE} yguff
	${MAKE} ${TXTMEN}
	${MAKE} -C nics
	cd ..; tar cvfzX ${MYDIR}/DISTRIB/${MYDIR}.tar.gz ${MYDIR}/.xclude ${MYDIR}

yguff:${YGUFF}
	

%.tab.c:%.y
	${YACC} -d -b ${@:%.tab.c=%} $<

%.tab.h:%.y
	${YACC} -d -b ${@:%.tab.h=%} $<

%.yy.c:%.lex
	${LEX} -o$@ $<

config.o: rpld_conf.tab.h

# DO NOT DELETE